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

Thread: Loading and Unloading Audio Library Memory

  1. #1
    Senior Member
    Join Date
    Feb 2015
    Posts
    160

    Loading and Unloading Audio Library Memory

    Hello!

    I have a project which I have been working on for a while now, which I would like to use the Audio library for, but only sometimes.

    The device I am building takes up most of the memory of the Teensy 3.1 in its normal mode, however I would like to have a secondary mode where the primary function is disabled, and the audio library is enabled, and then the audio library can be disabled again and the primary loop can resume.

    I guess my question is, does anyone know of a way to reliably de-allocate memory that has been allocated using AudioMemory()?
    What about for other Audio objects? Specifically I will need to do a 4 channel note frequency analysis.

    Thank you!
    Tenkai
    Last edited by tenkai; 02-05-2016 at 08:54 PM.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,567
    Quote Originally Posted by tenkai View Post
    Hello!

    I guess my question is, does anyone know of a way to reliably de-allocate memory that has been allocated using AudioMemory()?
    This is not possible.

    But you could try to edit Audiostream.h (in cores/teensy3/) and write your own function do allocate and de-allocate the memory. I guess you have to stop the whole library, too ..somehow.. ..as there are interrupts every 2.9ms which call the the object's update()-functions

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,929
    Yeah, the whole library is designed to keep running forever. Making it stop would require some crafty hacking!

    In theory, you should only need to look at the input and output objects. If you can modify those to stop, the entire library will stop, because they're the part which triggers the software interrupt which does all the updates.

  4. #4
    Senior Member
    Join Date
    Feb 2015
    Posts
    160
    Thanks Paul, I will have to look into this deeper. Once I figure something out, I will share my findings.

    It would be great to have this as a standard across the board for all Audio objects.

Posting Permissions

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