Hi,

I am developing an application with sound effects and I want to use the QSoundEffect class as it is intended. However, the "native" sound effects of Ubuntu at, say, "/usr/share/sounds/freedesktop/" have oga format. Is there a way to play them with QSoundEffect? When I set the source of a QSoundEffect instance to one of these files the app prints

Qt Code:
  1. QSoundEffect(pulseaudio): Error decoding source
To copy to clipboard, switch view to plain text mode 

Also,
Qt Code:
  1. qDebug() << QSoundEffect::supportedMimeTypes();
To copy to clipboard, switch view to plain text mode 
outputs

Qt Code:
  1. ("audio/x-wav", "audio/vnd.wave")
To copy to clipboard, switch view to plain text mode 

A less important question. Is the way I am using the QSoundEffect class a proper way (see the code below)?
Qt Code:
  1. class MyClass : public QDialog{
  2. public:
  3. MyClass(){
  4. sound_effects_["ok"] = new QSoundEffect(this);
  5. sound_effects_["ok"]->setSource(QUrl::fromLocalFile("/usr/share/sounds/freedesktop/some-file.oga")));
  6.  
  7. sound_effects_["error"] = new QSoundEffect(this);
  8. sound_effects_["error"]->setSource(QUrl::fromLocalFile("/usr/share/sounds/freedesktop/other-file.oga")));
  9.  
  10. // ...
  11.  
  12.  
  13. connect(this, &MyClass::PlaySound, this, &MyClass::Play);
  14. //....
  15. }
  16.  
  17. void SomeFunctionInBackgroundThread(){
  18. //
  19. if(success)
  20. emit PlaySound("ok");
  21. else
  22. emit PlaySound("error");
  23. }
  24.  
  25. singals:
  26. void PlaySound(const QString & name);
  27.  
  28. private slots:
  29. void Play(const QString & name){
  30. sound_effects_[name]->play();
  31. }
  32.  
  33. private:
  34. QMap<QString, QSoundEffect *> sound_effects_;
  35.  
  36. };
To copy to clipboard, switch view to plain text mode