Blame view

app/gui/oven_control/soundplayer.cpp 749 Bytes
2097d305c   김태훈   소리 재생 기능 추가
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  #include "soundplayer.h"
  
  QMap<QString, QSound *> SoundPlayer::map;
  QSound *SoundPlayer::current = 0;
  
  void SoundPlayer::play(const QString &filename)
  {
      if (current && !current->isFinished())
          current->stop();
  
      if (map.contains(filename))
          current = map.value(filename);
      else
      {
          current = new QSound(filename);
          map[filename] = current;
      }
  
      current->play();
  }
337d4f1a3   김태훈   음원 추가
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  void SoundPlayer::playClick()
  {
      play(":/sounds/button.wav");
  }
  
  void SoundPlayer::playStart()
  {
      play(":/sounds/start.wav");
  }
  
  void SoundPlayer::playStop()
  {
      play(":/sounds/stop.wav");
  }
  
  void SoundPlayer::playError1()
  {
      play(":/sounds/error1.wav");
  }
  
  void SoundPlayer::playError2()
  {
      play(":/sounds/error2.wav");
  }