static void winsndcard_detect(MSSndCardManager *m){ MMRESULT mr = NOERROR; unsigned int nOutDevices = waveOutGetNumDevs (); unsigned int nInDevices = waveInGetNumDevs (); unsigned int item; if (nOutDevices>nInDevices) nInDevices = nOutDevices; for (item = 0; item < nInDevices; item++){ WAVEINCAPS incaps; WAVEOUTCAPS outcaps; mr = waveInGetDevCaps (item, &incaps, sizeof (WAVEINCAPS)); if (mr == MMSYSERR_NOERROR) { #if defined(_WIN32_WCE) char card[256]; snprintf(card, sizeof(card), "Input card %i", item); add_or_update_card(m,card,item,-1,MS_SND_CARD_CAP_CAPTURE); /* _tprintf(L"new card: %s", incaps.szPname); */ #else add_or_update_card(m,incaps.szPname,item,-1,MS_SND_CARD_CAP_CAPTURE); #endif } mr = waveOutGetDevCaps (item, &outcaps, sizeof (WAVEOUTCAPS)); if (mr == MMSYSERR_NOERROR) { #if defined(_WIN32_WCE) char card[256]; snprintf(card, sizeof(card), "Output card %i", item); add_or_update_card(m,card,-1,item,MS_SND_CARD_CAP_PLAYBACK); /* _tprintf(L"new card: %s", outcaps.szPname); */ #else add_or_update_card(m,outcaps.szPname,-1,item,MS_SND_CARD_CAP_PLAYBACK); #endif } } }
static void winsndcard_detect(MSSndCardManager *m){ MMRESULT mr = NOERROR; unsigned int nOutDevices = waveOutGetNumDevs (); unsigned int nInDevices = waveInGetNumDevs (); unsigned int item; char card[256]={0}; if (nOutDevices>nInDevices) nInDevices = nOutDevices; for (item = 0; item < nInDevices; item++){ WAVEINCAPS incaps; WAVEOUTCAPS outcaps; mr = waveInGetDevCaps (item, &incaps, sizeof (WAVEINCAPS)); if (mr == MMSYSERR_NOERROR) { #if defined(_WIN32_WCE) snprintf(card, sizeof(card), "Input card %i", item); #else WideCharToMultiByte(CP_UTF8,0,incaps.szPname,-1 ,card,sizeof(card)-1,NULL,NULL); #endif add_or_update_card(m,card,item,-1,MS_SND_CARD_CAP_CAPTURE); } mr = waveOutGetDevCaps (item, &outcaps, sizeof (WAVEOUTCAPS)); if (mr == MMSYSERR_NOERROR) { #if defined(_WIN32_WCE) snprintf(card, sizeof(card), "Output card %i", item); #else WideCharToMultiByte(CP_UTF8,0,outcaps.szPname,-1 ,card,sizeof(card)-1,NULL,NULL); #endif add_or_update_card(m,card,-1,item,MS_SND_CARD_CAP_PLAYBACK); } } }
static void winsndcard_detect(MSSndCardManager *m){ MMRESULT mr = NOERROR; unsigned int nOutDevices = waveOutGetNumDevs (); unsigned int nInDevices = waveInGetNumDevs (); unsigned int item; unsigned int code_page; char namebuf[64]; char nameutf_8[256]; code_page = GetACP(); if (nOutDevices>nInDevices) nInDevices = nOutDevices; for (item = 0; item < nInDevices; item++){ WAVEINCAPS incaps; WAVEOUTCAPS outcaps; memset(namebuf, 0, 64); memset(nameutf_8, 0, 256); mr = waveInGetDevCaps (item, &incaps, sizeof (WAVEINCAPS)); if (mr == MMSYSERR_NOERROR) { #if defined(_WIN32_WCE) char card[256]; snprintf(card, sizeof(card), "Input card %i", item); add_or_update_card(m,card,item,-1,MS_SND_CARD_CAP_CAPTURE); /* _tprintf(L"new card: %s", incaps.szPname); */ #else #if defined(_MSC_VER) //WideCharToMultiByte(CP_ACP, 0, incaps.szPname, -1, namebuf, 64, NULL, NULL); //GBKToUTF8(namebuf, nameutf_8, 256); //if(code_page != 65001U){ WideCharToMultiByte(CP_UTF8,0,incaps.szPname,-1,nameutf_8,256,NULL,NULL); add_or_update_card(m,nameutf_8,item,-1,MS_SND_CARD_CAP_CAPTURE); //ms_warning("add_or_update_card: %s\n", nameutf_8); //} #else add_or_update_card(m,incaps.szPname,item,-1,MS_SND_CARD_CAP_CAPTURE); ms_warning("add_or_update_card: %s\n", incaps.szPname); #endif #endif } mr = waveOutGetDevCaps (item, &outcaps, sizeof (WAVEOUTCAPS)); if (mr == MMSYSERR_NOERROR) { #if defined(_WIN32_WCE) char card[256]; snprintf(card, sizeof(card), "Output card %i", item); add_or_update_card(m,card,-1,item,MS_SND_CARD_CAP_PLAYBACK); /* _tprintf(L"new card: %s", outcaps.szPname); */ #else #if defined(_MSC_VER) //WideCharToMultiByte(CP_ACP, 0, outcaps.szPname, -1, namebuf, 64, NULL, NULL); //GBKToUTF8(namebuf, nameutf_8, 256); //if(code_page != 65001U){ WideCharToMultiByte(CP_UTF8,0,outcaps.szPname,-1,nameutf_8,256,NULL,NULL); add_or_update_card(m,nameutf_8,-1,item,MS_SND_CARD_CAP_PLAYBACK); //} //ms_warning("add_or_update_card: %s\n", nameutf_8); #else add_or_update_card(m,outcaps.szPname,-1,item,MS_SND_CARD_CAP_PLAYBACK); ms_warning("add_or_update_card: %s\n", outcaps.szPname); #endif #endif } } }