AudioStream.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Micole Architecture
00003  *
00004  * Copyright (C) 2007 Micole partners
00005  *
00006  * Micole Architecture is free software: you can redistribute it 
00007  * and/or modify it under the terms of the GNU Lesser General 
00008  * Public License as published by the Free Software Foundation, 
00009  * either version 3 of the License, or (at your option) any 
00010  * later version.
00011  *
00012  * Micole Architecture is distributed in the hope that it will be 
00013  * useful, * but WITHOUT ANY WARRANTY; without even the implied 
00014  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00015  * PURPOSE.  See the GNU Lesser General Public License for more 
00016  * details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with Micole Architecture.  If not, see
00020  * <http://www.gnu.org/licenses/>.
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 // For 7.1 sound cards
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.

Generated on Tue Oct 16 17:10:42 2007 for Micole by  doxygen 1.4.7