SimpleAudioPlayer sketch with error in compilation.

Hi !

I’ve been trying to compile the sketch that comes by default in the Arduino IDE , the SimpleAudioPlayer which audio.h used the library.

But I have a problem when compiling the sketch or other to use with audio.h library , Why i have this problem ?

I’m using the Arduino IDE 1.5.8 .

Arduino: 1.5.8 (Mac OS X), Placa:"Arduino Yún"

WARNING: library Audio claims to run on [sam] architecture(s) and may be incompatible with your current board which runs on [avr] architecture(s).

In file included from /Applications/Arduino.app/Contents/Java/libraries/Audio/src/Audio.h:16:0,
                 from SimpleAudioPlayer.ino:23:
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:21:16: error: expected ')' before '*' token
  DACClass(Dacc *_dac, uint32_t _dacId, IRQn_Type _isrId) :
                ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:35:2: error: 'Dacc' does not name a type
  Dacc *dac;
  ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:37:2: error: 'IRQn_Type' does not name a type
  IRQn_Type isrId;
  ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h: In member function 'void DACClass::enableInterrupts()':
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:31:44: error: 'isrId' was not declared in this scope
  void enableInterrupts()  { NVIC_EnableIRQ(isrId); };
                                            ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:31:49: error: 'NVIC_EnableIRQ' was not declared in this scope
  void enableInterrupts()  { NVIC_EnableIRQ(isrId); };
                                                 ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h: In member function 'void DACClass::disableInterrupts()':
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:32:45: error: 'isrId' was not declared in this scope
  void disableInterrupts() { NVIC_DisableIRQ(isrId); };
                                             ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/DAC.h:32:50: error: 'NVIC_DisableIRQ' was not declared in this scope
  void disableInterrupts() { NVIC_DisableIRQ(isrId); };
                                                  ^
SimpleAudioPlayer.ino: In function 'void loop()':
SimpleAudioPlayer.ino:68:36: error: invalid conversion from 'short int*' to 'int16_t* {aka int*}' [-fpermissive]
In file included from SimpleAudioPlayer.ino:23:0:
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/Audio.h:21:7: error:   initializing argument 1 of 'void AudioClass::prepare(int16_t*, int, int)' [-fpermissive]
  void prepare(int16_t *buffer, int S, int volume);
       ^
SimpleAudioPlayer.ino:70:26: error: call of overloaded 'write(short int [1024], const int&)' is ambiguous
SimpleAudioPlayer.ino:70:26: note: candidates are:
In file included from SimpleAudioPlayer.ino:23:0:
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/Audio.h:27:17: note: virtual size_t AudioClass::write(const uint16_t*, size_t) <near match>
  virtual size_t write(const uint16_t *data, size_t size) { return write(reinterpret_cast<const uint32_t*>(data), size/2) * 2; };
                 ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/Audio.h:27:17: note:   no known conversion for argument 1 from 'short int [1024]' to 'const uint16_t* {aka const unsigned int*}'
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/Audio.h:28:17: note: virtual size_t AudioClass::write(const int16_t*, size_t) <near match>
  virtual size_t write(const int16_t *data, size_t size)  { return write(reinterpret_cast<const uint32_t*>(data), size/2) * 2; };
                 ^
/Applications/Arduino.app/Contents/Java/libraries/Audio/src/Audio.h:28:17: note:   no known conversion for argument 1 from 'short int [1024]' to 'const int16_t* {aka const int*}'
Error de compilación

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Thank for your help !

Why i have this problem ?

Why you not post this in the Yun forum?

Hi, because the error happens to me both in Arduino YUN as in the Arduino UNO.

Well, the UNO does not have the required hardware, so it makes no sense to try to compile that for the UNO.

At the beginning of the output, you can read

WARNING: library Audio claims to run on [sam] architecture(s) and may be incompatible with your current board which runs on [avr] architecture(s).