这篇教程C++ IDirectSound_SetCooperativeLevel函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IDirectSound_SetCooperativeLevel函数的典型用法代码示例。如果您正苦于以下问题:C++ IDirectSound_SetCooperativeLevel函数的具体用法?C++ IDirectSound_SetCooperativeLevel怎么用?C++ IDirectSound_SetCooperativeLevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IDirectSound_SetCooperativeLevel函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DSoundOpenPlaybackstatic ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName){ DSoundData *pData = NULL; LPGUID guid = NULL; HRESULT hr; if(!DSoundLoad()) return ALC_FALSE; if(!deviceName) deviceName = dsDevice; else if(strcmp(deviceName, dsDevice) != 0) { ALuint i; if(!DeviceList) { hr = pDirectSoundEnumerateA(DSoundEnumDevices, NULL); if(FAILED(hr)) AL_PRINT("Error enumerating DirectSound devices (%#x)!/n", (unsigned int)hr); } for(i = 0; i < NumDevices; i++) { if(strcmp(deviceName, DeviceList[i].name) == 0) { if(i > 0) guid = &DeviceList[i].guid; break; } } if(i == NumDevices) return ALC_FALSE; } //Initialise requested device pData = calloc(1, sizeof(DSoundData)); if(!pData) { alcSetError(device, ALC_OUT_OF_MEMORY); return ALC_FALSE; } //DirectSound Init code hr = pDirectSoundCreate(guid, &pData->lpDS, NULL); if(SUCCEEDED(hr)) hr = IDirectSound_SetCooperativeLevel(pData->lpDS, GetForegroundWindow(), DSSCL_PRIORITY); if(FAILED(hr)) { if(pData->lpDS) IDirectSound_Release(pData->lpDS); free(pData); AL_PRINT("Device init failed: 0x%08lx/n", hr); return ALC_FALSE; } device->szDeviceName = strdup(deviceName); device->ExtraData = pData; return ALC_TRUE;}
开发者ID:Genesis-3D,项目名称:Genesis-3D,代码行数:60,
示例2: gst_directsound_sink_openstatic gbooleangst_directsound_sink_open (GstAudioSink * asink){ GstDirectSoundSink *dsoundsink; HRESULT hRes; dsoundsink = GST_DIRECTSOUND_SINK (asink); /* create and initialize a DirecSound object */ if (FAILED (hRes = DirectSoundCreate (NULL, &dsoundsink->pDS, NULL))) { GST_ELEMENT_ERROR (dsoundsink, RESOURCE, OPEN_READ, ("gst_directsound_sink_open: DirectSoundCreate: %s", DXGetErrorString9 (hRes)), (NULL)); return FALSE; } if (FAILED (hRes = IDirectSound_SetCooperativeLevel (dsoundsink->pDS, GetDesktopWindow (), DSSCL_PRIORITY))) { GST_ELEMENT_ERROR (dsoundsink, RESOURCE, OPEN_READ, ("gst_directsound_sink_open: IDirectSound_SetCooperativeLevel: %s", DXGetErrorString9 (hRes)), (NULL)); return FALSE; } return TRUE;}
开发者ID:BigBrother-International,项目名称:gst-plugins-good,代码行数:26,
示例3: FreeSoundstatic voidFreeSound (void){ if (pDSBuf) { IDirectSoundBuffer_Stop (pDSBuf); IDirectSound_Release (pDSBuf); }// release primary buffer only if it's not also the mixing buffer we just released if (pDSPBuf && (pDSBuf != pDSPBuf)) { IDirectSound_Release (pDSPBuf); } if (pDS) { IDirectSound_SetCooperativeLevel (pDS, mainwindow, DSSCL_NORMAL); IDirectSound_Release (pDS); } pDS = NULL; pDSBuf = NULL; pDSPBuf = NULL; hWaveOut = 0; hData = 0; hWaveHdr = 0; lpData = NULL; lpWaveHdr = NULL;}
开发者ID:EIREXE,项目名称:Quakeforge-gcw0,代码行数:25,
示例4: m1sdr_PlayStartvoid m1sdr_PlayStart(void){ waveLogStart(); IDirectSound_SetCooperativeLevel(lpDS, GetForegroundWindow(), DSSCL_PRIORITY); IDirectSoundBuffer_SetCurrentPosition(lpSecB, 0); IDirectSoundBuffer_Play(lpSecB, 0, 0, DSBPLAY_LOOPING);}
开发者ID:dreiss,项目名称:M1-Android,代码行数:9,
示例5: DSoundOpenPlaybackstatic ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceName){ DSoundData *pData = NULL; LPGUID guid = NULL; HRESULT hr; if(!deviceName) deviceName = dsDevice; else if(strcmp(deviceName, dsDevice) != 0) { ALuint i; for(i = 0;i < NumDevices;i++) { if(strcmp(deviceName, DeviceList[i].name) == 0) { guid = &DeviceList[i].guid; break; } } if(i == NumDevices) return ALC_FALSE; } DSoundLoad(); if(ds_handle == NULL) return ALC_FALSE; //Initialise requested device pData = calloc(1, sizeof(DSoundData)); if(!pData) { alcSetError(ALC_OUT_OF_MEMORY); DSoundUnload(); return ALC_FALSE; } //DirectSound Init code hr = pDirectSoundCreate(guid, &pData->lpDS, NULL); if(SUCCEEDED(hr)) hr = IDirectSound_SetCooperativeLevel(pData->lpDS, GetForegroundWindow(), DSSCL_PRIORITY); if(FAILED(hr)) { if(pData->lpDS) IDirectSound_Release(pData->lpDS); free(pData); DSoundUnload(); return ALC_FALSE; } device->szDeviceName = strdup(deviceName); device->ExtraData = pData; return ALC_TRUE;}
开发者ID:SergeStinckwich,项目名称:openqwaq,代码行数:54,
示例6: FreeSound/* FreeSound*/voidFreeSound (void){ int i; if (pDSBuf) { IDirectSoundBuffer_Stop (pDSBuf); IDirectSound_Release (pDSBuf); }// only release primary buffer if it's not also the mixing buffer we just released if (pDSPBuf && (pDSBuf != pDSPBuf)) { IDirectSound_Release (pDSPBuf); } if (pDS) { IDirectSound_SetCooperativeLevel (pDS, mainwindow, DSSCL_NORMAL); IDirectSound_Release (pDS); } if (hWaveOut) { waveOutReset (hWaveOut); if (lpWaveHdr) { for (i = 0; i < WAV_BUFFERS; i++) waveOutUnprepareHeader (hWaveOut, lpWaveHdr + i, sizeof (WAVEHDR)); } waveOutClose (hWaveOut); if (hWaveHdr) { GlobalUnlock (hWaveHdr); GlobalFree (hWaveHdr); } if (hData) { GlobalUnlock (hData); GlobalFree (hData); } } pDS = NULL; pDSBuf = NULL; pDSPBuf = NULL; hWaveOut = 0; hData = 0; hWaveHdr = 0; lpData = NULL; lpWaveHdr = NULL; dsound_init = false; wav_init = false;}
开发者ID:luaman,项目名称:qforge-newtree,代码行数:56,
示例7: SSInitBOOL SSInit(HWND hWnd, int channels, unsigned flags){ LPDIRECTSOUNDBUFFER lpPrimaryBuffer; LPDIRECTSOUND lpDS; DSBUFFERDESC dsbd; if (SSMixer.lpds) return TRUE;// Perform Direct Sound Initialization if (DirectSoundCreate(NULL, &lpDS, NULL) != DS_OK) return FALSE; SSMixer.lpds = lpDS; if (IDirectSound_SetCooperativeLevel(lpDS, hWnd, DSSCL_NORMAL) != DS_OK) { SSDestroy(); return FALSE; }// Start Mixer memset(&dsbd, 0, sizeof(DSBUFFERDESC)); dsbd.dwSize = sizeof(DSBUFFERDESC); dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; if (IDirectSound_CreateSoundBuffer(SSMixer.lpds, &dsbd, &lpPrimaryBuffer, NULL) == DS_OK) { if (IDirectSoundBuffer_Play(lpPrimaryBuffer, 0, 0, DSBPLAY_LOOPING) != DS_OK) { IDirectSoundBuffer_Release(lpPrimaryBuffer); SSDestroy(); return FALSE; } IDirectSoundBuffer_Release(lpPrimaryBuffer); } else { SSDestroy(); return FALSE; }// Finish initializing SSMixer. SSMixer.ch_cur = 0; SSMixer.ch_list = (SSoundBuffer *)malloc(sizeof(SSoundBuffer)*channels); if (!SSMixer.ch_list) return FALSE; memset(SSMixer.ch_list, 0, sizeof(SSoundBuffer)*channels); SSMixer.ch_num = channels;// Determine Sound technology and volume caps waveOutGetVolume((HWAVEOUT)WAVE_MAPPER, (LPDWORD)&SSMixer.old_master_vol);// waveOutSetVolume((HWAVEOUT)WAVE_MAPPER, 0x40004000); return TRUE;}
开发者ID:btb,项目名称:d2x,代码行数:51,
示例8: pest_openint pest_open( HWND win ){ HMODULE lib; DIRECTSOUNDCREATE dsound_create; WAVEFORMATEX format; DSBUFFERDESC desc_primary, desc_secondary; lib = (HMODULE)LoadLibrary("dsound.dll"); if(lib==NULL) return FALSE; dsound_create = (DIRECTSOUNDCREATE)GetProcAddress(lib, "DirectSoundCreate"); if(dsound_create==NULL) return FALSE; FreeLibrary(lib); if( dsound_create( NULL, &dsound, NULL )!= DS_OK ) return FALSE; if( IDirectSound_SetCooperativeLevel( dsound, win, DSSCL_EXCLUSIVE | DSSCL_PRIORITY ) != DS_OK ) return FALSE; memset( &desc_primary, 0, sizeof(DSBUFFERDESC) ); desc_primary.dwSize = sizeof(DSBUFFERDESC); desc_primary.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_STICKYFOCUS; if(IDirectSound_CreateSoundBuffer( dsound, &desc_primary, &primary, NULL )!=DS_OK) return FALSE; memset( &format, 0, sizeof(WAVEFORMATEX) ); format.wFormatTag = WAVE_FORMAT_PCM; format.nChannels = 2; format.nSamplesPerSec = 44100; format.nAvgBytesPerSec = 44100 * 4; format.nBlockAlign = 4; format.wBitsPerSample = 16; if( IDirectSoundBuffer_SetFormat( primary, &format )!= DS_OK) return FALSE; memset( &desc_secondary, 0, sizeof(DSBUFFERDESC) ); desc_secondary.dwSize = sizeof(DSBUFFERDESC); desc_secondary.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2; desc_secondary.lpwfxFormat = &format; desc_secondary.dwBufferBytes = 2*2*BUFFER_LEN; if(IDirectSound_CreateSoundBuffer( dsound, &desc_secondary, &secondary, NULL )!=DS_OK) return FALSE; InitializeCriticalSection(&critical); return TRUE;}
开发者ID:imclab,项目名称:Open-World-Domination,代码行数:45,
示例9: DirectSoundInitint DirectSoundInit(){ HRESULT hr; HWND hWnd; LoadDsound(); hr = pDirectSoundCreate(NULL, &lpDirectSound, NULL); if( hr != DS_OK ) return 0; hWnd = GetForegroundWindow(); // establecer el nivel de cooperacion hr = IDirectSound_SetCooperativeLevel(lpDirectSound,hWnd, DSSCL_NORMAL ); if( hr != DS_OK) return 0; return 1; }
开发者ID:javisantana,项目名称:cubyshot,代码行数:18,
示例10: DSInitialize/* * DirectSoundを初期化する */BOOL DSInitialize(HWND hWnd){ HRESULT hRet; uintptr_t t; /* IDirectSoundのインスタンスを取得して初期化する */ hRet = CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectSound, (void **)&pDS); if(hRet != S_OK || pDS == NULL) return FALSE; /* COMオブジェクトを初期化する */ IDirectSound_Initialize(pDS, NULL); /* C++ IDispatchEx_GetIDsOfNames函数代码示例 C++ IDirectSound_Release函数代码示例
|