×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    10

    unexpected behaivior with sound

    Hey,

    for demontration purpose, I wrote an little App (thanks to newlc.com for the sound1 example) for playing 3 files (ogg, mp3, wav).

    Followring codes works as espected

    Code:
    void CSoundAppUi::HandleCommandL(TInt aCommand)
        {
        switch ( aCommand )
            {
            case EAknSoftkeyBack:
            case EEikCmdExit:
                {
                Exit();
                break;
                }
    
            case ESound1CmdAppOpenOgg:
                {
    			if (iSoundPlayer)
    				{
    				iSoundPlayer->Stop();
    				delete iSoundPlayer;
    				}
    			iSoundPlayer=CSoundPlayer::NewL(_L("E:\\System\\Apps\\Sound1\\live_session.ogg"));
    			break;
                }
            case ESound1CmdAppOpenMp3:
                {
    			if (iSoundPlayer)
    				{
    				iSoundPlayer->Stop();
    				delete iSoundPlayer;
    				}
    			iSoundPlayer=CSoundPlayer::NewL(_L("E:\\System\\Apps\\Sound1\\BornBad.mp3"));
    			break;
                }
    
            case ESound1CmdAppOpenWav:
                {
    			if (iSoundPlayer)
    				{
    				iSoundPlayer->Stop();
    				delete iSoundPlayer;
    				} 
    			iSoundPlayer=CSoundPlayer::NewL(_L("E:\\System\\Apps\\Sound1\\Play.wav"));
                break;
                }
    
            case ESound1CmdAppPlay:
    	       {
                if (iSoundPlayer)
    				iSoundPlayer->Play();
    			break;
                }
    
            case ESound1CmdAppStop:
                {
                if (iSoundPlayer)
                    iSoundPlayer->Stop();
                break;
                }
    
            default:
                break;      
            }
        }

    But I want the app to play the selected file immediatly by using this code

    Code:
    void CSoundAppUi::HandleCommandL(TInt aCommand)
        {
        switch ( aCommand )
            {
            case EAknSoftkeyBack:
            case EEikCmdExit:
                {
                Exit();
                break;
                }
    
            case ESound1CmdAppOpenOgg:
                {
    			if (iSoundPlayer)
    				{
    				iSoundPlayer->Stop();
    				delete iSoundPlayer;
    				}
    			iSoundPlayer=CSoundPlayer::NewL(_L("E:\\System\\Apps\\Sound1\\live_session.ogg"));
    			iSoundPlayer->Play();
    			break;
                }
            case ESound1CmdAppOpenMp3:
                {
    			if (iSoundPlayer)
    				{
    				iSoundPlayer->Stop();
    				delete iSoundPlayer;
    				}
    			iSoundPlayer=CSoundPlayer::NewL(_L("E:\\System\\Apps\\Sound1\\BornBad.mp3"));
    			iSoundPlayer->Play();
    			break;
                }
    
            case ESound1CmdAppOpenWav:
                {
    			if (iSoundPlayer)
    				{
    				iSoundPlayer->Stop();
    				delete iSoundPlayer;
    				} 
    			iSoundPlayer=CSoundPlayer::NewL(_L("E:\\System\\Apps\\Sound1\\Play.wav"));
    			iSoundPlayer->Play();
                break;
                }
    
            case ESound1CmdAppStop:
                {
                if (iSoundPlayer)
                    iSoundPlayer->Stop();
                break;
                }
    
            default:
                break;      
            }
        }
    nothing happens. The files wont be played. Why?

    I'm an absolute beginner - please be patient with me!

    Manuel

  2. #2
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    153
    Hi,

    Paste the CSoundPlayer class implementation to find what actually u r implementing in tat class.

    BR,

Posting Permissions

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