×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    28

    Symbian NokiaCPP Sound Exemple

    I'm working on the Sound exemple of Symbian 6.0 NokiaCPP Nokia Exemples, and I'd like to play a sound file not by initialising an CMdaAudioPlayerUtility with the name of the file, but by a sound buffer that I had created before. My idea was to call the constructor: NewDesPlayerReadOnlyL(*(pDesClipLocation->iDes), *this), where pDesClipLocation is a pointer on a TMdaDesClipLocation, initilalized with my buffer...here is the code source:

    //in the Playeradapter.h
    TPtr8 aData;
    TMdaDesClipLocation* pDesClipLocation;


    //in the Playeradapter.cpp

    TUint length(32000);
    TUint8 *audioData = new TUint8[length];
    ...

    CPlayerAdapter::CPlayerAdapter(CSoundAppUi& aAppUi):iState(ENotReady),iAppUi(aAppUi), aData(audioData,length)
    {
    }

    ...
    void CPlayerAdapter::ConstructL(const TDesC& aFileName)
    {



    // Create an audio player utility instance for playing sample data from a file
    // causes MMdaAudioPlayerCallback::MapcInitComplete to be called
    //iMdaAudioPlayerUtility = CMdaAudioPlayerUtility::NewFilePlayerL(aFileName, *this);

    InitData(); //Initialise un tableau de sinusoide
    iMdaAudioPlayerUtility = CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(*(pDesClipLocation->iDes), *this);
    __TEST_INVARIANT;
    }

    ...
    void CPlayerAdapter::InitData(/*const TDesC& aFileName*/){


    const double PI = 3.141529;
    TRequestStatus status;
    TReal sinResult;
    TInt error;
    TReal x, a, b, c;



    for(TUint i=0; i<length; i++){

    a = 2*PI;
    b = a*i;
    x = (TReal) ((b*1000)/16000);
    error = Math::Sin(sinResult, x);
    if(error == KErrNone){
    audioData[i] = (TUint8)(127*sinResult);
    }
    else
    return;

    }
    pDesClipLocation = new TMdaDesClipLocation(aData);


    }


    You guessed that it doesn't work...so is there any one to help me...?

    THANK YOU

    Djazia

    PS: if there is french people who can help me i can re-explain the problem in french...

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    271

    RE: Symbian NokiaCPP Sound Exemple

    Hi,

    In this case, you should use the audio streaming API. Please read SDK's Help about audio stream API reference and you can download audio stream example application for reference from the link below:

    http://www.forum.nokia.com/symbianforum/main/1,35452,1_32_15,00.html#examples

    Regards,
    FN Developer Support

Posting Permissions

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