diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index bfd762d75..007e082ef 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -151,9 +151,12 @@ void Player::ThreadLoop() { this->output->Stop(); /* flush all buffers */ this->output->Resume(); /* start it back up */ - while (this->lockedBuffers.size() > 0) { + { boost::mutex::scoped_lock lock(this->mutex); - writeToOutputCondition.wait(this->mutex); + + while (this->lockedBuffers.size() > 0) { + writeToOutputCondition.wait(this->mutex); + } } this->stream->SetPosition(this->setPosition); @@ -267,21 +270,25 @@ bool Player::Exited() { void Player::OnBufferProcessed(IBuffer *buffer) { bool started = false; - + bool found = false; { boost::mutex::scoped_lock lock(this->mutex); /* removes the specified buffer from the list of locked buffers, and also lets the stream know it can be recycled. */ BufferList::iterator it = this->lockedBuffers.begin(); - for ( ; it != this->lockedBuffers.end(); ++it) { + while (it != this->lockedBuffers.end() && !found) { if (it->get() == buffer) { + found = true; + if (this->stream) { this->stream->OnBufferProcessedByPlayer(*it); } - this->lockedBuffers.erase(it); + it = this->lockedBuffers.erase(it); + /* this sets the current time in the stream. it does this by grabbing + the time at the next buffer in the queue */ if (!this->lockedBuffers.empty()) { this->currentPosition = this->lockedBuffers.front()->Position(); } @@ -290,8 +297,9 @@ void Player::OnBufferProcessed(IBuffer *buffer) { accepting new samples. now that a buffer has been processed, we can try to enqueue another sample. the thread loop blocks on this condition */ this->writeToOutputCondition.notify_all(); - - it = this->lockedBuffers.end(); /* bail out of the loop */ + } + else { + ++it; } } diff --git a/src/musikbox/app/window/CommandWindow.cpp b/src/musikbox/app/window/CommandWindow.cpp index 1e8dc001f..567a33e29 100755 --- a/src/musikbox/app/window/CommandWindow.cpp +++ b/src/musikbox/app/window/CommandWindow.cpp @@ -137,23 +137,24 @@ void CommandWindow::Help() { int64 s = -1; this->output->WriteLine("help:\n", s); this->output->WriteLine(" to switch between windows", s); - this->output->WriteLine(" console view", s); - this->output->WriteLine(" library view", s); - this->output->WriteLine("\n", s); + this->output->WriteLine(" ALT+Q console view", s); + this->output->WriteLine(" ALT+W library view", s); + this->output->WriteLine("", s); this->output->WriteLine(" addir : add a music directory", s); this->output->WriteLine(" rmdir : remove a music directory", s); this->output->WriteLine(" lsdirs: list scanned directories", s); this->output->WriteLine(" rescan: rescan paths for new metadata", s); - this->output->WriteLine("\n", s); + this->output->WriteLine("", s); this->output->WriteLine(" play : play audio at ", s); this->output->WriteLine(" pause: pause/resume", s); this->output->WriteLine(" stop: stop and clean up everything", s); this->output->WriteLine(" volume: <0 - 100>: set % volume", s); this->output->WriteLine(" clear: clear the log window", s); this->output->WriteLine(" seek : seek to into track", s); - this->output->WriteLine("\n", s); + this->output->WriteLine("", s); this->output->WriteLine(" plugins: list loaded plugins", s); - this->output->WriteLine("\n : quit\n", s); + this->output->WriteLine("", s); + this->output->WriteLine(" : quit\n", s); } bool CommandWindow::ProcessCommand(const std::string& cmd) {