×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    35

    Using AudioPlayer

    I'm writing an application where i want to use the AudioPlayer example from here http://wiki.forum.nokia.com/index.ph...ng_audio_files

    I want to use AudioPlayer.cpp from another class, TestAudioContainer, so i need to create an instance of it in that class. The constructor for AudioPlayer is:

    CAudioPlayer* CAudioPlayer::NewL(MExamplePlayStateObserver& aObserver)
    {
    CAudioPlayer* self = CAudioPlayer::NewLC(aObserver);
    CleanupStack::Pop(self);
    return self;
    }

    the MExamplePlayStateObserver class is defined in the AudioPlayer header:

    class MExamplePlayStateObserver
    {
    public:
    virtual void StateUpdate(CMdaAudioClipUtility::TState aState, TInt aPosition, TInt aDuration)=0;
    };


    So to create and instance of AudioPlayer in TestAudioContainer, i need to supply the AudioPlayer constructor with a MExamplePlayStateObserver parameter, and i'm not sure what to put. Just all NULL or what? Also, i realise i may be way off the mark here - i'm pretty unfamiliar with C++

    cheers

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,165

    Re: Using AudioPlayer

    you do need to implment the MExamplePlayStateObserver. Thus derive the TestAudioContainer class from MExamplePlayStateObserver and implement the functions defined in the MExamplePlayStateObserver, and then use TestAudioContainer as MExamplePlayStateObserver.

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    35

    Re: Using AudioPlayer

    Hi, so i did what you said and had TestAudioContainer inherit MExamplePlayStateObserver. I implemented the MExamplePlayStateObserver function as follows:

    void CTestAudioContainer::StateUpdate(CMdaAudioClipUtility::TState aState, TInt aPosition, TInt aDuration)
    {

    }

    I left the body empty as 1) I figured just to play a file i might be able to leave it empty, and 2) i'm not sure what i'd put in it anyhow.

    In TestAudioContainer, i implemented the following function:

    void CTestAudioContainer::PlaySong()
    {
    iAudioPlayer = CAudioPlayer::NewL(*this);
    _LIT(KMyAudioFile, "c:\\Data\\Sounds\\Digital\\hello.mp3");
    iAudioPlayer->PlayL(KMyAudioFile);
    }

    Which i run from a handled event in TestAudioContainer:

    TBool CTestAudioContainerView::HandlePlay_FileMenuItemSelectedL( TInt aCommand )
    {
    // TODO: implement selected event handler
    iTestAudioContainer->PlaySong();
    return ETrue;
    }



    Now i get the following build error:

    Errors caused tool to abort.
    make[1]: *** [\Symbian\9.2\S60_3rd_FP1\EPOC32\RELEASE\WINSCW\UDEB\TestAudio.exe] Error 1
    make: *** [TARGETTESTAUDIO] Error 2
    make -j 4 -s -C \Symbian\Carbide\workspace\TestAudio\group -f "ICONS_AIF_SCALABLE_DC.MK" TO_ROOT=..\..\..\..\.. EPOCBLD=..\..\..\..\..\Symbian\9.2\S60_3rd_FP1\EPOC32\BUILD\Symbian\Carbide\workspace\TestAudio\group\ICONS_AIF_SCALABLE_DC\WINSCW TO_BLDINF=..\..\..\..\..\Symbian\Carbide\workspace\TestAudio\group PLATFORM=WINSCW CFG=UDEB BLD
    make -j 4 -s -r -f "\Symbian\9.2\S60_3rd_FP1\EPOC32\BUILD\Symbian\Carbide\workspace\TestAudio\group\TESTAUDIO\WINSCW\TESTAUDIO.WINSCW" UDEB
    TestAudioContainer.cpp
    ..\src\TestAudioContainer.cpp:227: warning: variable / argument 'aState' is not used in function
    ..\src\TestAudioContainer.cpp:227: warning: variable / argument 'aPosition' is not used in function
    ..\src\TestAudioContainer.cpp:227: warning: variable / argument 'aDuration' is not used in function
    mwldsym2.exe: Undefined symbol: 'class CMdaAudioRecorderUtility * CMdaAudioRecorderUtility::NewL(class MMdaObjectStateChangeObserver &, class CMdaServer *, int, enum TMdaPriorityPreference) (?NewL@CMdaAudioRecorderUtility@@SAPAV1@AAVMMdaObjectStateChangeObserver@@PAVCMdaServer@@HW4TMdaPriorityPreference@@@Z)'
    mwldsym2.exe: referenced from 'void CAudioPlayer::PlayL(class TDesC16 const &) (?PlayL@CAudioPlayer@@QAEXABVTDesC16@@@Z)' in AudioPlayer.cpp:91

    What do i need to do to create a working instance of CMdaAudioRecorderUtility?

    cheers

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Using AudioPlayer

    it shows linker error you might want to add mediaclientaudio.lib in your project,

Similar Threads

  1. Replies: 6
    Last Post: 2009-11-19, 18:14
  2. About AudioPlayer
    By BeirBear in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2009-08-10, 02:26
  3. AudioPlayer example
    By julienpfe in forum Symbian
    Replies: 1
    Last Post: 2007-03-06, 22:26
  4. MMAPI problem on 6680
    By danielnilsson in forum Mobile Java Media (Graphics & Sounds)
    Replies: 11
    Last Post: 2007-02-01, 08:15
  5. Sound problem
    By Joerg_Teichmann in forum Symbian
    Replies: 1
    Last Post: 2003-09-15, 05:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×