Nuvoton
/
NuMaker-mbed-AudioPlayback-example
NuMaker audio playback
Revision 17:65a16265cda2, committed 2020-07-03
- Comitter:
- csyang2 csyang2@nuvoton.com
- Date:
- Fri Jul 03 10:37:45 2020 +0800
- Parent:
- 16:90288541154c
- Child:
- 18:1194441ed3eb
- Commit message:
- Updated main.cpp to initial global variables properly
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Apr 28 21:17:26 2020 +0800 +++ b/main.cpp Fri Jul 03 10:37:45 2020 +0800 @@ -306,6 +306,11 @@ } void demo_record(void) { + /* Init global varibles first */ + readPtr = 0; + writePtr = 0; + theta = 0; + #if defined(TARGET_NUMAKER_PFM_NANO130) for (int i = 0; i < 128; i++) { #else @@ -337,6 +342,11 @@ } void demo_play(void) { + /* Init global varibles first */ + readPtr = 0; + writePtr = 0; + theta = 0; + #if defined(TARGET_NUMAKER_PFM_NUC472) || defined(TARGET_NUMAKER_PFM_M487) || defined(TARGET_NUMAKER_IOT_M487) printf("Opening file test.pcm read-only"); fd = fopen("/fs/test.pcm", "r"); @@ -381,6 +391,11 @@ } void demo_loopback(void) { + /* Init global varibles first */ + readPtr = 0; + writePtr = 0; + theta = 0; + // disable headphone hp_enable = 1;