PGE Engine
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
SdlMusPlayer.h
1 #ifndef NO_SDL
2 
3 
4 #ifndef SDL_MUS_PLAYER
5 #define SDL_MUS_PLAYER
6 #define SDL_MAIN_HANDLED
7 #include <SDL2/SDL.h>
8 #include <SDL2/SDL_mixer_ext.h>
9 #include <SDL2/SDL_stdinc.h>
10 #include <QHash>
11 #include <QString>
12 
14 {
15 public:
16  static int initAudio(int sampleRate=44100, int allocateChannels=32, int bufferSize=4096);
17 
18  static QString currentTrack;
19  static void MUS_playMusic();
20  static QString MUS_Title();
21  static void MUS_playMusicFadeIn(int ms);
22  static void MUS_pauseMusic();
23  static void MUS_stopMusic();
24  static void MUS_stopMusicFadeOut(int ms);
25 
26  static void MUS_changeVolume(int vlm);
27  static void MUS_openFile(QString musFile);
28 
29  static int sampleRate();
30  static int currentVolume();
31 
32  static bool MUS_IsPlaying();
33  static bool MUS_IsPaused();
34  static bool MUS_IsFading();
35 
36  static Uint64 sampleCount();
37  static Uint64 MUS_sampleCount();
38 
39  static void freeStream();
40 private:
41  static bool isLoaded;
42  static Mix_Music *play_mus;
43  static int volume;
44  static int sRate;
45  static bool showMsg;
46  static QString showMsg_for;
47 
48  static SDL_mutex* sampleCountMutex;
49  static Uint64 sCount;
50  static Uint64 musSCount;
51  static void postMixCallback(void *udata, Uint8 *stream, int len);
52 };
53 
54 
56 {
57 public:
58  static void SND_PlaySnd(QString sndFile);
59  static void clearSoundBuffer();
60  static Mix_Chunk *SND_OpenSnd(QString sndFile);
61 private:
62  static QHash<QString, Mix_Chunk* > chunksBuffer;
63  static Mix_Chunk *sound;
64  static QString current;
65 };
66 #endif
67 
68 #endif
Definition: SdlMusPlayer.h:13
Definition: SdlMusPlayer.h:55