Hey. I'm still kind of a newbie with this stuff. I got fmod to work with dev c++ just fine, but i'm having trouble with Qt. I just need to be able to play a .wav file and i'll be good to go. Here is the code i'm using so far. It runs fine but makes a beeping sound instead of the sound I want it to play.

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. #include "QPainter.h"
  4. #include "inc/fmod.h"
  5. #include "inc/fmod_dsp.h"
  6. #include "inc/fmod_errors.h"
  7.  
  8.  
  9.  
  10. MainWindow::MainWindow(QWidget *parent) :
  11. QMainWindow(parent),
  12. ui(new Ui::MainWindow)
  13. {
  14. ui->setupUi(this);
  15. }
  16.  
  17. MainWindow::~MainWindow()
  18. {
  19. delete ui;
  20. }
  21.  
  22. void ERRCHECK(FMOD_RESULT result)
  23. {
  24. if (result != FMOD_OK)
  25. {
  26. printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
  27. exit(-1);
  28. }
  29. }
  30.  
  31. void MainWindow::paintEvent(QPaintEvent *)
  32. {
  33. QPainter p(this);
  34. p.setPen(Qt::black);
  35. p.setBrush(Qt::black);
  36.  
  37. FMOD_SYSTEM *system;
  38. FMOD_SOUND *snare1;
  39. FMOD_CHANNEL *channel = 0;
  40. FMOD_RESULT result;
  41.  
  42. result = FMOD_System_Create(&system);
  43. ERRCHECK(result);
  44.  
  45. result = FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, NULL);
  46. ERRCHECK(result);
  47.  
  48. result = FMOD_System_CreateSound(system, "drums/snare1.wav", FMOD_SOFTWARE, 0, &snare1);
  49. ERRCHECK(result);
  50.  
  51. result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, snare1, 0, &channel);
  52. ERRCHECK(result);
  53.  
  54.  
  55. }
To copy to clipboard, switch view to plain text mode