trouble with AudioPlaySdRaw.play when I call from outside loop()?

Status
Not open for further replies.

mb_dtlj

Member
Hi I'm new to teensy and hoping someone can show me where I'm going wrong.

I am running into a problem where AudioPlaySdRaw.play("FILE.RAW") works when called once, and not when called again. I am trying to call it from a class object. I did an initial test that called it from the main loop function and it worked fine, restarting as soon as .isPlaying() returned false. Now I'm calling it by reference from an object. Is there something wrong with my code? I am new to integrating c++ style class objects into arduino, so it may be my error lies there.

I'm attaching a super simplified version that still reproduces the problem (the file plays once and stops, despite the fact that it calls play() as soon as .isPlaying() returns false.

I would like to be able to use classes, because the idea is to be able to have a number of these objects, and dynamically change a bunch of the playback behaviour with envelopes, looping, etc..
Any suggestions appreciated!

Thanks
Michael

View attachment CrackPlayer.txt
View attachment CrackPlayer.cpp
View attachment audio_troubleshoot_simplify.ino

NB. CrackPlayer.txt needs to be renamed CrackPlayer.hpp . For some reason the forum wouldn't allow me to upload it with the .hpp suffix.

OSX 10.11.6
Arduino 1.8.13
Teensyduino 1.53
Teensy 4.1
Audio Shield 4.x
SD card: Sandisk Ultra 16gb
 
Oops,
It looks like my error has to do with the way I'm storing the filename..
when I use a string literal, it works fine in this version of the code.
Feel free to delete post, I don't seem to be able to
 
Last edited:
Status
Not open for further replies.
Back
Top