Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

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

  1. #1
    Junior Member
    Join Date
    Jan 2021
    Posts
    4

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

    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

    CrackPlayer.txt
    CrackPlayer.cpp
    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

  2. #2
    Junior Member
    Join Date
    Jan 2021
    Posts
    4
    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 by mb_dtlj; 01-26-2021 at 07:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •