Go Down

Topic: Writing code for fluxamasynth in 1.03 arduino (Read 870 times) previous topic - next topic

Trazman001

Jan 10, 2013, 10:51 pm Last Edit: Jan 10, 2013, 11:25 pm by Trazman001 Reason: 1
Hi

I am working on a project with fluxamasynth, I have books on c++ and arduino.
some ression i do not have the right librarys for this code.
When I try to compile my code it says, "can not find Wprogram.h" and "byte not declared".

I am trying code like this to fix it.

Code: [Select]
#include <Fluxamasynth.h>
#include <NewSoftSerial.h>
#include <PgmChange.h>

#include <fluxamasynth_nss.h>
#include <newsoftserial.h>

#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif


Fluxamasynth synth;

#define byte uint8_t

#define c3 48          // define our notes to their midi values
#define e3 52
#define g3 55
#define c4 60

void setup()
{
 Serial.begin(9600);
 synth.setMasterVolume(100);
}

void loop()
{
 byte i=0,n=0,z=0;

 for (n=0;n<=1;n++)
 {
   for(i=0;i<=127;i++)
   {
     synth.programChange(n*127,0, i);

     Serial.print("Bank: ");
     Serial.print(n,DEC);
     Serial.print(" Sound: ");
     Serial.println(i,DEC);

     z=random(0,12);

     synth.noteOn(0, c3+z, 107);
     delay(100);
     synth.noteOn(0, e3+z, 107);
     delay(100);
     synth.noteOn(0, g3+z, 107);
     delay(100);
     synth.noteOn(0, c4+z, 107);

     delay(200);
     synth.noteOff(0, c3+z);
     synth.noteOff(0, e3+z);
     synth.noteOff(0, g3+z);
     synth.noteOff(0, c4+z);
     delay(200);
   }
 }
}


Do I need Wprogram.h at all?
I used the code
Code: [Select]
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif

PaulS

Quote
Do I need Wprogram.h at all?

That depends on which version of the IDE you are using.

Trazman001

#2
Jan 11, 2013, 12:29 am Last Edit: Jan 11, 2013, 12:57 am by Trazman001 Reason: 1
It came with arduino 1.0.3

Where do I get a ide that will work?

Once arduino released 1.0 Wprogram.h was renamed as arduino.h.

PaulS

Quote
I am trying code like this to fix it.

I'm going to guess that the problem isn't your sketch, but one of the libraries has not been updated for 1.0+ use. If you posted the real error messages, we could probably help.

Trazman001

c:\arduino\arduino-1.0.3\libraries\Fluxamasynth/NewSoftSerial.h:7
0: error: conflicting return type specified for 'virual void
NewSoftSerial:write(uint8_t)'
C:\arduino\arduino-1.0.3\hardware\arduino\cores\arduino/Print.h:4
8: error:   overriding 'virual size_t Print::wite(uint8_t'
in file included from newtest2.ino:1:
C:\arduino\arduino-1.0.3\libraries\Fluxamasynth\Fluxamasynth.h:32
: error: 'byte' does not name a type

PaulS

NewSoftSerial is not appropriate for use with 1.0+. Change that to SoftwareSerial, instead.

Where did you get the fluxowhatever library?

Trazman001

#6
Jan 11, 2013, 01:50 am Last Edit: Jan 11, 2013, 02:28 am by Trazman001 Reason: 1
Code: [Select]
#include <SoftwareSerial.h>

#include <Fluxamasynth.h>

#include <PgmChange.h>

#include <fluxamasynth_nss.h>


#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#endif


Fluxamasynth synth;

#define byte uint8_t


C:\arduino\arduino-1.0.3\libraries\Fluxamasynth/Fluxamasynth.h:21
:22: error: WProgram.h: No such file or directory
in file included from
C:\arduino\arduino-1.0.3\libraries\Fluxamasynth/Fluxamasynth.h:22
,

conflicting return type specifed for 'virtual void
NewSoftSerial::write(uint8_t)'


I got the Fluxamasynth libraries from
http://wiki.moderndevice.com/pmwiki.php?n=MD.ListMethods
i couldn't get the libraries from github, no download link just printed.

Please help!  =( =( =( =( =( =(

PaulS

Quote
i couldn't get the libraries from github, no download link just printed.


I could. I don't like how they "upgraded" to 1.0+, but the latest version does compile on 1.0.1, at least.

Trazman001

Can you send me an link to the latest versions?  $)

PaulS

Quote
Can you send me an link to the latest versions?

You posted it, earlier. Scroll down on that page until you see Clone in Windows followed by ZIP. Pick ZIP.

Trazman001

#10
Jan 12, 2013, 01:33 am Last Edit: Jan 12, 2013, 07:21 am by Trazman001 Reason: 1
Problem solved, it compiled :) :) :) :) :) :) :) :) :)
And uploaded!!! :)
Thank you Paul! I feel so dumb. :P
Hey does anyone have code for fluxamasynth to make it an instrument? I need to know where to start. :smiley-mr-green:

Go Up