×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    8

    QMediaPlayer latency issue

    Hi there.

    I am playing sound effects in a game I'm developing using QMediaPlayer. I'm using the LowLatency flag, but on the device (I'm developing on an N8) there's a noticeable hitch every time a sample is played, I'm guessing while it loads and buffers the audio. It doesn't look like QMediaPlayer supports banked sounds or playing from resources, so I don't know if there's much I can do there. Does anyone have any suggestions for what I'm doing wrong? Should I be calling play() from a separate thread? Should I give up and use Phonon? The play code's pretty simple, basically just:

    Code:
    QMediaPlayer* pPlayer = new QMediaPlayer( 0, QMediaPlayer::LowLatency );
    pPlayer->setMedia( QUrl::fromLocalFile( fullPath ) );
    pPlayer->setVolume( volume );
    pPlayer->play();
    Thanks for the help,
    Marcel

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: QMediaPlayer latency issue

    Hi

    I think you have to connect to status signal and play the sound after you'll get status == buffered
    Symbian & Qt developer. http://vladest.org

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    8

    Re: QMediaPlayer latency issue

    Good idea - that seems like a better way than immediately playing. Unfortunately even after doing that I still have the same behaviour. It actually seems like the hitch is actually occurring at the end of the sample. The other thing is, I'm playing a song in the background in .mp3 format (also using QMediaPlayer). I set the volume of the background music to 5% to help me track down the sound effect issue, and I've noticed that when the hitch happens the volume of the background music jumps up to the SFX's level. Of course it could be just that I'm losing my mind...

    I am creating a new player each time a sound is played, which seems wrong to me but I'm not sure what the best practices are for using QMediaPlayer. The paradigm I'm used to for audio is more along the lines of "play sound buffer X using voice Y".

  4. #4
    Nokia Developer Expert
    Join Date
    Sep 2009
    Posts
    1

    Re: QMediaPlayer latency issue

    Was there any resolution to this issue? I have the same very basic use case - I want to play an mp3 in the background and sound samples over the top. What I find it the audio in the sampe stutters and the volume of the mp3 goes up and down. I'm also running a simple QML animation and drops frames all over the place when playing the sample.

  5. #5
    Registered User
    Join Date
    Oct 2010
    Posts
    8

    Re: QMediaPlayer latency issue

    Unfortunately no. From what I understand, for audio QMediaPlayer is fine for playing a single mp3 or simple button sounds, but can't actually play more than one sound at a time (!) Neither, apparently, can Phonon. I've had to put aside the project that needed this functionality for the moment, but when I left off I was looking into GStreamer, which is more of a full-featured audio system which lets you mix, create sub-busses, apply effects, etc.

Similar Threads

  1. Sound latency
    By iu2 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2010-03-14, 06:50
  2. TCP latency
    By amit_mairantz in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2008-09-17, 10:46
  3. Latency
    By testN95_ in forum [Archived] Flash Lite on Nokia Devices
    Replies: 11
    Last Post: 2008-06-08, 09:15

Posting Permissions

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