Hi to all,
I would put in a separate thread the code to encode in an mp3 file some audio datas.

Qt Code:
  1. #include <QThread>
  2.  
  3. class WaveEncoder : public QThread
  4. {
  5. public:
  6. WaveEncoder( QString& sndName, QString& outputDir, bool bg, SoundData*, WaveDisplay*, QObject* parent = 0 );
  7. ~WaveEncoder();
  8.  
  9. protected:
  10. void run();
  11.  
  12. private:
  13. int EncodeToMp3();
  14. void ProcessTitle( QString&, QString& );
  15. bool LoadBgSound();
  16.  
  17. SoundData* m_wave;
  18. WaveDisplay* m_WaveDisplay;
  19.  
  20. QString m_SoundName;
  21. QString m_OutputDir;
  22.  
  23. /* for the background audio */
  24. signed short* inbuffer;
  25. FMOD::Sound* bgSound;
  26. unsigned int bgBytes; // length in Bytes
  27. unsigned int bgSamples; // length in PCM
  28. /* to call sound::lock() */
  29. void* ptr1;
  30. void* ptr2;
  31. unsigned int len1;
  32. unsigned int len2;
  33.  
  34. bool m_bgAudio;
  35. };
  36.  
  37. #endif //__WAVEENCODER_H__
To copy to clipboard, switch view to plain text mode 

the ctor
Qt Code:
  1. WaveEncoder::WaveEncoder( QString& sndName,
  2. QString& outputDir,
  3. bool bg,
  4. SoundData* sndData,
  5. WaveDisplay* waveDisp,
  6. QObject* parent )
  7. : QThread(parent)
  8. {
  9. m_SoundName = sndName;
  10. m_OutputDir = outputDir;
  11. m_wave = sndData;
  12. m_WaveDisplay = waveDisp;
  13. }
To copy to clipboard, switch view to plain text mode 

and the run method

Qt Code:
  1. void WaveEncoder::run()
  2. {
  3. EncodeToMp3();
  4. }
To copy to clipboard, switch view to plain text mode 

Here is where I create and run the thread:

Qt Code:
  1. void WaveWidget::cutSound()
  2. {
  3. WaveEncoder encoder(m_SoundName, m_outputDir, false, m_wave, m_WaveDisplay);
  4. encoder.start();
  5. }
To copy to clipboard, switch view to plain text mode 

I get this error:
ASSERT failure in QThread::setTerminationEnabled(): Current thread was not started with QThread....
What does mean? And how can I solve this error?

Regards,
Franco