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

Thread: AudioProcessorUsage()???

  1. #1
    Member
    Join Date
    Nov 2012
    Location
    Charlestown, Massachusetts, USA
    Posts
    26

    AudioProcessorUsage()???

    Are there any known problems with AudioProcessorUsage()?

    This program:
    Code:
    /* -*- mode: c++; tab-width: 8 -*- */
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // Create the Audio components.
    AudioInputUSB            usb2;
    AudioAmplifier           amp10, amp11;
    AudioAmplifier           amp20, amp21;
    AudioOutputUSB           usb1;
    AudioConnection          patchCord1(usb2, 0, amp10, 0);
    AudioConnection          patchCord2(usb2, 1, amp11, 0);
    AudioConnection          patchCord3(amp10, 0, amp20, 0);
    AudioConnection          patchCord4(amp11, 0, amp21, 0);
    AudioConnection          patchCord5(amp20, 0, usb1, 0);
    AudioConnection          patchCord6(amp21, 0, usb1, 1);
    
    void setup() { 
      AudioMemory(4);
      amp10.gain(0.5);
      amp11.gain(0.5);
      amp20.gain(1.5);
      amp21.gain(1.5);
      Serial.begin(9600);
      while ( ! Serial ) delay(1);
      Serial.printf("AudioProcessorUsage = %d%%, AudioProcessorUsageMax = %d%%\n", AudioProcessorUsage(), AudioProcessorUsageMax());
      AudioProcessorUsageMaxReset();
    }
    
    void loop() {
      if (Serial.available()) {
        while (Serial.available()) Serial.read();
        Serial.printf("AudioProcessorUsage = %d%%, AudioProcessorUsageMax = %d%%\n", AudioProcessorUsage(), AudioProcessorUsageMax());
        AudioProcessorUsageMaxReset();
      }
    }
    which I pared down from a much larger example, prints:
    Code:
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    AudioProcessorUsage = 0%, AudioProcessorUsageMax = 1071644672%
    The larger program does more audio processing. It prints:

    Code:
    AudioProcessorUsage = -1073741824%, AudioProcessorUsageMax = 1072023752%
    All this on a Teensy 3.6, Arduino 1.8,7, Teensyduino 1.44

    -- rec --

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,895
    try to print these not as integers but as floats...

  3. #3
    Member
    Join Date
    Nov 2012
    Location
    Charlestown, Massachusetts, USA
    Posts
    26
    Thank you, that works fine.

    -- rec --

Posting Permissions

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