CAudio: Paths fix + error "detection" - sounds are functional now!
[mines3d.git] / sound / CAudio.h
blob6fe82d2abae6d1bda090c1b4659a165a2934cc76
1 /*
2 * File: CAudio.h
3 * Author: Jindrich Kovar
4 * Uses OpenAL (alut.h, alc.h, al.h)
5 */
6 #ifndef __CAudio_h_
7 #define __CAudio_h_
9 #include <AL/alut.h>
10 #include <stdio.h>
11 //#include "../exceptions/GeneralException.h"
12 #include "../exceptions/CAudioException.h"
14 #define NUM_SOURCES 6
15 #define NUM_BUFFERS 6
16 #define NUM_MUSICS 2
17 #define SOUND_NOTHING -1
18 #define MUSIC_NOTHING -1
20 #define MUSIC_SLOW_SOURCE "sound/soundfiles/SonIntro1.wav"
21 #define MUSIC_FAST_SOURCE "sound/soundfiles/.wav"
22 #define SOUND_BUTTON_SUCCESS_SOURCE "sound/soundfiles/ButtonSuc.wav"
23 #define SOUND_BUTTON_HOVER_SOURCE "sound/soundfiles/.wav"
24 #define SOUND_GAME_OVER_SOURCE "sound/soundfiles/game_over.wav"
25 #define SOUND_GAME_VICTORY_SOURCE "sound/soundfiles/woohoo.wav"
27 #define MUSIC_SLOW 0
28 #define MUSIC_FAST 1
29 #define SOUND_BUTTON_SUCCESS 2
30 #define SOUND_BUTTON_HOVER 3
31 #define SOUND_GAME_OVER 4
32 #define SOUND_GAME_VICTORY 5
33 class CAudio
35 public:
36 CAudio();
37 ~CAudio();
38 void PlayMusic(int id);
39 void StopMusic(void);
40 void PlaySound(int id);
41 void StopSound(void);
43 bool bSoundEnabled;
44 private:
45 ALuint Buffers[NUM_BUFFERS]; // Buffers hold sound data.
46 ALuint Sources[NUM_SOURCES]; // Sources are points of emitting sound.
47 ALfloat SourcesPos[NUM_SOURCES][3]; // Position of the source sounds.
48 ALfloat SourcesVel[NUM_SOURCES][3]; // Velocity of the source sounds.
49 ALfloat ListenerPos[3] ;// Position of the listener.
50 ALfloat ListenerVel[3] ;// Velocity of the listener.
51 ALfloat ListenerOri[6] ;// Orientation of the listener. (first 3 elements are "at", second 3 are "up")
52 int iActuallyPlayingMusic;
53 int iActuallyPlayingSound;
55 #endif