×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    5

    Unhappy How to play midi and wav at the same time? (in s60 3th SDK)

    I am developing mobile game on symbian s60.
    I want to play midi as back-music, and play wav sound as game effect.
    I have try class CMdaAudioPlayerUtility,CMidiClientUtility,CMdaAudioOutputStream, but all of them can't play midi and wav at the same time, Just can play one kind of them.

    I have searched the forum and google,but no solution.
    Is anybody know how to do it?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: How to play midi and wav at the same time? (in s60 3th SDK)

    What have you tried exactly, and what has happened (result codes in MXy callbacks, etc.)?

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    5

    Question Re: How to play midi and wav at the same time? (in s60 3th SDK)

    Itry to play wav by CMdaAudioOutputStream like this.
    This code is copy from S60 Platform: Sound Mixer Example.

    Code:
    CMdaAudioOutputStream* iStream = NULL;
    iStream = CMdaAudioOutputStream::NewL( *this );
    iStream->Open( &iSet );
    ...play buffer...
    In this way can play the wav sound successfully, But after called "iStream->Open( &iSet )" the midi play with no sound (no error display).

    I play midi in two ways.

    1:
    Code:
    CMidiClientUtility* m_pMidi = NULL;
    m_pMidi = CMidiClientUtility::NewL(*this);
    m_pMidi->OpenFile(fullName2);
    m_pMidi->Play();
    2:
    Code:
    CMdaAudioPlayerUtility * m_piAudioPlayer = NULL;
    m_piAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(fullName2, *this);
    
    //In callback MapcInitComplete
    void ZengGameSound::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
    {
            if (aError == KErrNone)
    	{
    		m_piAudioPlayer->SetVolume(m_piAudioPlayer->MaxVolume() / 3);
    		m_piAudioPlayer->Play();
    	}
    }
    The 2th way (CMdaAudioPlayerUtility) can play wav and midi file, but can't play both at the same time. When playing the midi,the wav sound play in silent, and in "void MapcPlayComplete(TInt aError)" aError = -14

    /**
    System wide error code -14 : a requested resource is already in exclusive use.

    A system wide error code indicates an error in the environment, or in
    user input from which a program may recover.
    */
    const TInt KErrInUse=(-14);
    Last edited by zenghuashan; 2009-06-26 at 18:38.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: How to play midi and wav at the same time? (in s60 3th SDK)

    You can experiment with explicit TMdaPriorityPreference settings, 'None' or 'Time' may enable mixing.

  5. #5
    Registered User
    Join Date
    May 2006
    Location
    Germany
    Posts
    598

    Re: How to play midi and wav at the same time? (in s60 3th SDK)

    Did you succeed in the end? I will be looking at doing the same thing sooner or later.

Similar Threads

  1. midi and wav at the same time on the 6600
    By Stengun in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-11-25, 13:02
  2. Midi and Wav?
    By hiflyer in forum Audio
    Replies: 0
    Last Post: 2004-02-04, 08:07
  3. Audio Converter in Java (AMR, WAV, MIDI,...)
    By ankames in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2004-01-25, 19:30
  4. trouble playing MIDI and WAV concurrently
    By dkainer in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2003-12-10, 02:03
  5. two issues in s60 MIDP SDK when using MMAPI
    By leting in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2003-06-22, 17:26

Posting Permissions

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