Yes
July 31st, 2008, 03:47 AM
I'm making an ncmpc clone for fun, and I'm having some trouble with toggling pause/play. It's supposed to run in an infinite loop, and when the user presses 'p' it checks if it's paused or playing and do the opposite with the mpd_sendPauseCommand method. It knows when 'p' is pressed, and it knows what state MPD is currently in (paused/playing), but it doesn't play/pause it. When I put mpd_sendPauseCommand in the beginning of the loop by itself it works.
Here's what I think the relevant code is:
if (key == 'p') {
if (status->state == MPD_STATUS_STATE_PLAY) {
mvprintw (7, 1, "playing");
refresh ();
mpd_sendPauseCommand (conn, 1);
}
else {
mvprintw (8, 1, "paused");
refresh ();
mpd_sendPauseCommand (conn, 0);
}
}
I've looked around at the source code for some other clients, and it doesn't seem like they do anything different from what I'm doing. Can anyone help?
Thanks!
Here's what I think the relevant code is:
if (key == 'p') {
if (status->state == MPD_STATUS_STATE_PLAY) {
mvprintw (7, 1, "playing");
refresh ();
mpd_sendPauseCommand (conn, 1);
}
else {
mvprintw (8, 1, "paused");
refresh ();
mpd_sendPauseCommand (conn, 0);
}
}
I've looked around at the source code for some other clients, and it doesn't seem like they do anything different from what I'm doing. Can anyone help?
Thanks!