Hi to all,
in my application (an audio editor) I have a callback that emit a signal when a sound stop playing so:
Qt Code:
  1. //! Executed when a sound finish playing
  2. FMOD_RESULT F_CALLBACK endCallback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type,
  3. unsigned int commanddata1, unsigned int commanddata2)
  4. {
  5. (void)commanddata1; // Unused (to avoid warnings)
  6. (void)commanddata2; // Unused (to avoid warnings)
  7.  
  8. SoundData* currentSound;
  9.  
  10. switch(type)
  11. {
  12. case FMOD_CHANNEL_CALLBACKTYPE_END:
  13. {
  14. FMOD_RESULT result;
  15. FMOD::Channel *currentChannel = (FMOD::Channel *)channel;
  16.  
  17. void *ud = NULL;
  18. result = currentChannel->getUserData( &ud );
  19.  
  20. /* inform that sound stopped */
  21. emit AudioDevice::getInstance()->soundStopped();
  22. break;
  23. }
  24. default:
  25. break;
  26. }
  27.  
  28. return FMOD_OK;
  29. }
To copy to clipboard, switch view to plain text mode 
in the application I have 2 WaveWidgets ( waveform display ) having a slot connected to the signal emitted from the callback so:
Qt Code:
  1. /************************************************************************/
  2. /* Constructor */
  3. /************************************************************************/
  4. WaveWidget::WaveWidget( QWidget* parent /* = 0 */ )
  5. : QWidget( parent ),
  6. m_wave( 0 ),
  7. rb( 0 ),
  8. m_CurrentTimePosition( 0 )
  9. {
  10. setFocusPolicy( Qt::TabFocus );
  11. timer = new QTimer();
  12.  
  13. connect( timer, SIGNAL( timeout() ), this, SLOT( setCurrentTimePosition() ) );
  14. connect( AudioDevice::getInstance(), SIGNAL( soundStopped() ), this, SLOT( stopTimer() ), Qt::QueuedConnection );
  15. }
To copy to clipboard, switch view to plain text mode 

The stopTimer slot of the WaveWidget reset the timeLine to position 0 so:
Qt Code:
  1. /************************************************************************/
  2. /* stopTimer */
  3. /************************************************************************/
  4. void WaveWidget::stopTimer()
  5. {
  6. timer->stop();
  7. qDebug() << "Timer stopped";
  8. resetTimeline();
  9. }
To copy to clipboard, switch view to plain text mode 
and
Qt Code:
  1. /************************************************************************/
  2. /* resetTimeline */
  3. /************************************************************************/
  4. void WaveWidget::resetTimeline()
  5. {
  6. int h = height();
  7. QRect r = QRect( 0 , 0, m_CurrentTimePosition + 1, h );
  8. // reset timeline
  9. update( r );
  10. // reset current value
  11. m_CurrentTimePosition = 0;
  12. // delete rubberband if one
  13. if( rb )
  14. {
  15. delete rb;
  16. rb = 0;
  17. }
  18. }
To copy to clipboard, switch view to plain text mode 
The problem is that when 1 of the 2 playing sounds stop playing ALL WaveWidget are informed of that and ALL reset their timeLine to 0 instead of only the right WaveWidget that efectively has its sound stopped.
How can I solve this problem?

I hope to get help.
Best Regards,
Franco