Salve,
mi piacerebbe ottenere delle informazioni riguardanti i dispositivi di audio in input nel mio pc. Per ottenere questi dati devoi fare ricorso alla API di Win32 "Waveform" (winmm.lib). Per adesso l'unica funzione dell'api in questione che so usare è la seguente:
waveInGetNumDevs
codice:
#include <windows.h>
#pragma comment (lib, "winmm.lib")
#include <mmsystem.h>
#include <iostream>
int main()
{
UINT nDevices = waveInGetNumDevs();
std::cout << nDevices <<std::endl;
return 0;
}
che mi ritorna quanti dispositivi audio in input sono disponibili. Ora mi piacerebbe espandere il mio programma ed ottenere più info su ognuno di questi dispositivi, usando quindi la funzione waveInGetDevCaps che ha la seguente struttura:
codice:
MMRESULT waveInGetDevCaps(
UINT uDeviceID, // Identifier of the waveform-audio output device.
LPWAVEINCAPS pwic, // Address of a WAVEINCAPS structure to be filled with information about the capabilities of the device.
UINT cbwic // Size, in bytes, of the WAVEINCAPS structure.
);
quindi questa funzione ha bisogno in un parametro il passaggio ad una struttura del genere WAVEINCAPS
codice:
typedef struct {
WORD wMid; // Manufacturer identifier for the device driver
WORD wPid; // Product identifier for the waveform-audio input device.
MMVERSION vDriverVersion; // Version number of the device driver.
CHAR szPname[MAXPNAMELEN]; // Product name in a null-terminated string.
DWORD dwFormats; // Standard formats that are supported.
WORD wChannels; // Number specifying whether the device supports mono or stereo
WORD wReserved1; // Padding. (?)
} WAVEINCAPS;
ho provato quindi il seguente codice:
codice:
#include <windows.h>
#pragma comment (lib, "winmm.lib")
#include <mmsystem.h>
#include <iostream>
int main()
{
UINT nDevices = waveInGetNumDevs();
WAVEINCAPS wcps;
waveInGetDevCaps(1,wcps,sizeof(wcps));
std::cout << nDevices <<std::endl;
return 0;
}
e questo è l'errore che ottengo:
error C2664: 'waveInGetDevCapsA' : cannot convert parameter 2 from 'WAVEINCAPS' to 'LPWAVEINCAPSA'
qual'è lo sbaglio??
grazie