本文整理汇总了C++中IDirectSoundBuffer8::Stop方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectSoundBuffer8::Stop方法的具体用法?C++ IDirectSoundBuffer8::Stop怎么用?C++ IDirectSoundBuffer8::Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectSoundBuffer8
的用法示例。
在下文中一共展示了IDirectSoundBuffer8::Stop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Close
void Close()
{
// Stop Thread
fprintf(stderr," * SPU2: Waiting for DSound thread to finish...");
dsound_running=false;
WaitForSingleObject(thread,INFINITE);
CloseHandle(thread);
fprintf(stderr," Done.\n");
//
// Clean up
//
if( buffer != NULL )
{
buffer->Stop();
for(u32 i=0;i<numBuffers;i++)
{
if( buffer_events[i] != NULL )
CloseHandle(buffer_events[i]);
buffer_events[i] = NULL;
}
SAFE_RELEASE( buffer_notify );
SAFE_RELEASE( buffer );
}
SAFE_RELEASE( dsound );
}
示例2:
void VDAudioOutputDirectSoundW32::StopPlayback() {
if (mbDSBufferPlaying) {
if (mpDSBuffer)
mpDSBuffer->Stop();
mbDSBufferPlaying = false;
}
}
示例3: if
void SoundLibrary3dDirectSound::DisableDspFX( int _channel )
{
int errCode;
AppDebugAssert(GetNumFilters(_channel) > 0);
DirectSoundChannel *channel;
if (_channel == m_musicChannelId) channel = m_musicChannel;
else channel = &m_channels[_channel];
IDirectSoundBuffer8 *buffer = (IDirectSoundBuffer8 *) channel->m_bufferInterface;
//
// Stop the channel
errCode = buffer->Stop();
SOUNDASSERT( errCode, "Direct sound couldn't stop a secondary buffer" );
//
// Shut down the filters
int numDxFilters = 0;
for (int i = 0; i < NUM_FILTERS; ++i)
{
SoundLibFilter *filter = &channel->m_dspFX[i];
if (filter->m_userFilter != NULL)
{
delete filter->m_userFilter;
filter->m_userFilter = NULL;
}
else if (filter->m_dxFilter)
{
numDxFilters++;
}
filter->m_dxFilter = false;
}
if (numDxFilters > 0)
{
errCode = buffer->SetFX( 0, NULL, NULL );
SOUNDASSERT( errCode, "Direct sound couldn't set fx" );
}
//
// Restart the channel
errCode = buffer->Play( 0, 0, DSBPLAY_LOOPING );
SOUNDASSERT( errCode, "Direct sound couldn't play a secondary buffer" );
}
示例4:
SoundLibrary3dDirectSound::~SoundLibrary3dDirectSound()
{
int errCode;
//
// Release secondary buffers
if( m_channels )
{
for( int i = 0; i < m_numChannels; ++i )
{
IDirectSoundBuffer8 *buffer = (IDirectSoundBuffer8 *) m_channels[i].m_bufferInterface;
if( buffer )
{
errCode = buffer->Stop();
SOUNDASSERT( errCode, "DirectSound failed to stop secondary buffer" );
// errCode = buffer->SetFX(0, NULL, NULL);
// SOUNDASSERT( errCode, "DirectSound failed to remove FX from secondary buffer" );
errCode = buffer->Release();
SOUNDASSERT( errCode, "DirectSound failed to release secondary buffer" );
}
}
delete m_channels;
}
//
// Release music channel
if( m_musicChannel )
{
IDirectSoundBuffer8 *buffer = (IDirectSoundBuffer8 *)m_musicChannel->m_bufferInterface;
if( buffer )
{
errCode = buffer->Stop();
SOUNDASSERT( errCode, "DirectSound failed to shutdown secondary buffer" );
errCode = buffer->Release();
SOUNDASSERT( errCode, "DirectSound failed to shutdown secondary buffer" );
}
}
//
// Release primary buffer
if( m_directSound->m_primaryBuffer )
{
errCode = m_directSound->m_primaryBuffer->Stop();
SOUNDASSERT( errCode, "DirectSound failed to shutdown primary buffer" );
errCode = m_directSound->m_primaryBuffer->Release();
SOUNDASSERT( errCode, "DirectSound failed to shutdown primary buffer" );
}
//
// Release Direct Sound Device
if( m_directSound->m_device )
{
errCode = m_directSound->m_device->Release();
SOUNDASSERT( errCode, "DirectSound failed to shutdown device" );
}
delete m_directSound;
}
示例5: AppReleaseAssert
void SoundLibrary3dDirectSound::EnableDspFX(int _channel, int _numFilters, int const *_filterTypes)
{
AppReleaseAssert( _numFilters > 0, "Bad argument passed to EnableFilters" );
AppDebugAssert(_channel >= 0 && _channel < m_numChannels);
DirectSoundChannel *channel;
if (_channel == m_musicChannelId) channel = m_musicChannel;
else channel = &m_channels[_channel];
int errCode;
IDirectSoundBuffer8 *buffer = (IDirectSoundBuffer8 *) channel->m_bufferInterface;
if (GetNumFilters(_channel) > 0)
{
DisableDspFX(_channel);
}
//
// Prepare the sound descriptions
DSEFFECTDESC desc[DSP_DSOUND_WAVESREVERB];
int numDSoundFilters = 0;
for( int i = 0; i < _numFilters; ++i )
{
if (_filterTypes[i] <= DSP_DSOUND_WAVESREVERB)
{
ZeroMemory( &desc[numDSoundFilters], sizeof(DSEFFECTDESC) );
desc[numDSoundFilters].dwSize = sizeof( DSEFFECTDESC );
desc[numDSoundFilters].dwFlags = DSFX_LOCSOFTWARE;
desc[numDSoundFilters].guidDSFXClass = *s_dxDescriptors[ _filterTypes[i] ].m_sfxClass;
AppDebugAssert(
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_CHORUS ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_COMPRESSOR ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_DISTORTION ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_ECHO ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_FLANGER ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_GARGLE ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_I3DL2REVERB ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_STANDARD_PARAMEQ ||
desc[numDSoundFilters].guidDSFXClass == GUID_DSFX_WAVES_REVERB
);
++numDSoundFilters;
}
}
unsigned long results[NUM_FILTERS];
if (numDSoundFilters > 0)
{
//
// Stop the channel
errCode = buffer->Stop();
SOUNDASSERT( errCode, "Direct sound couldn't stop a secondary buffer from playing" );
//
// Set up the filters
errCode = buffer->SetFX( numDSoundFilters, desc, results );
SOUNDASSERT( errCode, "Direct sound couldn't set fx" );
//
// Restart the channel
errCode = buffer->Play( 0, 0, DSBPLAY_LOOPING );
SOUNDASSERT( errCode, "Direct sound couldn't play a secondary buffer" );
}
for( int i = 0; i < _numFilters; ++i )
{
AppDebugAssert(_filterTypes[i] >= 0);
if (_filterTypes[i] <= DSP_DSOUND_WAVESREVERB)
{
AppReleaseAssert( results[i] == DSFXR_LOCSOFTWARE, "DirectSound couldn't enable filter" );
channel->m_dspFX[i].m_dxFilter = true;
}
switch (_filterTypes[i])
{
case DSP_RESONANTLOWPASS:
channel->m_dspFX[_filterTypes[i]].m_userFilter = new DspResLowPass(m_sampleRate);
break;
case DSP_BITCRUSHER:
channel->m_dspFX[_filterTypes[i]].m_userFilter = new DspBitCrusher(m_sampleRate);
break;
case DSP_GARGLE:
channel->m_dspFX[_filterTypes[i]].m_userFilter = new DspGargle(m_sampleRate);
break;
case DSP_ECHO:
channel->m_dspFX[_filterTypes[i]].m_userFilter = new DspEcho(m_sampleRate);
break;
case DSP_SIMPLE_REVERB:
channel->m_dspFX[_filterTypes[i]].m_userFilter = new DspReverb(m_sampleRate);
break;
//.........这里部分代码省略.........