Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Topics

Recent Status Updates

View All Updates

Photo
- - - - -

Synchronyzing Mp3 Tracks On Qt

Qt phonon mobility synchronization c++ mp3

  • Please log in to reply
3 replies to this topic

#1 Uncannytable

Uncannytable

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts
  • Programming Language:C, Java, C++, PHP, Fortran, Prolog
  • Learning:C, Java, C++, PHP, Python, PL/SQL, Prolog

Posted 26 June 2012 - 11:40 AM

I'm developing a simple program with Qt that plays some songs, in each song for each instrument I have a mp3 track and the user has the ability to change the sound volume of each track separably so he can listen to the tracks he wants. The major problem I'm facing is that of synchronization. Especially if I'm running the program off of a CD or Pen-drive, I've had some ideas but they didn't work well.

Right now I'm using phonon but wouldn't mind changing to Mobility if necessary (only if really necessary). What strategy really works in this case? Why is it worst on CD or Pen-drive? Since I'm interested in mostly running from these sources how could I improve synchronization on these devices?
  • 0

#2 kernelcoder

kernelcoder

    CC Devotee

  • Expert Member
  • PipPipPipPipPipPip
  • 990 posts
  • Location:Dhaka
  • Programming Language:C, Java, C++, C#, Visual Basic .NET
  • Learning:Objective-C, PHP, Python, Delphi/Object Pascal

Posted 26 June 2012 - 05:37 PM

So you are creating instance of Phonon:MediaObject for each mp3 tracks in a song? I mean, as example, if you have 3 mp3 tracks for 3 instruments in a song, you are creating 3 instances of Phonon:MediaObject for playing 3 different tracks? I think you are doing this and that's why the synchronization term is here, right? Now how you are trying to do the synchronization? Or, you are not doing at all to keep the tracks synchronized?

As far as I know, Mobility will not run on PC?
  • 0

#3 Uncannytable

Uncannytable

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts
  • Programming Language:C, Java, C++, PHP, Fortran, Prolog
  • Learning:C, Java, C++, PHP, Python, PL/SQL, Prolog

Posted 29 June 2012 - 10:14 AM

That's right, I'm creating one instance of Phonon::MediaObject for each track, to keep it synchronized I'm using the signal tick to check synchronization for each tick of the first track, if is off 100 miliseconds above or below the program resynchronizes all mp3 tracks, but it is ineficient. What I'm wandering is if there is a better way. I prefer Phonon because I've done all the coding already with it, but if other API is the only solution I'll have to change. Could you recommend other strategy or other API?
  • 0

#4 kernelcoder

kernelcoder

    CC Devotee

  • Expert Member
  • PipPipPipPipPipPip
  • 990 posts
  • Location:Dhaka
  • Programming Language:C, Java, C++, C#, Visual Basic .NET
  • Learning:Objective-C, PHP, Python, Delphi/Object Pascal

Posted 29 June 2012 - 08:53 PM

My suggestion is to keep the tickInterval as minimum as possible though it is said that the Phonon backend will try to use the actual tickInterval as close to as you. And handle the tick signal to synchronize them. So yes, what you are doing seems perfect to me so far. I'm not sure how to guide you from this but what I can ask is that can you provide the code so that I can take a look into it and perhaps then I can think of other ways to do in the code.

Another thing is that can you merge your tracks into one media and only feed that one to Phonon. In that case the Phonon will handle all the media automatically. Read the 'Audio' section from the Phonon Overview Page. I'm saying this because of a line there in the page -- "If a source contains multiple media formats, this is also handled automatically."
  • 0





Also tagged with one or more of these keywords: Qt, phonon, mobility, synchronization, c++, mp3

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download