Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Patch to save and restore last position

Alexey
2009-02-21
2013-04-25
  • Alexey
    Alexey
    2009-02-21

    Hi,

    I've made a little patch for saving and restoring the last played position - a crucial feature for listening to audio books. Currently the patch works fine on my N93 (S60v3MMF) at least with internal codecs. Phone codecs fail to restore with error code -4. Does somebody know why?

    Regards

    Alexey

    Index: inc/OggPlay.h

    RCS file: /cvsroot/symbianoggplay/symbianoggplay/inc/OggPlay.h,v
    retrieving revision 1.94
    diff -u -r1.94 OggPlay.h
    --- inc/OggPlay.h    27 Mar 2008 14:21:26 -0000    1.94
    +++ inc/OggPlay.h    12 Feb 2009 19:20:27 -0000
    @@ -522,7 +522,7 @@
         RArray<TInt> iViewHistoryStack;
         RArray<TInt> iRestoreStack;
         TInt iRestoreCurrent;
    -
    +    TInt64 iPosition;
         TBool iForeground;

         COggStartUpAO* iStartUpAO;
    Index: src/OggPlay.cpp
    ===================================================================
    RCS file: /cvsroot/symbianoggplay/symbianoggplay/src/OggPlay.cpp,v
    retrieving revision 1.145
    diff -u -r1.145 OggPlay.cpp
    --- src/OggPlay.cpp    27 Mar 2008 14:21:27 -0000    1.145
    +++ src/OggPlay.cpp    21 Feb 2009 17:41:08 -0000
    @@ -758,11 +758,12 @@
                 iAppView->SelectItem(iRestoreStack[i]);
                 HandleCommandL(EOggPlay);
                 }
    -
    +        // Restore last played
             iAppView->SelectItem(iRestoreCurrent);
    -
             // Start playing
             NextSong();
    +        //Restore saved position
    +        iOggPlayback->SetPosition(iPosition);
             }

         // Restart display updates
    @@ -1413,6 +1414,9 @@

    void COggPlayAppUi::Stop()
         {
    +    //Save current position
    +    iPosition = iOggPlayback->Position();
    +
         iOggPlayback->Stop();
         UpdateSoftkeys();

    @@ -1983,6 +1987,7 @@
    #endif

         iSettings.iAutoplay = IniRead32L(aIniFileData, 0, 1) ? ETrue : EFalse;
    +    iPosition = IniRead64L(aIniFileData, 0, KMaxTInt);
         /* iSettings.iManeuvringSpeed = */ IniRead32L(aIniFileData, 0, 0);
          
         TInt numHotKeys = IniRead32L(aIniFileData, 0, (TInt) TOggplaySettings::ENumHotkeys);
    @@ -2311,6 +2316,9 @@

         iniFileBuf.AppendNum(iSettings.iAutoplay ? 1 : 0);
         iniFileBuf.Append(KIniValueTerminator);
    +   
    +    iniFileBuf.AppendNum(iPosition);
    +    iniFileBuf.Append(KIniValueTerminator);

         iniFileBuf.AppendNum(iSettings.iManeuvringSpeed);
         iniFileBuf.Append(KIniValueTerminator);