Rev | Line | |
---|
[14] | 1 | #include <stdlib.h> |
---|
| 2 | #include <AL/alut.h> |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * This program plays a 440Hz tone using a variety of waveforms. |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | static void |
---|
| 9 | playTone (ALenum waveshape) |
---|
| 10 | { |
---|
| 11 | ALuint buffer, source; |
---|
| 12 | buffer = alutCreateBufferWaveform (waveshape, 440, 0, 1); |
---|
| 13 | alGenSources (1, &source); |
---|
| 14 | alSourcei (source, AL_BUFFER, buffer); |
---|
| 15 | alSourcePlay (source); |
---|
| 16 | alutSleep (1); |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | int |
---|
| 20 | main (int argc, char **argv) |
---|
| 21 | { |
---|
| 22 | alutInit (&argc, argv); |
---|
| 23 | |
---|
| 24 | playTone (ALUT_WAVEFORM_SINE); |
---|
| 25 | playTone (ALUT_WAVEFORM_SQUARE); |
---|
| 26 | playTone (ALUT_WAVEFORM_SAWTOOTH); |
---|
| 27 | playTone (ALUT_WAVEFORM_WHITENOISE); |
---|
| 28 | playTone (ALUT_WAVEFORM_IMPULSE); |
---|
| 29 | |
---|
| 30 | alutExit (); |
---|
| 31 | return EXIT_SUCCESS; |
---|
| 32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.