Changeset 2815 in orxonox.OLD for orxonox/branches/sound
- Timestamp:
- Nov 11, 2004, 6:16:00 PM (20 years ago)
- Location:
- orxonox/branches/sound/src
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/sound/src/sound_control.cc
r2793 r2815 24 24 \brief standard constructor 25 25 26 This constructor builds a SoundControl Object, which waits for callers 27 calling its functions to output sound. All sound output is handles by this 28 object, which must only be constructed once. 26 This constructor builds a SoundControl Object, which waits for callers. 27 All sound output is handled by this singleton object. 29 28 */ 30 29 SoundControl::SoundControl () { … … 40 39 exit(1); 41 40 } 42 41 43 42 if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)){ 44 43 printf("Mix_OpenAudio: \n"); 45 44 exit(1); 46 45 } 47 48 postConstruction(); 49 } 50 51 SoundControl::SoundControl (int audio_rate audiorate, Uint16 audio_format audioformat, int audio_channels audiochannels, int audio_buffers audiobuffers) { 52 53 //setup parameters 54 int audio_rate = audiorate, audio_channels = audiochannels, audio_buffers = audiobuffers, bits = 0; 55 Uint16 audio_format = audioformat; 56 Mix_Music* music = NULL; 57 58 //initializing sound and calling Mix_OpenAudio 59 if(SDL_Init(SDL_INIT_AUDIO)<0){ 60 printf("SDL_Init: \n"); 61 exit(1); 62 } 63 64 if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)){ 65 printf("Mix_OpenAudio: \n"); 66 exit(1); 67 } 68 69 postConstruction(); 70 } 71 72 73 /** 74 \brief standard destructor 46 47 initialise(); 48 } 49 50 51 /** 52 \brief Destructor for the singleton instance 75 53 */ 76 54 SoundControl::~SoundControl () { 77 SoundControl* SoundControl::singleton = NULL; 78 } 79 80 SoundControl* SoundControl::singleton = NULL; 55 instance = NULL; 56 } 57 58 /** 59 \brief Returns a reference to the singleton 60 */ 61 SoundControl* SoundControl::getObject(){ 62 static SoundControl instance; 63 return &instance; 64 } 81 65 82 66 … … 84 68 \brief Is called by SoundControl object to initiate all values 85 69 */ 86 void SoundControl:: postConstruction() {70 void SoundControl::initialise() { 87 71 88 72 // Print some info … … 99 83 100 84 /** 101 \brief Sets the number of output Channels 85 \brief Sets the number of output Channels (should not be used) 102 86 */ 103 87 void SoundControl::setNumberOfChannels (int number_of_channels) { … … 220 204 break; 221 205 case 4: 222 music = Mix_LoadMUS("luke_grey_and 206 music = Mix_LoadMUS("luke_grey_and_aquarius_orxonox.ogg"); 223 207 break; 224 208 case 5: 225 209 music = Mix_LoadMUS("nomenes_orxonox.ogg"); 226 210 break; 211 case 6: 212 music = Mix_LoadMUS("nomenes_funkadudu.ogg"); 213 break; 227 214 } 228 215 } -
orxonox/branches/sound/src/sound_control.h
r2793 r2815 7 7 8 8 public: 9 SoundControl (); 10 ~SoundControl (); 9 SoundControl* getObject(); 11 10 void setNumberOfChannels(int number_of channels); 12 11 int playMod(char* filename); … … 23 22 24 23 private: 25 void postConstruction(); 26 SoundControl* singleton; 27 24 void initialise(); 25 //SoundControl singleton object must be made via getObject() 26 SoundControl(); 27 ~SoundControl() 28 28 } 29 29 -
orxonox/branches/sound/src/sound_test.cc
r2793 r2815 32 32 33 33 34 void main (void) {34 void main (void) { 35 35 SDL_Surface *screen; 36 36 SDL_Init(SDL_INIT_VIDEO); -
orxonox/branches/sound/src/sound_test.h
r2793 r2815 1 1 2 #ifndef PROTO_CLASS_H3 #define PROTO_CLASS_H2 #ifndef SOUND_TEST_H 3 #define SOUND_TEST_H 4 4 5 5 #include "data_tank.h" 6 6 7 7 8 class ProtoClass{8 class SoundTest { 9 9 10 10 public: 11 ProtoClass();12 ~ ProtoClass();11 SoundTest (); 12 ~SoundTest (); 13 13 14 14 };
Note: See TracChangeset
for help on using the changeset viewer.