Copyright (C) 2000-2012 |
GNU Info (openal.info)ReverbReverb ====== #include <AL/al.h> #include <AL/alc.h> #include <AL/alkludge.h> #include <AL/alut.h> #include <time.h> #include <stdio.h> #include <unistd.h> static void init( void ); static ALuint reverb_sid = 0; static void *wave = NULL; static void init( void ) { ALfloat zeroes[] = { 0.0f, 0.0f, 0.0f }; ALfloat back[] = { 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f }; ALfloat front[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f }; ALuint boom; ALsizei size; ALsizei bits; ALsizei freq; ALsizei format; alListenerfv(AL_POSITION, zeroes ); alListenerfv(AL_VELOCITY, zeroes ); alListenerfv(AL_ORIENTATION, front ); alGenBuffers( 1, &boom ); alutLoadWAV( "l2.wav", &wave, &format, &size, &bits, &freq); alBufferData( boom, format, wave, size, freq ); free(wave); /* openal makes a local copy of wave data */ alGenSources( 1, &reverb_sid); alSource3f(reverb_sid, AL_POSITION, 2.0, 0.0, 4.0); alSourcefv(reverb_sid, AL_VELOCITY, zeroes); alSourcefv(reverb_sid, AL_ORIENTATION, back); alSourcei (reverb_sid, AL_BUFFER, boom); alReverbScale(reverb_sid, 0.6); alReverbDelay(reverb_sid, 0.3); alAttenuationScale(0.3); } int main(int argc, char *argv[]) { alutInit( &argc, argv ); init( ); alSourcePlay(reverb_sid); sleep(10); alutExit(); return 0; } automatically generated by info2www version 1.2.2.9 |