mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Don't wait indefinitely for WaveOut to close, and also fixed a stop-related bug.
This commit is contained in:
parent
76445b658f
commit
916823000c
@ -150,7 +150,7 @@ void WaveOut::StartWaveOutThread() {
|
||||
void WaveOut::StopWaveOutThread() {
|
||||
if (this->threadHandle != NULL) {
|
||||
PostThreadMessage(this->threadId, WM_QUIT, 0, 0);
|
||||
WaitForSingleObject(this->threadHandle, INFINITE);
|
||||
WaitForSingleObject(this->threadHandle, 5000);
|
||||
this->threadHandle = NULL;
|
||||
this->threadId = 0;
|
||||
}
|
||||
|
@ -96,8 +96,6 @@ void Transport::Start(const std::string& url) {
|
||||
|
||||
void Transport::StartWithPlayer(Player* newPlayer) {
|
||||
if (newPlayer) {
|
||||
this->Stop(true); /* suppress the "Stopped" event */
|
||||
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(this->stateMutex);
|
||||
|
||||
@ -106,6 +104,7 @@ void Transport::StartWithPlayer(Player* newPlayer) {
|
||||
}
|
||||
|
||||
this->nextPlayer = NULL;
|
||||
this->Stop(true); /* suppress the "Stopped" event */
|
||||
|
||||
newPlayer->PlaybackStarted.connect(this, &Transport::OnPlaybackStarted);
|
||||
newPlayer->PlaybackAlmostEnded.connect(this, &Transport::OnPlaybackAlmostEnded);
|
||||
|
@ -90,15 +90,18 @@ void TransportWindow::Update() {
|
||||
WINDOW *c = this->GetContent();
|
||||
|
||||
bool paused = (transport.GetPlaybackState() == Transport::PlaybackPaused);
|
||||
bool stopped = (transport.GetPlaybackState() == Transport::PlaybackStopped);
|
||||
|
||||
int64 gb = COLOR_PAIR(this->focused
|
||||
? BOX_COLOR_RED_ON_BLACK
|
||||
: BOX_COLOR_GREEN_ON_BLACK);
|
||||
int64 gb = COLOR_PAIR(BOX_COLOR_GREEN_ON_BLACK);
|
||||
|
||||
if (focused) {
|
||||
gb = COLOR_PAIR(BOX_COLOR_RED_ON_BLACK);
|
||||
}
|
||||
|
||||
/* playing SONG TITLE from ALBUM NAME */
|
||||
std::string duration = "0";
|
||||
|
||||
if (transport.GetPlaybackState() == Transport::PlaybackStopped) {
|
||||
if (stopped) {
|
||||
wattron(c, gb);
|
||||
wprintw(c, "playback is stopped");
|
||||
wattroff(c, gb);
|
||||
|
Loading…
Reference in New Issue
Block a user