00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef AUDIOSTREAM_H
00024 #define AUDIOSTREAM_H
00025
00026 #include <bass.h>
00027
00028 #include "util.h"
00029
00030 #define SPEAKER(N) (((N) > 30 || (N) < 1) ? ((N) > 30 ? 30 : 1) : (1 << (N-1)))
00031
00032
00033
00034 #define FRONT_SPEAKERS 0x00000000
00035 #define REAR_SPEAKERS 0x40000000
00036 #define SPEAKER_CENLFE 0x80000000
00037 #define SPEAKER_REAR2 0xC0000000
00038
00040 class AudioStream {
00041
00042 private:
00043
00044 HSTREAM handle;
00045 BASS_CHANNELINFO info;
00046 uint32 speakers;
00047
00048 uint64 size;
00049 uint32 freq;
00050 uint32 vol;
00051 sint32 pan;
00052 bool looped;
00053
00054 uint32 AssignSpeakers (uint32 speakers);
00055
00056 public:
00057
00059
00065 AudioStream (const char* filename, uint32 speakers, bool mono = true, bool looped = false);
00066
00068 ~AudioStream (void);
00069
00071
00074 void Play (bool restart = false);
00075
00077 void Pause (void);
00078
00080 void Stop (void);
00081
00083 uint64 GetSize (void);
00084
00086 int GetLength (void);
00087
00089 float GetTimeRemaining (void);
00090
00092 float GetTimeElapsed (void);
00093
00095
00098 void SetPosition (float sec);
00099
00101
00104 void SetSpekears (uint32 speakers);
00105
00107
00110 void SetFrequency (uint32 freq);
00111
00113 uint32 GetFrequency (void);
00114
00116
00119 void SetVolume (uint16 vol);
00120
00122 uint16 GetVolume (void);
00123
00125
00128 void SetPanning (sint8 pan);
00129
00131 sint8 GetPanning (void);
00132
00133 void PrintChannelAttributes (void);
00134 };
00135
00136 #endif // Do not add stuff beyond this point.