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