本文整理汇总了C++中Sound::CloseRtAudioStream方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::CloseRtAudioStream方法的具体用法?C++ Sound::CloseRtAudioStream怎么用?C++ Sound::CloseRtAudioStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sound
的用法示例。
在下文中一共展示了Sound::CloseRtAudioStream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: swap
void swap(Sound& first, Sound& second) {
second.mLoops.store(first.mLoops.exchange(second.mLoops.load())); // swap the atomic loop counts
// store the state of the sound's rtaudio stream
bool firstSetUp = first.mRtAudioSetup;
bool secondSetUp = second.mRtAudioSetup;
// ensure both sound's rtaudio streams are closed
first.CloseRtAudioStream();
second.CloseRtAudioStream();
std::swap(first.mSampleRate, second.mSampleRate);
std::swap(first.mBufferFrames, second.mBufferFrames);
std::swap(first.mNumChannels, second.mNumChannels);
std::swap(first.mSamplePosition, second.mSamplePosition);
std::swap(first.mSampleDataPtr, second.mSampleDataPtr);
std::swap(first.mSoundBuffer, second.mSoundBuffer);
if (secondSetUp) { // if the second sound's rtaudio stream was initialised...
first.OpenRtAudioStream(first.mNumChannels); // initialise the first sound's rtaudio stream
}
if (firstSetUp) {
second.OpenRtAudioStream(second.mNumChannels);
}
}