这篇教程C++ waveOutGetNumDevs函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中waveOutGetNumDevs函数的典型用法代码示例。如果您正苦于以下问题:C++ waveOutGetNumDevs函数的具体用法?C++ waveOutGetNumDevs怎么用?C++ waveOutGetNumDevs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了waveOutGetNumDevs函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: get_idx_playback_from_namestatic boolget_idx_playback_from_name(int *idx, const char *name){ int i; WAVEOUTCAPSA wa_device; if (!waveOutGetNumDevs()) { return false; } for (i = 0; i < waveOutGetNumDevs(); i++) { memset(&wa_device, 0, sizeof(wa_device)); if (waveOutGetDevCapsA(i, &wa_device, sizeof(wa_device)) == 0) { if (!strcmp(wa_device.szPname, name)) { *idx = i; return true; } } } return false;}
开发者ID:cm-t,项目名称:tuxdriver,代码行数:26,
示例2: set_tux_as_default_playbackstatic boolset_tux_as_default_playback(void){ int i; WAVEOUTCAPSA wa_device; if (!waveOutGetNumDevs()) { return false; } for (i = 0; i < waveOutGetNumDevs(); i++) { memset(&wa_device, 0, sizeof(wa_device)); if (waveOutGetDevCapsA(i, &wa_device, sizeof(wa_device)) == 0) { if (strstr(wa_device.szPname, "TuxDroid-Audio") != NULL) { if (waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_SET, i, 0) == 0) { return true; } } } } return false;}
开发者ID:cm-t,项目名称:tuxdriver,代码行数:29,
示例3: DllMainBOOLWINAPIDllMain( HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved){ switch (fdwReason) { case DLL_PROCESS_ATTACH: dsound_hInstance = hInstDLL;#if 1 DPRINT("NumDevs %u/n", waveOutGetNumDevs()); if (EnumAudioDeviceInterfaces(&RootInfo) != S_OK) { DPRINT("EnumAudioDeviceInterfaces failed/n"); RootInfo = NULL; }DPRINT1("EnumAudioDeviceInterfaces %p %u/n", RootInfo, waveOutGetNumDevs());#endif DisableThreadLibraryCalls(dsound_hInstance); break; default: break; } return TRUE;}
开发者ID:GYGit,项目名称:reactos,代码行数:28,
示例4: deleteValidWaveOutDevice bool MediaObject::getWaveOutDevice() { deleteValidWaveOutDevice(); for(UINT deviceId = 0; deviceId < waveOutGetNumDevs(); deviceId++) { if(deviceId == waveOutGetNumDevs()) return false; if(waveOutOpen(&m_hWaveOut, WAVE_MAPPER, &m_waveFormatEx, (DWORD)WaveOutCallBack, 0, CALLBACK_FUNCTION) == MMSYSERR_NOERROR) return m_hWaveOut; //m_hWaveOut !=0; } return false; }
开发者ID:sandsmark,项目名称:phonon-visualization-gsoc,代码行数:13,
示例5: Test s32 Test() const { if (waveOutGetNumDevs() == 0) { SysMessage("No waveOut Devices Present/n"); return -1; } return 0; }
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:7,
示例6: PLUGIN_FUNCTION_ARG3 PLUGIN_FUNCTION_ARG3(GetDeviceName,unsigned,index, char *,buffer, unsigned,bufsize) { if (buffer == NULL || bufsize < 4) return PluginLID_InvalidParameter; if (index >= 1) return PluginLID_NoMoreNames; if (StartDeviceDetection(NULL, 0, 0, 0, 0, 0, 0, 0, 0) == 0) return PluginLID_NoMoreNames; CloseDevice(); UINT numDevs = waveOutGetNumDevs(); for (UINT i = 0; i < numDevs; i++) { WAVEOUTCAPS caps; waveOutGetDevCaps(i, &caps, sizeof(caps)); if (strstr(caps.szPname, "USB Audio") != NULL) { if (bufsize <= strlen(caps.szPname)) return PluginLID_BufferTooSmall; int pos = strlen(caps.szPname)-1; while (caps.szPname[pos] == ' ') caps.szPname[pos--] = '/0'; strcpy(buffer, caps.szPname); return PluginLID_NoError; } } return PluginLID_NoMoreNames; }
开发者ID:glei,项目名称:opal,代码行数:31,
示例7: mmio_getdevsvoid mmio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize){ int wRtn, ndev, i; *canmulti = 2; /* supports multiple devices */ ndev = waveInGetNumDevs(); if (ndev > maxndev) ndev = maxndev; *nindevs = ndev; for (i = 0; i < ndev; i++) { WAVEINCAPS wicap; wRtn = waveInGetDevCaps(i, (LPWAVEINCAPS) &wicap, sizeof(wicap)); sprintf(indevlist + i * devdescsize, (wRtn ? "???" : wicap.szPname)); } ndev = waveOutGetNumDevs(); if (ndev > maxndev) ndev = maxndev; *noutdevs = ndev; for (i = 0; i < ndev; i++) { WAVEOUTCAPS wocap; wRtn = waveOutGetDevCaps(i, (LPWAVEOUTCAPS) &wocap, sizeof(wocap)); sprintf(outdevlist + i * devdescsize, (wRtn ? "???" : wocap.szPname)); }}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:29,
示例8: Q_UNUSEDQList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode){ Q_UNUSED(mode) QList<QByteArray> devices; if(mode == QAudio::AudioOutput) { WAVEOUTCAPS woc; unsigned long iNumDevs,i; iNumDevs = waveOutGetNumDevs(); for(i=0;i<iNumDevs;i++) { if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) { devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); } } } else { WAVEINCAPS woc; unsigned long iNumDevs,i; iNumDevs = waveInGetNumDevs(); for(i=0;i<iNumDevs;i++) { if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) { devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); } } } if(devices.count() > 0) devices.append("default"); return devices;}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:33,
示例9: get_device_idstatic UINTget_device_id(const char *device_name){ /* if device is not specified use wave mapper */ if (device_name == NULL) return WAVE_MAPPER; /* check for device id */ char *endptr; UINT id = strtoul(device_name, &endptr, 0); if (endptr > device_name && *endptr == 0) return id; /* check for device name */ for (UINT i = 0; i < waveOutGetNumDevs(); i++) { WAVEOUTCAPS caps; MMRESULT result = waveOutGetDevCaps(i, &caps, sizeof(caps)); if (result != MMSYSERR_NOERROR) continue; /* szPname is only 32 chars long, so it is often truncated. Use partial match to work around this. */ if (strstr(device_name, caps.szPname) == device_name) return i; } /* fallback to wave mapper */ return WAVE_MAPPER;}
开发者ID:GunioRobot,项目名称:mpd,代码行数:28,
示例10: ao_wmm_set_optionint ao_wmm_set_option(ao_device *device, const char *key, const char *value){ ao_wmm_internal *internal = (ao_wmm_internal *) device->internal; int res = 0; if (!strcmp(key, "dev")) { if (!strcmp(value,"default")) { key = "id"; value = "0"; } else { WAVEOUTCAPS caps; int i, max = waveOutGetNumDevs(); adebug("searching for device %s among %d/n", value, max); for (i=0; i<max; ++i) { MMRESULT mmres = waveOutGetDevCaps(i, &caps, sizeof(caps)); if (mmres == MMSYSERR_NOERROR) { res = !strcmp(value, caps.szPname); adebug("checking id=%d, name='%s', ver=%d.%d => [%s]/n", i,caps.szPname,caps.vDriverVersion>>8,caps.vDriverVersion&255,res?"YES":"no"); if (res) { internal->id = i; internal->caps = caps; break; } } else { aerror("waveOutGetDevCaps(%d) => %s",i,mmerror(mmres)); } } goto finish; }
开发者ID:Distrotech,项目名称:libao,代码行数:32,
示例11: InitializeWaveOutbool CAudio::InitializeWaveOut(){ if (!waveOutGetNumDevs()) return false; for (int i = 0; i < 2; i++) memset(m_lpOutAudioData[i], 0, m_nBufferLength); MMRESULT mmResult; mmResult = waveOutOpen(&m_hWaveOut, (WORD)WAVE_MAPPER, &(m_GSMWavefmt.wfx), (LONG)0, (LONG)0, CALLBACK_NULL); if (mmResult != MMSYSERR_NOERROR) return false; for (int i = 0; i < 2; i++) { m_lpOutAudioHdr[i]->lpData = (LPSTR)m_lpOutAudioData[i]; m_lpOutAudioHdr[i]->dwBufferLength = m_nBufferLength; m_lpOutAudioHdr[i]->dwFlags = 0; m_lpOutAudioHdr[i]->dwLoops = 0; waveOutPrepareHeader(m_hWaveOut, m_lpOutAudioHdr[i], sizeof(WAVEHDR)); } m_bIsWaveOutUsed = true; return true;}
开发者ID:nickwu1220,项目名称:PCRemote,代码行数:26,
示例12: initAudioDevicesvoid initAudioDevices(SIPX_INSTANCE_DATA& pInst){#if defined(_WIN32) WAVEOUTCAPS outcaps; WAVEINCAPS incaps; int numDevices; MMRESULT result; numDevices = waveInGetNumDevs(); for (int i = 0; i < numDevices && i < MAX_AUDIO_DEVICES; i++) { result = waveInGetDevCaps(i, &incaps, sizeof(WAVEINCAPS)); assert(result == MMSYSERR_NOERROR); pInst.inputAudioDevices[i] = SAFE_STRDUP(incaps.szPname); } pInst.nInputAudioDevices = numDevices; numDevices = waveOutGetNumDevs(); for (int i = 0; i < numDevices && i < MAX_AUDIO_DEVICES; i++) { result = waveOutGetDevCaps(i, &outcaps, sizeof(WAVEOUTCAPS)); assert(result == MMSYSERR_NOERROR); pInst.outputAudioDevices[i] = SAFE_STRDUP(outcaps.szPname) ; } pInst.nOutputAudioDevices = numDevices;#else pInst.inputAudioDevices[0] = SAFE_STRDUP("Default"); pInst.outputAudioDevices[0] = SAFE_STRDUP("Default");#endif}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:31,
示例13: MMS_Audio_Initvoid MMS_Audio_Init(){ MMRESULT status; LPWAVEOUTCAPS lpCaps; if( waveOutGetNumDevs() < 1 ) { fprintf(stderr,"Audio disabled - No Multimedia Services compatible audio devices available/n"); return; } /* Figure out device capabilities - Just use device 0 for now */ if((lpCaps = (LPWAVEOUTCAPS)mmeAllocMem(sizeof(WAVEOUTCAPS))) == NULL ) { fprintf(stderr,"Failed to allocate WAVEOUTCAPS struct/n"); return; } status = waveOutGetDevCaps( 0, lpCaps, sizeof(WAVEOUTCAPS)); if( status != MMSYSERR_NOERROR ) { fprintf(stderr,"waveOutGetDevCaps failed - status = %d/n", status); } mmeFreeMem(lpCaps);}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:26,
示例14: mmio_listdevs/* list the audio and MIDI device names */void mmio_listdevs(void){ UINT wRtn, ndevices; unsigned int i; ndevices = waveInGetNumDevs(); for (i = 0; i < ndevices; i++) { WAVEINCAPS wicap; wRtn = waveInGetDevCaps(i, (LPWAVEINCAPS) &wicap, sizeof(wicap)); if (wRtn) nt_waveinerror("waveInGetDevCaps: %s/n", wRtn); else fprintf(stderr, "audio input device #%d: %s/n", i+1, wicap.szPname); } ndevices = waveOutGetNumDevs(); for (i = 0; i < ndevices; i++) { WAVEOUTCAPS wocap; wRtn = waveOutGetDevCaps(i, (LPWAVEOUTCAPS) &wocap, sizeof(wocap)); if (wRtn) nt_waveouterror("waveOutGetDevCaps: %s/n", wRtn); else fprintf(stderr, "audio output device #%d: %s/n", i+1, wocap.szPname); }}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:28,
示例15: DirectSoundEnumerateW/*************************************************************************** * DirectSoundEnumerateW [DSOUND.3] * * Enumerate all DirectSound drivers installed in the system * * PARAMS * lpDSEnumCallback [I] Address of callback function. * lpContext [I] Address of user defined context passed to callback function. * * RETURNS * Success: DS_OK * Failure: DSERR_INVALIDPARAM */HRESULT WINAPI DirectSoundEnumerateW( LPDSENUMCALLBACKW lpDSEnumCallback, LPVOID lpContext ){ unsigned devs, wod; DSDRIVERDESC desc; GUID guid; int err; WCHAR wDesc[MAXPNAMELEN]; WCHAR wName[MAXPNAMELEN]; TRACE("lpDSEnumCallback = %p, lpContext = %p/n", lpDSEnumCallback, lpContext); if (lpDSEnumCallback == NULL) { WARN("invalid parameter: lpDSEnumCallback == NULL/n"); return DSERR_INVALIDPARAM; } setup_dsound_options(); devs = waveOutGetNumDevs(); if (devs > 0) { if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) { static const WCHAR empty[] = { 0 }; for (wod = 0; wod < devs; ++wod) { if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) { err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(NULL,/"%s/",/"%s/",%p)/n", "Primary Sound Driver",desc.szDrvname,lpContext); MultiByteToWideChar( CP_ACP, 0, "Primary Sound Driver", -1, wDesc, sizeof(wDesc)/sizeof(WCHAR) ); if (lpDSEnumCallback(NULL, wDesc, empty, lpContext) == FALSE) return DS_OK; } } } } } for (wod = 0; wod < devs; ++wod) { err = mmErr(waveOutMessage(UlongToHandle(wod),DRV_QUERYDSOUNDDESC,(DWORD_PTR)&desc,ds_hw_accel)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(%s,/"%s/",/"%s/",%p)/n", debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDesc, sizeof(wDesc)/sizeof(WCHAR) ); wDesc[(sizeof(wDesc)/sizeof(WCHAR)) - 1] = '/0'; MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wName, sizeof(wName)/sizeof(WCHAR) ); wName[(sizeof(wName)/sizeof(WCHAR)) - 1] = '/0'; if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE) return DS_OK; } } return DS_OK;}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:73,
示例16: load_soundsvoid load_sounds (){ short i,t; HRSRC h; char snd_name[20]; WAVEOUTCAPS wavecaps; MMRESULT err; t = (short)waveOutGetNumDevs(); if (t == 0) { sounds_messed = TRUE; return; } err = waveOutGetDevCaps(0,&wavecaps,sizeof(WAVEOUTCAPS)); if (err != MMSYSERR_NOERROR) { sounds_messed = TRUE; switch (err) { case MMSYSERR_BADDEVICEID: MessageBox(mainPtr,"Cannot initialize sounds - No sound device detected. Game can still be played, but quietly.", "Sound Error",MB_OK | MB_ICONEXCLAMATION); return; case MMSYSERR_NODRIVER: MessageBox(mainPtr,"Cannot initialize sounds - No driver installed. Game can still be played, but quietly.", "Sound Error",MB_OK | MB_ICONEXCLAMATION); return; case MMSYSERR_NOMEM : MessageBox(mainPtr,"Cannot initialize sounds - can't find enough memory. Game can still be played, but quietly.", "Sound Error",MB_OK | MB_ICONEXCLAMATION); return; case MMSYSERR_ALLOCATED: MessageBox(mainPtr,"Cannot initialize sounds - sound card already allocated. Game can still be played, but quietly.", "Sound Error",MB_OK | MB_ICONEXCLAMATION); return; case MMSYSERR_ERROR: MessageBox(mainPtr,"Cannot initialize sounds - internal error. Game can still be played, but quietly.", "Sound Error",MB_OK | MB_ICONEXCLAMATION); return; default: MessageBox(mainPtr,"Cannot initialize sounds - unidentified error. Game can still be played, but quietly.", "Sound Error",MB_OK | MB_ICONEXCLAMATION); return; } } for (i = 0; i < NUM_SOUNDS; i++) { sound_handles[i] = NULL; load_when_play[i] = TRUE; if (load_when_play[i] == FALSE) { sprintf((char *)snd_name,"#%d",(int)(i + 1)); h = FindResource(store_hInstance,snd_name,"#100"); sound_handles[i] = LoadResource(store_hInstance,h); snds[i] = (char *) LockResource(sound_handles[i]); } }}
开发者ID:redsaurus,项目名称:BoA3DEditorWin,代码行数:58,
示例17: AbortCloseAndReleasetbool CDeviceWaveIO::LoadDriver(tint iIndex, tbool bEnableInput, tbool bEnableOutput){ AbortCloseAndRelease(); mbDriverPseudoLoaded = FALSE; mbInput = false; if (iIndex == -1) { tuint32 uiDev = WAVE_MAPPER; // Can only be either output or input mbInput = (bEnableInput && !bEnableOutput); if (mbInput) { WAVEINCAPS caps; MMRESULT mmres = waveInGetDevCaps(WAVE_MAPPER, &caps, sizeof(caps)); if (mmres != MMSYSERR_NOERROR) return false; miChannelsIn = caps.wChannels; } else { // We must query for default wave-out device if (!TestWaveOutCaps(&uiDev, 44100)) return FALSE; iIndex = (tint32)uiDev; } } else { if (iIndex < 0) return false; if (iIndex >= (tint32)waveOutGetNumDevs()) { // Load input device tbool bSuccess = LoadDriverInput(iIndex - waveOutGetNumDevs()); if (!bSuccess) return false; WAVEINCAPS caps; MMRESULT mmres = waveInGetDevCaps(WAVE_MAPPER, &caps, sizeof(caps)); if (mmres != MMSYSERR_NOERROR) return false; miChannelsIn = caps.wChannels; mbInput = (bEnableInput && (miChannelsIn > 0)); } } muiDevIndex = (tuint32)iIndex; mbDriverPseudoLoaded = TRUE; mbOutput = bEnableOutput; return (mbInput || mbOutput);} // LoadDriver
开发者ID:eriser,项目名称:koblo_software-1,代码行数:45,
示例18: audio_openint audio_open(struct audio_info_struct *ai){ MMRESULT res; WAVEFORMATEX outFormatex; if(ai->rate == -1) return(0); if(!waveOutGetNumDevs()) { MessageBox(NULL, "No audio devices present!", "Error...", MB_OK); return -1; } outFormatex.wFormatTag = WAVE_FORMAT_PCM; outFormatex.wBitsPerSample = 16; outFormatex.nChannels = 2; outFormatex.nSamplesPerSec = ai->rate; outFormatex.nAvgBytesPerSec = outFormatex.nSamplesPerSec * outFormatex.nChannels * outFormatex.wBitsPerSample/8; outFormatex.nBlockAlign = outFormatex.nChannels * outFormatex.wBitsPerSample/8; res = waveOutOpen(&dev, (UINT)ai->device, &outFormatex, (DWORD)wave_callback, 0, CALLBACK_FUNCTION); if(res != MMSYSERR_NOERROR) { switch(res) { case MMSYSERR_ALLOCATED: MessageBox(NULL, "Device Is Already Open", "Error...", MB_OK); break; case MMSYSERR_BADDEVICEID: MessageBox(NULL, "The Specified Device Is out of range", "Error...", MB_OK); break; case MMSYSERR_NODRIVER: MessageBox(NULL, "There is no audio driver in this system.", "Error...", MB_OK); break; case MMSYSERR_NOMEM: MessageBox(NULL, "Unable to allocate sound memory.", "Error...", MB_OK); break; case WAVERR_BADFORMAT: MessageBox(NULL, "This audio format is not supported.", "Error...", MB_OK); break; case WAVERR_SYNC: MessageBox(NULL, "The device is synchronous.", "Error...", MB_OK); break; default: MessageBox(NULL, "Unknown Media Error", "Error...", MB_OK); break; } return -1; } waveOutReset(dev); InitializeCriticalSection(&cs); return 0;}
开发者ID:Distrotech,项目名称:esound,代码行数:57,
示例19: waveOutGetNumDevsvoid CWave::InitVars( void ){ m_bLoaded = FALSE; m_lpSoundData = NULL; m_hResHandle = NULL; m_nDevices = waveOutGetNumDevs();}
开发者ID:fenglinnet,项目名称:ddongddongbae,代码行数:9,
示例20: open_outputstatic int open_output (void) { int i, j, mono, eight_bit, warnings = 0; PCMWAVEFORMAT pcm; MMRESULT res; /* Check if there is at least one audio device */ if (!waveOutGetNumDevs ()) { fprintf(stderr, "No audio devices present!"); return -1; } /* They can't mean these */ dpm.encoding &= ~(PE_ULAW|PE_BYTESWAP); if (dpm.encoding & PE_16BIT) dpm.encoding |= PE_SIGNED; else dpm.encoding &= ~PE_SIGNED; mono = (dpm.encoding & PE_MONO); eight_bit = !(dpm.encoding & PE_16BIT); pcm.wf.wFormatTag = WAVE_FORMAT_PCM; pcm.wf.nChannels = mono ? 1 : 2; pcm.wf.nSamplesPerSec = i = dpm.rate; j = 1; if (!mono) { i *= 2; j *= 2; } if (!eight_bit) { i *= 2; j *= 2; } pcm.wf.nAvgBytesPerSec = i; pcm.wf.nBlockAlign = j; pcm.wBitsPerSample = eight_bit ? 8 : 16; res = waveOutOpen (NULL, 0, (LPWAVEFORMAT)&pcm, NULL, 0, WAVE_FORMAT_QUERY); if (res) { fprintf(stderr, "Format not supported!/n"); return -1; } res = waveOutOpen (&dev, 0, (LPWAVEFORMAT)&pcm, (DWORD)wave_callback, 0, CALLBACK_FUNCTION); if (res) { fprintf(stderr, "Can't open audio device"); return -1; } nBlocks = 0; return warnings; }
开发者ID:EQ4,项目名称:rsynth,代码行数:57,
示例21: winmm_enumerate_devicesstatic intwinmm_enumerate_devices(cubeb * context, cubeb_device_type type, cubeb_device_collection ** collection){ UINT i, incount, outcount, total; cubeb_device_info * cur; outcount = waveOutGetNumDevs(); incount = waveInGetNumDevs(); total = outcount + incount; if (total > 0) { total -= 1; } *collection = malloc(sizeof(cubeb_device_collection) + sizeof(cubeb_device_info*) * total); (*collection)->count = 0; if (type & CUBEB_DEVICE_TYPE_OUTPUT) { WAVEOUTCAPSA woc; WAVEOUTCAPS2A woc2; ZeroMemory(&woc, sizeof(woc)); ZeroMemory(&woc2, sizeof(woc2)); for (i = 0; i < outcount; i++) { if ((waveOutGetDevCapsA(i, (LPWAVEOUTCAPSA)&woc2, sizeof(woc2)) == MMSYSERR_NOERROR && (cur = winmm_create_device_from_outcaps2(&woc2, i)) != NULL) || (waveOutGetDevCapsA(i, &woc, sizeof(woc)) == MMSYSERR_NOERROR && (cur = winmm_create_device_from_outcaps(&woc, i)) != NULL) ) { (*collection)->device[(*collection)->count++] = cur; } } } if (type & CUBEB_DEVICE_TYPE_INPUT) { WAVEINCAPSA wic; WAVEINCAPS2A wic2; ZeroMemory(&wic, sizeof(wic)); ZeroMemory(&wic2, sizeof(wic2)); for (i = 0; i < incount; i++) { if ((waveInGetDevCapsA(i, (LPWAVEINCAPSA)&wic2, sizeof(wic2)) == MMSYSERR_NOERROR && (cur = winmm_create_device_from_incaps2(&wic2, i)) != NULL) || (waveInGetDevCapsA(i, &wic, sizeof(wic)) == MMSYSERR_NOERROR && (cur = winmm_create_device_from_incaps(&wic, i)) != NULL) ) { (*collection)->device[(*collection)->count++] = cur; } } } return CUBEB_OK;}
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:55,
示例22: setup_soundint setup_sound(void){ if (waveOutGetNumDevs() < 1) { have_sound = 0; return 0; } have_sound = 1; sound_available = 1; return 1;}
开发者ID:bernds,项目名称:UAE,代码行数:11,
示例23: initstatic int init(struct xmp_context *ctx){ struct xmp_options *o = &ctx->o; MMRESULT res; WAVEFORMATEX wfe; int i; char *token, **parm; num_buffers = 10; parm_init(); chkparm1("buffers", num_buffers = strtoul(token, NULL, 0)); parm_end(); if (num_buffers > MAXBUFFERS) num_buffers = MAXBUFFERS; if (!waveOutGetNumDevs()) return XMP_ERR_DINIT; wfe.wFormatTag = WAVE_FORMAT_PCM; wfe.wBitsPerSample = o->resol; wfe.nChannels = o->flags & XMP_FMT_MONO ? 1 : 2; wfe.nSamplesPerSec = o->freq; wfe.nAvgBytesPerSec = wfe.nSamplesPerSec * wfe.nChannels * wfe.wBitsPerSample / 8; wfe.nBlockAlign = wfe.nChannels * wfe.wBitsPerSample / 8; res = waveOutOpen(&hwaveout, WAVE_MAPPER, &wfe, (DWORD) wave_callback, 0, CALLBACK_FUNCTION); if (res != MMSYSERR_NOERROR) { show_error(res); return XMP_ERR_DINIT; } waveOutReset(hwaveout); for (i = 0; i < num_buffers; i++) { buffer[i] = malloc(OUT_MAXLEN); header[i].lpData = buffer[i]; if (!buffer[i] || res != MMSYSERR_NOERROR) { show_error(res); return XMP_ERR_DINIT; } } freebuffer = nextbuffer = 0; return xmp_smix_on(ctx);}
开发者ID:44kksharma,项目名称:AndEngineMODPlayerExtension,代码行数:52,
示例24: WaveOutInit/*------------------------------------------------------------------------------*/static void WaveOutInit( void ){ MMRESULT mmRes; WaveOutNum = waveOutGetNumDevs(); if ( WaveOutNum >= WAVEOUTMAX ){ WaveOutNum = WAVEOUTMAX-1; } for ( int i=0; i<WaveOutNum; i++ ){ mmRes = waveOutGetDevCaps( i, &WaveOutCaps[i], sizeof(WAVEOUTCAPS) ); if ( mmRes != MMSYSERR_NOERROR ){ WaveOutCaps[i].wChannels = 0; } } mmRes = waveOutGetDevCaps( WAVE_MAPPER, &WaveOutCaps[WAVEOUTMAX-1], sizeof(WAVEOUTCAPS) ); if ( mmRes != MMSYSERR_NOERROR ){ WaveOutCaps[WAVEOUTMAX-1].wChannels = 0; }}
开发者ID:p2world,项目名称:remotelite,代码行数:14,
示例25: queryAudioDevicesvoid queryAudioDevices(){ unsigned int count = waveOutGetNumDevs(); printf("%d wave output devices available./n", count); for(unsigned int i=0; i<count; i++){ WAVEOUTCAPS caps; if(MMSYSERR_NOERROR == waveOutGetDevCaps(i, &caps, sizeof(WAVEOUTCAPS))){ printf("%d. %s/n", i, caps.szPname); }else{ printf("%d. Error retrieving caps./n", i); } }}
开发者ID:Kopakc,项目名称:NoiseCraft,代码行数:13,
示例26: initializebool OutputWaveOut::initialize(){#ifdef WIN32 if (!waveOutGetNumDevs ()) { qWarning("OutputWaveOut: no audio device found"); return FALSE; } return TRUE;#else return FALSE;#endif}
开发者ID:TodorGrin,项目名称:boox-opensource,代码行数:13,
示例27: show_waveout_devicesstatic std::string show_waveout_devices( std::ostream & /*log*/ ) { std::ostringstream devices; devices << " waveout:" << std::endl; for ( UINT i = 0; i < waveOutGetNumDevs(); ++i ) { devices << " " << i << ": "; WAVEOUTCAPSW caps; ZeroMemory( &caps, sizeof( caps ) ); waveOutGetDevCapsW( i, &caps, sizeof( caps ) ); devices << wstring_to_utf8( caps.szPname ); devices << std::endl; } return devices.str();}
开发者ID:Kinglions,项目名称:modizer,代码行数:13,
示例28: Q_UNUSEDbool OutputWaveOut::initialize(quint32 freq, ChannelMap map, Qmmp::AudioFormat format){ Q_UNUSED(format); if (!waveOutGetNumDevs ()) { qWarning("OutputWaveOut: no audio device found"); return false; } WAVEFORMATEX fmt; UINT deviceID = WAVE_MAPPER; fmt.wFormatTag = WAVE_FORMAT_PCM; fmt.wBitsPerSample = 16; fmt.nChannels = map.count(); fmt.nSamplesPerSec = (unsigned long)(freq); fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample/8; fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nChannels * fmt.wBitsPerSample/8; switch (waveOutOpen (&dev, deviceID, &fmt, (DWORD)wave_callback, 0, CALLBACK_FUNCTION)) { case MMSYSERR_ALLOCATED: qWarning("OutputWaveOut: Device is already open."); return false; case MMSYSERR_BADDEVICEID: qWarning("OutputWaveOut: The specified device is out of range."); return false; case MMSYSERR_NODRIVER: qWarning("OutputWaveOut: There is no audio driver in this system."); return false; case MMSYSERR_NOMEM: qWarning("OutputWaveOut: Unable to allocate sound memory."); return false; case WAVERR_BADFORMAT: qWarning("OutputWaveOut: This audio format is not supported."); return false; case WAVERR_SYNC: qWarning("OutputWaveOut: The device is synchronous."); return false; default: qWarning("OutputWaveOut: Unknown media error."); return false; case MMSYSERR_NOERROR: break; } waveOutReset (dev); InitializeCriticalSection (&cs); configure(freq, map, Qmmp::PCM_S16LE); return true;}
开发者ID:Greedysky,项目名称:qmmp,代码行数:51,
示例29: main/*----------------------------------------------------------------------| main+---------------------------------------------------------------------*/intmain(int argc, char** argv){ bool no_pcm = false; if (argc >= 2 && !strcmp(argv[1], "--no-pcm")) no_pcm = true; printf("------- Win32 Soundcard Probe ------ built " __DATE__ "/n"); unsigned int num_devs = waveOutGetNumDevs(); printf("Found %d devices/n", num_devs); for (unsigned int i=0; i<num_devs; i++) { ProbeDevice(i, no_pcm); }}
开发者ID:MattLeMay,项目名称:Bluetune,代码行数:17,
注:本文中的waveOutGetNumDevs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ waveOutOpen函数代码示例 C++ waveOutGetDevCaps函数代码示例 |