a MinGW target: Link against alut.dll in addition to openal32.dll. Remove some preprocessor defines from compiler.h that were confusing the mingw and/or libstdc++ headers (I put the _isnan one back in the only file it was used). Hack a broken sleep() call into the OpenAL sample programs so that they will compile (but not work) in a non-POSIX environment. Change the header file ordering in sample_openal.hxx to get around some really weird interactions between MinGW's windows.h and the gcc iostream header.
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#include <stdio.h>
|
|
#ifdef __MINGW32__
|
|
// This is broken, but allows the file to compile without a POSIX
|
|
// environment.
|
|
static unsigned int sleep(unsigned int secs) { return 0; }
|
|
#else
|
|
#include <unistd.h> // sleep()
|
|
#endif
|
|
|
|
#include "sample_openal.hxx"
|
|
#include "soundmgr_openal.hxx"
|
|
|
|
|
|
int main( int argc, char *argv[] ) {
|
|
SGSoundMgr sm;
|
|
|
|
SGSoundSample sample1( ".", "jet.wav", true );
|
|
sample1.set_volume(0.5);
|
|
sample1.set_volume(0.2);
|
|
sample1.play_looped();
|
|
sleep(1);
|
|
|
|
SGSoundSample sample2( ".", "jet.wav", true );
|
|
sample2.set_volume(0.5);
|
|
sample2.set_pitch(0.4);
|
|
sample2.play_looped();
|
|
sleep(1);
|
|
|
|
SGSoundSample sample3( ".", "jet.wav", true );
|
|
sample3.set_volume(0.5);
|
|
sample3.set_pitch(0.8);
|
|
sample3.play_looped();
|
|
sleep(1);
|
|
|
|
SGSoundSample sample4( ".", "jet.wav", true );
|
|
sample4.set_volume(0.5);
|
|
sample4.set_pitch(1.2);
|
|
sample4.play_looped();
|
|
sleep(1);
|
|
|
|
SGSoundSample sample5( ".", "jet.wav", true );
|
|
sample5.set_volume(0.5);
|
|
sample5.set_pitch(1.6);
|
|
sample5.play_looped();
|
|
sleep(1);
|
|
|
|
SGSoundSample sample6( ".", "jet.wav", true );
|
|
sample6.set_volume(0.5);
|
|
sample6.set_pitch(2.0);
|
|
sample6.play_looped();
|
|
sleep(1);
|
|
|
|
sleep(10);
|
|
}
|