Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-08-18 09:24:15 +0000
committerStijn Buys <ingar@osirion.org>2009-08-18 09:24:15 +0000
commitf030154fe727e25a2afe1f78b3998c2d2dba95e4 (patch)
treecd92baf9e4fa8a136523b9eb570e9811846c9250 /src/audio/audio.cc
parent5636fad174f0bcff857c357c394c4cc8d424b302 (diff)
astyle cleanup, corrects not loading of material textures
Diffstat (limited to 'src/audio/audio.cc')
-rw-r--r--src/audio/audio.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/audio/audio.cc b/src/audio/audio.cc
index 2192e2f..e1eb0d3 100644
--- a/src/audio/audio.cc
+++ b/src/audio/audio.cc
@@ -29,7 +29,7 @@ void init()
}
// create the audio context
- audio_context = alcCreateContext(audio_device ,0);
+ audio_context = alcCreateContext(audio_device , 0);
if (!audio_context) {
alcCloseDevice(audio_device);
@@ -42,11 +42,11 @@ void init()
// clear errors
alGetError();
-
+
Buffers::init();
Sources::init();
-
+
//con_debug << " audio device ^B" << alcGetString(audio_device, ALC_DEFAULT_DEVICE_SPECIFIER) << std::endl;
// the "no sound" sound
@@ -64,12 +64,12 @@ void reset()
Buffers::shutdown();
Buffers::init();
Sources::init();
-
+
load("ui/nosnd");
load("ui/console");
}
-void load (const char *name)
+void load(const char *name)
{
Buffers::load(std::string(name));
}
@@ -91,7 +91,7 @@ void shutdown()
if (audio_device) {
alcCloseDevice(audio_device);
audio_device = 0;
- }
+ }
}
size_t play(const char *name)
@@ -101,14 +101,14 @@ size_t play(const char *name)
size_t buffer_index = Buffers::load(std::string(name));
- for (size_t i = 0; i < MAXUISOURCES; i++) {
+ for (size_t i = 0; i < MAXUISOURCES; i++) {
ALint srcstate = 0;
ALuint source = Sources::source(i);
alGetSourcei(source , AL_SOURCE_STATE , &srcstate);
if (srcstate != AL_PLAYING) {
Buffers::bind(source, buffer_index);
- alSourcef(source, AL_PITCH, 1.0);
- alSourcef(source, AL_GAIN, 1.0);
+ alSourcef(source, AL_PITCH, 1.0);
+ alSourcef(source, AL_GAIN, 1.0);
alSourcei(source, AL_SOURCE_RELATIVE, AL_TRUE);
ALfloat location[] = {0.0f, 0.0f, 0.0f};
alSourcefv(source, AL_POSITION, location);
@@ -121,7 +121,7 @@ size_t play(const char *name)
return 0;
}
-size_t play(size_t source_index, size_t buffer_index, float pitch, float gain)
+size_t play(size_t source_index, size_t buffer_index, float pitch, float gain)
{
if (!audio_context || !buffer_index)
return 0;
@@ -135,9 +135,9 @@ size_t play(size_t source_index, size_t buffer_index, float pitch, float gain)
Buffers::bind(source, buffer_index);
alSourcei(source, AL_SOURCE_RELATIVE, AL_FALSE);
alSourcef(source, AL_PITCH, pitch);
- alSourcef(source, AL_GAIN, gain);
+ alSourcef(source, AL_GAIN, gain);
- alSourcei(source, AL_LOOPING, AL_FALSE);
+ alSourcei(source, AL_LOOPING, AL_FALSE);
alSourceRewind(source);
alSourcePlay(source);
@@ -161,9 +161,9 @@ size_t loop(size_t source_index, size_t buffer_index, float pitch, float gain)
//alSourcef(source, AL_REFERENCE_DISTANCE, 2.0f); // might be the cause of cracks in the sound
alSourcei(source, AL_SOURCE_RELATIVE, AL_FALSE);
alSourcef(source, AL_PITCH, pitch);
- alSourcef(source, AL_GAIN, gain);
+ alSourcef(source, AL_GAIN, gain);
- alSourcei(source, AL_LOOPING, AL_TRUE);
+ alSourcei(source, AL_LOOPING, AL_TRUE);
alSourceRewind(source);
alSourcePlay(source);
@@ -190,7 +190,7 @@ void update_listener(math::Vector3f const &location, math::Axis const &axis, mat
alListenerfv(AL_POSITION, location.ptr());
ALfloat orientation[6];
- for (size_t i =0; i <3; i++) {
+ for (size_t i = 0; i < 3; i++) {
orientation[i] = axis.forward()[i];
orientation[i+3] = axis.up()[i];
}
@@ -208,7 +208,7 @@ void update_source(size_t source_index, math::Vector3f const & location, math::V
alSourcefv(source, AL_POSITION, location.ptr());
//alSourcefv(source, AL_VELOCITY, velocity.ptr());
alSourcef(source, AL_PITCH, pitch);
- alSourcef(source, AL_GAIN, gain);
+ alSourcef(source, AL_GAIN, gain);
}
-
+
}