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

Thread: SerialFlash Example Sketch "MP3Player" getting odd error, Teensy3.2

  1. #1
    Junior Member
    Join Date
    Dec 2020
    Posts
    3

    SerialFlash Example Sketch "MP3Player" getting odd error, Teensy3.2

    Hello,

    I am getting an error I have not found anywhere else online when I compile the MP3Player example sketch that comes with the SerialFlash library. I am using the Teensy 3.2 with the Prop Shield.

    Code:
    // Simple MP3 file player example
    //
    // https://forum.pjrc.com/threads/27059-MP3-Player-Lib-with-example?p=101537&viewfull=1#post101537
    //
    // Requires the prop-shield and Teensy 3.2 or 3.1
    // This example code is in the public domain.
    
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    #include <play_sd_mp3.h> // https://github.com/FrankBoesing/Arduino-Teensy-Codec-lib
    //#include <play_sd_aac.h>
    
    // GUItool: begin automatically generated code
    //AudioPlaySdWav           playSdWav1;     //xy=154,422
    AudioPlaySdMp3           playMp31; //xy=154,422
    AudioMixer4              mixer1;         //xy=327,432
    AudioOutputAnalog        dac1;           //xy=502,412   ###ERROR HERE###
    AudioConnection          patchCord1(playMp31, 0, mixer1, 0);
    AudioConnection          patchCord2(playMp31, 1, mixer1, 1);
    AudioConnection          patchCord3(mixer1, dac1);
    I have all of the above installed, possibly with the exception of <play_sd_mp3.h> from Arduino-Teensy-Codec-lib. I'm not sure if I isntalled it properly, but the error at hand should not have anything to do with that.

    When I compile, I get an error that tells me that the AudioOutputAnalog does not define a type. Additionally, it tells me that 'dac1' was not declared in the scope.
    Code:
    MP3Player:20: error: 'AudioOutputAnalog' does not name a type
     AudioOutputAnalog        dac1;           //xy=502,412
     ^
    MP3Player:23: error: 'dac1' was not declared in this scope
     AudioConnection          patchCord3(mixer1, dac1);
                                                 ^
    Multiple libraries were found for "play_sd_mp3.h"
     Used: C:\...\Arduino\libraries\Arduino-Teensy-Codec-lib-master
     Not used: C:\...\Documents\Arduino\libraries\TeensyCodec
    
    'AudioOutputAnalog' does not name a type
    I do not understand why this is happening. The only thing I can get from this is what is at face value, being that AudioOutputAnalog appears to be undefined from the included header files, so the compiler wants a type definition and is treating it as a variable name. In my Arduino IDE though the name appears orange, which I think means that it *is* actually recognised. After some google searching, it doesn't seem like this is a common issue. Nor do these libraries appear to be very well documented, as seems to be the case for many arduino files.

    Also, the warning in there about multiple libraries is fine. I had duplicated the Arduino-Teensy-Codec-lib-master and just had not deleted the copy yet.

    I am a newcommer to Arduino, so if something is blatantly obvious to an expirenced person, I don't see it.
    Any help is appreciated.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    7,915
    I have all of the above installed,
    This might be the problem. You don't have to install anything but the codec library - all the rest is included in Teensyduino.

    Can you please post the complete compiler output?

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,543
    I installed Frank's library and compiled the code in #1 for a T3.2. It compiles without error as does the original Mp3FilePlayer example.

    I get an error that tells me that the AudioOutputAnalog does not define a type. Additionally, it tells me that 'dac1' was not declared in the scope.
    This suggests that you didn't compile it for the T3.2 but, as Frank has asked, post the complete compiler output. It should show what is wrong.

    Pete

Posting Permissions

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