diff options
author | Chris Robinson <[email protected]> | 2015-10-14 02:41:39 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-10-14 02:41:39 -0700 |
commit | d386675efe60b43cd302702c9a893562ad937dc8 (patch) | |
tree | 16f2fe018a7e6b550adb245a03e3712c867f57af /examples | |
parent | 9012bcf3279558139700ab1ad526c2d7a42be76e (diff) |
Print the wave type being played
Diffstat (limited to 'examples')
-rw-r--r-- | examples/altonegen.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/altonegen.c b/examples/altonegen.c index 191962f0..4035b5e1 100644 --- a/examples/altonegen.c +++ b/examples/altonegen.c @@ -54,6 +54,18 @@ enum WaveType { WT_Triangle, }; +static const char *GetWaveTypeName(enum WaveType type) +{ + switch(type) + { + case WT_Sine: return "sine"; + case WT_Square: return "square"; + case WT_Sawtooth: return "sawtooth"; + case WT_Triangle: return "triangle"; + } + return "(unknown)"; +} + static void ApplySin(ALfloat *data, ALdouble g, ALuint srate, ALuint freq) { ALdouble smps_per_cycle = (ALdouble)srate / freq; @@ -204,8 +216,8 @@ int main(int argc, char *argv[]) return 1; } - printf("Playing %dhz tone with %dhz sample rate and %dhz output, for %d second%s...\n", - tone_freq, srate, dev_rate, max_loops+1, max_loops?"s":""); + printf("Playing %dhz %s-wave tone with %dhz sample rate and %dhz output, for %d second%s...\n", + tone_freq, GetWaveTypeName(wavetype), srate, dev_rate, max_loops+1, max_loops?"s":""); fflush(stdout); /* Create the source to play the sound with. */ |