A test program for the WavPlayer class, works on the RS Animatronic Lab Board
Dependencies: FatFileSystem MSCFileSystem WavPlayer mbed
main.cpp@2:8818d976f1e7, 2012-09-24 (annotated)
- Committer:
- p07gbar
- Date:
- Mon Sep 24 14:10:40 2012 +0000
- Revision:
- 2:8818d976f1e7
- Parent:
- 0:d49f4c0f2ba7
Added some more documentation detail
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
p07gbar | 2:8818d976f1e7 | 1 | // This is all set up for the RS Labboard: Just plug a memory stick with a wav file called test.wav on it |
p07gbar | 2:8818d976f1e7 | 2 | //(such as the one you can get from: https://mbed.org/media/uploads/p07gbar/test.wav) and have a listen! |
p07gbar | 2:8818d976f1e7 | 3 | // Any 16bit PCM Wav files with channel*sample rate less than 48kHz should work. |
p07gbar | 0:d49f4c0f2ba7 | 4 | |
p07gbar | 0:d49f4c0f2ba7 | 5 | #include "mbed.h" |
p07gbar | 0:d49f4c0f2ba7 | 6 | #include "WavPlayer.h" |
p07gbar | 0:d49f4c0f2ba7 | 7 | #include "MSCFileSystem.h" |
p07gbar | 0:d49f4c0f2ba7 | 8 | |
p07gbar | 0:d49f4c0f2ba7 | 9 | MSCFileSystem msc("msc"); // Mount flash drive under the name "msc" |
p07gbar | 0:d49f4c0f2ba7 | 10 | WavPlayer player; |
p07gbar | 0:d49f4c0f2ba7 | 11 | |
p07gbar | 0:d49f4c0f2ba7 | 12 | int main() { |
p07gbar | 0:d49f4c0f2ba7 | 13 | FILE *fp = fopen("/msc/test.wav", "r"); // Open "out.txt" on the local file system for writing |
p07gbar | 0:d49f4c0f2ba7 | 14 | player.open(&fp); |
p07gbar | 0:d49f4c0f2ba7 | 15 | player.play(); |
p07gbar | 0:d49f4c0f2ba7 | 16 | fclose(fp); |
p07gbar | 0:d49f4c0f2ba7 | 17 | } |