More state management fixes in CoreAudioOut.cpp -- it no longer glitches when pausing/resuming/stopping using the CrossfadeTransport.

This commit is contained in:
Casey Langen 2016-12-24 13:03:11 -08:00
parent 0184f1c8e8
commit 8ea81ae9a8

View File

@ -159,6 +159,8 @@ bool CoreAudioOut::Play(IBuffer *buffer, IBufferProvider *provider) {
std::cerr << "AudioQueueStart failed: " << result << "\n";
return false;
}
this->Resume();
}
AudioQueueBufferRef audioQueueBuffer = nullptr;
@ -220,8 +222,9 @@ void CoreAudioOut::Resume() {
if (this->audioQueue) {
AudioQueueStart(this->audioQueue, nullptr);
this->state = StatePlaying;
}
this->state = StatePlaying;
}
void CoreAudioOut::SetVolume(double volume) {
@ -255,7 +258,7 @@ void CoreAudioOut::Stop() {
boost::recursive_mutex::scoped_lock lock(this->mutex);
queue = this->audioQueue;
this->audioQueue = nullptr;
this->state = STateStopped;
this->state = StateStopped;
}
if (queue) {