本文整理汇总了C++中LPDIRECTSOUND::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTSOUND::Release方法的具体用法?C++ LPDIRECTSOUND::Release怎么用?C++ LPDIRECTSOUND::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTSOUND
的用法示例。
在下文中一共展示了LPDIRECTSOUND::Release方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dsound_kill
void sound_direct_sound::dsound_kill()
{
// release the object
if (m_dsound)
m_dsound->Release();
m_dsound = nullptr;
}
示例2: ds_Release
//-----------------------------------------------------------------------------
// Освобождение Direct Sound объекта
// на входе : direct - указатель на Direct Sound объект
// на выходе : *
//-----------------------------------------------------------------------------
void ds_Release(LPDIRECTSOUND direct)
{
// удаление объекта воспроизведения
if (direct)
direct->Release();
// Освобождение COM
CoUninitialize();
}
示例3: Release
ULONG STDMETHODCALLTYPE DirectSound::Release()
{
ULONG result = m_ds->Release();
if (!result)
{
delete this;
}
return result;
}
示例4: Game_Shutdown
int Game_Shutdown(void *parms)
{
// this function is where you shutdown your game and
// release all resources that you allocated
// release the directsoundobject
if (lpds!=NULL)
lpds->Release();
// return success
return(1);
} // end Game_Shutdown
示例5: DeleteDirectSoundResources
bool DeleteDirectSoundResources()
{
if(lpDS)
{
lpDS->Release();
lpDS = NULL;
return true;
}
// Just incase something should go wrong.
MessageBox(NULL, "Sound buffer freed without having been acquired.", "DirectSound Error", MB_OK | MB_ICONEXCLAMATION);
return false;
}
示例6:
// DirectSound-Objekte freigeben
int QuitDSound(void)
{
if(lpDS!= NULL)
lpDS->Release();
for (int i=0; i<ANZ_SOUNDS; i++)
{
if(SoundArray[i]!= NULL)
SoundArray[i]->Release();
}
return 0;
}
示例7: DSUtil_InitDirectSound
//-----------------------------------------------------------------------------
// Name: DSUtil_InitDirectSound()
// Desc:
//-----------------------------------------------------------------------------
HRESULT DSUtil_InitDirectSound( HWND hWnd )
{
if( FAILED( DirectSoundCreate( NULL, &g_pDS, NULL ) ) )
return E_FAIL;
if( FAILED( g_pDS->SetCooperativeLevel( hWnd, DSSCL_NORMAL ) ) )
{
g_pDS->Release();
g_pDS = NULL;
return E_FAIL;
}
return S_OK;
}
示例8: DS_Shutdown
//===========================================================================
// DS_Shutdown
//===========================================================================
void DS_Shutdown(void)
{
if(!initOk) return;
if(eaxListener) eaxListener->Release();
if(dsListener) dsListener->Release();
if(primary) primary->Release();
if(dsound) dsound->Release();
eaxListener = NULL;
dsListener = NULL;
primary = NULL;
dsound = NULL;
initOk = false;
}
示例9: SNDDMA_Shutdown
/*
==================
SNDDMA_Shutdown
==================
*/
void SNDDMA_Shutdown( void ) {
Com_DPrintf( "Shutting down sound system\n" );
if ( pDS ) {
Com_DPrintf( "Destroying DS buffers\n" );
if ( pDS )
{
Com_DPrintf( "...setting NORMAL coop level\n" );
// FIXME JA was DSSCL_NORMAL and Q3 says DSSCL_PRIORITY but the printf says setting normal
pDS->SetCooperativeLevel( g_wv.hWnd, DSSCL_PRIORITY );
}
if ( pDSBuf )
{
Com_DPrintf( "...stopping and releasing sound buffer\n" );
pDSBuf->Stop( );
pDSBuf->Release( );
}
// only release primary buffer if it's not also the mixing buffer we just released
if ( pDSPBuf && ( pDSBuf != pDSPBuf ) )
{
Com_DPrintf( "...releasing primary buffer\n" );
pDSPBuf->Release( );
}
pDSBuf = NULL;
pDSPBuf = NULL;
dma.buffer = NULL;
Com_DPrintf( "...releasing DS object\n" );
pDS->Release( );
}
if ( hInstDS ) {
Com_DPrintf( "...freeing DSOUND.DLL\n" );
FreeLibrary( hInstDS );
hInstDS = NULL;
}
pDS = NULL;
pDSBuf = NULL;
pDSPBuf = NULL;
dsound_init = qfalse;
memset ((void *)&dma, 0, sizeof (dma));
CoUninitialize( );
}
示例10: SNDDMA_Shutdown
void SNDDMA_Shutdown() {
common->DPrintf( "Shutting down sound system\n" );
if ( pDS ) {
if ( pDSBuf ) {
common->DPrintf( "...stopping and releasing sound buffer\n" );
pDSBuf->Stop();
pDSBuf->Release();
}
common->DPrintf( "...releasing DS object\n" );
pDS->Release();
}
pDS = NULL;
pDSBuf = NULL;
dsound_init = false;
Com_Memset( ( void* )&dma, 0, sizeof ( dma ) );
CoUninitialize();
}
示例11: DSShutdown
int DSShutdown(void)
{
// first turn all sounds off
StopAllSounds();
// now release all sound buffers
for (int index = 0; index < MAX_SOUNDS; index++)
if (sound_fx[index].dsbuffer) {
sound_fx[index].dsbuffer->Release();
}
// now release the directsound interface itself
if (lpDS) {
lpDS->Release();
lpDS = NULL;
}
// return success
return(1);
}
示例12: DSUtil_FreeDirectSound
//-----------------------------------------------------------------------------
// Name: DSUtil_FreeDirectSound()
// Desc:
//-----------------------------------------------------------------------------
VOID DSUtil_FreeDirectSound()
{
if( g_pDS )
g_pDS->Release();
g_pDS = NULL;
}
示例13: Create
//.........这里部分代码省略.........
MMRESULT nTimer = timeSetEvent(125, 5, &TimerFunction, (DWORD)this,
TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
if(nTimer == NULL)
{
CCD->ReportError("[WARNING] StreamingAudio: Timer callback set-up failed", false);
return RGF_FAILURE; // Timer startup failed.
}
m_nTimerID = nTimer; // Save timer ID
return RGF_SUCCESS;
}
mp3 = false;
if(stricmp((szFileName+len), ".ogg") == 0)
{
if(Ogg != NULL)
return RGF_FAILURE;
Ogg = new OggAudio(m_pDS);
Ogg->Load(szFileName);
ogg = true;
m_fActive = true;
return RGF_SUCCESS;
}
ogg = false;
// start a timer for this stream.
MMRESULT nTimer = timeSetEvent(125, 5, &TimerFunction, (DWORD)this,
TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
if(nTimer == NULL)
{
CCD->ReportError("[WARNING] StreamingAudio: Timer callback set-up failed", false);
return RGF_FAILURE; // Timer startup failed.
}
m_nTimerID = nTimer; // Save timer ID
// end change RF064
// Check for stream availability
if(m_pStream != NULL)
return RGF_FAILURE; // Already loaded!
// Open up the WAVE file.
nError = WaveOpen(szFileName, &m_hWaveFile, &m_pWaveFormat, &m_rRiffData);
if(nError != RGF_SUCCESS)
{
char szBug[128];
sprintf(szBug, "[WARNING] File %s - Line %d: Failed to open wave file '%s'\n(Note: streamig audio can't be placed in VFS)",
__FILE__, __LINE__, szFileName);
CCD->ReportError(szBug, false);
return RGF_FAILURE; // Problem here, too!
}
// Get current position in file, which will be the start of the
// ..WAVE data.
m_nDataPosition = mmioSeek(m_hWaveFile, 0, SEEK_CUR);
m_nDataSize = m_rRiffData.cksize; // Save data size
// Fetch DirectSound interface we want
LPDIRECTSOUND pDSIF;
nError = m_pDS->QueryInterface(IID_IDirectSound, (LPVOID *)&pDSIF);
// Create a DSound buffer to stream into
DSBUFFERDESC theDesc;
memset(&theDesc, 0, sizeof(DSBUFFERDESC));
theDesc.dwSize = sizeof(DSBUFFERDESC);
theDesc.dwBufferBytes = kBufferSize;
theDesc.lpwfxFormat = m_pWaveFormat;
theDesc.dwFlags = DSBCAPS_CTRLVOLUME;
nError = pDSIF->CreateSoundBuffer(&theDesc, &m_pStream, NULL);
pDSIF->Release(); // Done w/ this.
if(nError != 0) // Error! Sick out.
{
char szBug[128];
sprintf(szBug, "StreamingAudio: Failed to create buffer for '%s'\n", szFileName);
OutputDebugString(szBug);
mmioClose(m_hWaveFile, 0);
m_hWaveFile = NULL;
delete m_pWaveFormat;
m_pWaveFormat = NULL;
return RGF_FAILURE;
}
m_nOffset = 0; // Start at top of buffer
// changed RF064
//m_fActive = true; // Set as active
// end change RF064
PumpWave(kBufferSize); // Initial buffer load
return RGF_SUCCESS;
}