|
Hello,
I want to detect the existence of a microphone and its details before recording.
I coded the function below. The problem is, I can't get the device name (e.g., cde linux arecord -l result="card 1: UM1 [WOODBRASS UM1], device 0: USB Audio [USB Audio]").
one solution ?
thanks.
ma fonction:
//Ctrl existance input MIC
function MIC_lireinfo(var vMicDeviceName,vMicHostAPIName:string;var vmes:string):boolean;
var VuosDefaultDeviceIn:cint32;
VTuos_DeviceInfos:Tuos_DeviceInfos;
devinf: PPaDeviceInfo;
apiinf: PPaHostApiInfo;
begin
result:=false;vmes:='';
VuosDefaultDeviceIn:=Pa_GetDefaultInPutDevice ();
if VuosDefaultDeviceIn=-1
then vmes:='MIC: pas de micro'
else begin
result:=true;
VTuos_DeviceInfos.DeviceNum :=VuosDefaultDeviceIn;//x;
devinf := Pa_GetDeviceInfo (VuosDefaultDeviceIn);//x);
apiinf := Pa_GetHostApiInfo (devinf^.hostApi);
VTuos_DeviceInfos.DeviceName := UTF8Decode (devinf^._name);
VTuos_DeviceInfos.HostAPIName := UTF8Decode (apiinf^._name);
vMicDeviceName:=VTuos_DeviceInfos.DeviceName;
vMicHostAPIName:=VTuos_DeviceInfos.HostAPIName ;
end;
end;
Resultat "apiinf^":
record PAHOSTAPIINFO {
STRUCTVERSION = 1,
_TYPE = PAALSA,
_NAME = 'ALSA',
DEVICECOUNT = 11,
DEFAULTINPUTDEVICE = 10,
DEFAULTOUTPUTDEVICE = 10}
Resultat "devinf^":
record PADEVICEINFO {
STRUCTVERSION = 2,
_NAME = 'default',
HOSTAPI = 0,
MAXINPUTCHANNELS = 32,
MAXOUTPUTCHANNELS = 32,
DEFAULTLOWINPUTLATENCY = 0.0086848072562358269,
DEFAULTLOWOUTPUTLATENCY = 0.0086848072562358269,
DEFAULTHIGHINPUTLATENCY = 0.034807256235827665,
DEFAULTHIGHOUTPUTLATENCY = 0.034807256235827665,
DEFAULTSAMPLERATE = 44100}
|