本文整理汇总了C++中Timer::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::Create方法的具体用法?C++ Timer::Create怎么用?C++ Timer::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::Create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Play
// Play
void AudioStream::Play (long volume, int looping)
{
if (m_pdsb) {
// If playing, stop
if (m_fPlaying) {
if ( m_bIsPaused == FALSE)
Stop_and_Rewind();
}
// Cue for playback if necessary
if (!m_fCued) {
Cue ();
}
if ( looping )
m_bLooping = 1;
else
m_bLooping = 0;
// Begin DirectSound playback
HRESULT hr = m_pdsb->Play (0, 0, DSBPLAY_LOOPING);
if (hr == DS_OK) {
m_nTimeStarted = timer_get_milliseconds();
Set_Volume(volume);
// Kick off timer to service buffer
m_timer.constructor();
m_timer.Create (m_nBufService, m_nBufService, DWORD (this), TimerCallback);
// Playback begun, no longer cued
m_fPlaying = TRUE;
m_bIsPaused = FALSE;
}
else {
// If the buffer was lost, try to restore it
if ( hr == DSERR_BUFFERLOST ) {
hr = m_pdsb->Restore();
if ( hr == DS_OK ) {
hr = m_pdsb->Play (0, 0, DSBPLAY_LOOPING);
}
else {
nprintf(("Sound", "Sound => Lost a buffer, tried restoring but got %s\n", get_DSERR_text(hr) ));
Int3(); // get Alan, he wants to see this
}
}
if ( hr != DS_OK ) {
nprintf(("Sound", "Sound => Play failed with return value %s\n", get_DSERR_text(hr) ));
}
}
}
}