How get info about device input MIC (Raspberry/debian11/lazarus)

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How get info about device input MIC (Raspberry/debian11/lazarus)

lucarnet
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}

Reply | Threaded
Open this post in threaded view
|

Re: How get info about device input MIC (Raspberry/debian11/lazarus)

lucarnet
hello,
After testing your main_sr.pas program, this program does not detect the absence of a microphone.
How can I fix this problem?
Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: How get info about device input MIC (Raspberry/debian11/lazarus)

fredvs
Administrator
Hello.

I am a few lost in your code, sorry.

Did you try the uos demo Device Infos ?
It should give the list of input devices, including mic.
Now if you want to know if a mic was connected to the input device (for example in the input mini-jack) sorry but I dont know how to get this.