Krig Game Engine
Music.h
Go to the documentation of this file.
1 
7 #ifndef _MUSIC_H_
8 #define _MUSIC_H_
9 
10 #include <AL/al.h>
11 #include <vorbis/vorbisfile.h>
12 
13 #include "constants.h"
14 
15 #define BUFFER_SIZE 65536
16 
17 class Music {
18  public:
19  Music();
20  ~Music();
21 
22  void SetMusicListener(
23  const ALfloat&, const ALfloat&, const ALfloat&,
24  const ALfloat&, const ALfloat&, const ALfloat&
25  );
26 
27  void PlaySong(const char*, const bool&);
28  void Update();
29  void StopSong();
30  void PauseSong();
31 
32  private:
33  ALuint Source;
34  ALenum Format;
35  ALint State;
36  ALuint Buffers[2];
37  ALuint Temp_Buffer;
38 
39  // Flags for setting states.
40  bool Playing;
41  bool Repeat;
42 
43  // File decoding variables.
44  FILE *Music_File;
45  vorbis_info *Ogg_Info;
46  OggVorbis_File Ogg_File;
47 
48  // variables for loop streaming.
49  int Processed, Size, Section, Bytes;
50  char Sound_Buffer[BUFFER_SIZE];
51 };
52 
53 #endif
Definition: Music.h:17