Changeset 335
- Timestamp:
- Nov 28, 2007, 5:57:08 PM (17 years ago)
- Location:
- code/branches/audio
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/audio/src/audio/Ambient.cc
r334 r335 55 55 } 56 56 57 ALboolean Ambient::LoadALData() 58 { 59 ALenum format; 60 ALsizei size; 61 ALvoid* data; 62 ALsizei freq; 63 ALboolean loop; 57 ALboolean Ambient::LoadALData() 58 { 59 ALenum format; 60 ALsizei size; 61 ALvoid* data; 62 ALsizei freq; 63 ALboolean loop; 64 65 66 alGenBuffers(1, &Buffer); 67 68 if(alGetError() != AL_NO_ERROR) 69 return AL_FALSE; 70 71 alutLoadWAVFile((ALbyte*)"wavdata/pirate.wav", &format, &data, &size, &freq, &loop); 72 alBufferData(Buffer, format, data, size, freq); 73 alutUnloadWAV(format, data, size, freq); 74 75 alGenSources(1, &Source); 76 77 if(alGetError() != AL_NO_ERROR) 78 return AL_FALSE; 79 80 alSourcei (Source, AL_BUFFER, Buffer ); 81 alSourcef (Source, AL_PITCH, 1.0 ); 82 alSourcef (Source, AL_GAIN, 1.0 ); 83 alSourcefv(Source, AL_POSITION, SourcePos); 84 alSourcefv(Source, AL_VELOCITY, SourceVel); 85 alSourcei (Source, AL_LOOPING, loop ); 86 87 if(alGetError() == AL_NO_ERROR) 88 return AL_TRUE; 89 90 91 return AL_FALSE; 92 } 64 93 94 void Ambient::SetListenerValues() 95 { 96 alListenerfv(AL_POSITION, ListenerPos); 97 alListenerfv(AL_VELOCITY, ListenerVel); 98 alListenerfv(AL_ORIENTATION, ListenerOri); 99 } 100 101 void Ambient::KillALData() 102 { 103 alDeleteBuffers(1, &Buffer); 104 alDeleteSources(1, &Source); 105 alutExit(); 106 } 65 107 66 alGenBuffers(1, &Buffer); 67 68 if(alGetError() != AL_NO_ERROR) 69 return AL_FALSE; 70 71 alutLoadWAVFile((ALbyte*)"wavdata/pirate.wav", &format, &data, &size, &freq, &loop); 72 alBufferData(Buffer, format, data, size, freq); 73 alutUnloadWAV(format, data, size, freq); 74 75 alGenSources(1, &Source); 76 77 if(alGetError() != AL_NO_ERROR) 78 return AL_FALSE; 79 80 alSourcei (Source, AL_BUFFER, Buffer ); 81 alSourcef (Source, AL_PITCH, 1.0 ); 82 alSourcef (Source, AL_GAIN, 1.0 ); 83 alSourcefv(Source, AL_POSITION, SourcePos); 84 alSourcefv(Source, AL_VELOCITY, SourceVel); 85 alSourcei (Source, AL_LOOPING, loop ); 86 87 if(alGetError() == AL_NO_ERROR) 88 return AL_TRUE; 89 90 91 return AL_FALSE; 92 } 93 94 void Ambient::SetListenerValues() 95 { 96 alListenerfv(AL_POSITION, ListenerPos); 97 alListenerfv(AL_VELOCITY, ListenerVel); 98 alListenerfv(AL_ORIENTATION, ListenerOri); 108 void Ambient::play() 109 { 110 alSourcePlay(Source); 111 112 } 99 113 } 100 114 101 void Ambient::KillALData()102 {103 alDeleteBuffers(1, &Buffer);104 alDeleteSources(1, &Source);105 alutExit();106 }107 108 void Ambient::play()109 {110 alSourcePlay(Source);111 112 }113 114 115 116 117 }118
Note: See TracChangeset
for help on using the changeset viewer.