Ticket #783: musicpause.patch

File musicpause.patch, 2.8 KB (added by eskil <myth@…>, 18 years ago)

patch to fix pausing

  • mythplugins/mythmusic/mythmusic/playbackbox.cpp

     
    4848    progress = NULL;
    4949   
    5050    lcd_volume_visible = false;
    51     isplaying = false;
     51    state = IDLE;
    5252    tree_is_done = false;
    5353    first_playlist_check = true;
    5454    outputBufferSize = 256;
     
    295295        }
    296296        else if (action == "PAUSE")
    297297        {
    298             if (isplaying)
     298            if (isPlaying() || isPaused())
    299299            {
    300300                if (pause_button)
    301301                    pause_button->push();
     
    10361050
    10371051void PlaybackBoxMusic::play()
    10381052{
    1039     if (isplaying)
     1053    if (isPlaying())
    10401054        stop();
    10411055
    10421056    if (curMeta)
     
    11071121
    11081122        decoder->start();
    11091123
    1110         isplaying = true;
     1124        state = PLAYING;
    11111125        curMeta->setLastPlay();
    11121126        curMeta->incPlayCount();   
    11131127    }
     
    11151129
    11161130void PlaybackBoxMusic::visEnable()
    11171131{
    1118     if (!visualizer_status != 2 && isplaying)
     1132    if (!visualizer_status != 2 && isPlaying())
    11191133    {
    11201134        setUpdatesEnabled(false);
    11211135        mainvisual->setGeometry(0, 0, screenwidth, screenheight);
     
    11991213{
    12001214    if (output)
    12011215    {
    1202         isplaying = !isplaying;
    1203         output->Pause(!isplaying); //Note pause doesn't take effet instantly
     1216        if (isPlaying())
     1217            state = PAUSED;
     1218        else if (isPaused())
     1219            state = PLAYING;
     1220
     1221        output->Pause(isPaused()); //Note pause doesn't take effet instantly
    12041222    }
    12051223    // wake up threads
    12061224    if (decoder)
     
    12621280    if (info_text)
    12631281        info_text->SetText("");
    12641282
    1265     isplaying = false;
     1283    state = IDLE;
    12661284}
    12671285
    12681286void PlaybackBoxMusic::stopAll()
     
    13261344{
    13271345    stopDecoder();
    13281346
    1329     isplaying = false;
     1347    state = IDLE;
    13301348
    13311349    if (repeatmode == REPEAT_TRACK)
    13321350        play();
     
    14271445        music_tree_list->setVisualOrdering(1);
    14281446    music_tree_list->refresh();
    14291447   
    1430     if (isplaying)
     1448    if (isPlaying())
    14311449        setTrackOnLCD(curMeta);
    14321450}
    14331451
  • mythplugins/mythmusic/mythmusic/playbackbox.h

     
    142142    unsigned int shufflemode;
    143143    unsigned int repeatmode;
    144144
    145     bool isplaying;
     145    typedef enum State {
     146        IDLE,
     147        PLAYING,
     148        PAUSED
     149        };
     150    State state;
     151
     152    bool isPlaying(void) { return state == PLAYING; }
     153    bool isPaused(void) { return state == PAUSED; }
     154
    146155    bool lcd_volume_visible;
    147156
    148157    bool menufilters;