Changeset 1064 for code/trunk/src/audio
- Timestamp:
- Apr 14, 2008, 9:39:57 PM (17 years ago)
- Location:
- code/trunk/src/audio
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/audio/AudioManager.cc
r1056 r1064 31 31 #include <AL/alut.h> 32 32 33 #include "AudioBuffer.h" 34 #include "AudioSource.h" 35 #include "AudioStream.h" 33 36 #include "core/Error.h" 34 37 #include "core/Debug.h" … … 49 52 for (unsigned int i=0;i<bgSounds.size();i++) 50 53 { 51 bgSounds[i] .release();54 bgSounds[i]->release(); 52 55 } 53 56 alutExit(); … … 60 63 if (bgSounds.size() > 0) 61 64 { 62 if(!bgSounds[currentBgSound] .playback())65 if(!bgSounds[currentBgSound]->playback()) 63 66 { 64 67 orxonox::Error("Ogg refused to play."); … … 80 83 { 81 84 std::string path = ambientPath + "/" + file + ".ogg"; 82 AudioStream tmp(path);83 tmp .open();84 if (tmp .isLoaded())85 AudioStream* tmp = new AudioStream(path); 86 tmp->open(); 87 if (tmp->isLoaded()) 85 88 { 86 89 bgSounds.push_back(tmp); … … 93 96 if (bgSounds.size() > 0) 94 97 { 95 if (bgSounds[currentBgSound] .isLoaded())98 if (bgSounds[currentBgSound]->isLoaded()) 96 99 { 97 bool playing = bgSounds[currentBgSound] .update();98 if(!bgSounds[currentBgSound] .playing() && playing)100 bool playing = bgSounds[currentBgSound]->update(); 101 if(!bgSounds[currentBgSound]->playing() && playing) 99 102 { 100 if(!bgSounds[currentBgSound] .playback())103 if(!bgSounds[currentBgSound]->playback()) 101 104 orxonox::Error("Ogg abruptly stopped."); 102 105 else … … 117 120 currentBgSound = ++currentBgSound % bgSounds.size(); 118 121 119 if (!bgSounds[currentBgSound] .isLoaded())122 if (!bgSounds[currentBgSound]->isLoaded()) 120 123 { 121 bgSounds[currentBgSound] .release();122 bgSounds[currentBgSound] .open();124 bgSounds[currentBgSound]->release(); 125 bgSounds[currentBgSound]->open(); 123 126 } 124 bgSounds[currentBgSound] .playback();127 bgSounds[currentBgSound]->playback(); 125 128 COUT(3) << "Info: Playing next background sound" << std::endl; 126 129 } -
code/trunk/src/audio/AudioManager.h
r1056 r1064 36 36 37 37 #include "core/Tickable.h" 38 #include "AudioBuffer.h"39 #include "AudioSource.h"40 #include "AudioStream.h"41 38 42 39 namespace audio … … 76 73 77 74 // Background sound 78 std::vector<AudioStream > bgSounds;75 std::vector<AudioStream*> bgSounds; 79 76 int currentBgSound; 80 77 … … 84 81 85 82 // Vector containing all audio files 86 std::vector<AudioBuffer > buffers;83 std::vector<AudioBuffer*> buffers; 87 84 // Vector containing all audio sources which referer to one buffer 88 std::vector<AudioSource > sources;85 std::vector<AudioSource*> sources; 89 86 // The ambient background sound 90 AudioSource ambient;87 AudioSource* ambient; 91 88 92 89 std::vector<float> listenerPosition; -
code/trunk/src/audio/AudioPrereqs.h
r1062 r1064 68 68 } 69 69 70 //----------------------------------------------------------------------- 71 // Warnings 72 //----------------------------------------------------------------------- 73 // set to 4: conversion from 'ogg_int64_t' to 'long', possible loss of data 74 # pragma warning (4 : 4244) 75 76 70 77 #endif /* _AudioPrereqs_H__ */ -
code/trunk/src/audio/AudioStream.cc
r1056 r1064 43 43 int result; 44 44 45 46 if(! (oggFile = fopen(path.c_str(), "rb")))45 oggFile = fopen(path.c_str(), "rb"); 46 if(!oggFile) 47 47 { 48 48 orxonox::Error("Could not open Ogg file "+path);
Note: See TracChangeset
for help on using the changeset viewer.