Mozzi example file can't be compiled #53

Closed
slevirus opened this Issue Dec 16, 2012 · 5 comments

Projects

None yet

4 participants

@slevirus

I try to use Mozzy librairies. https://github.com/sensorium/Mozzi
Mozzy librairies have some example sketch.
Some example work fine.
This example don't work : https://github.com/sensorium/Mozzi/tree/master/examples/_02b_FMsynth
When i try with arduino(java) software i can build and upload with no issue
with ino i have:

Scanning dependencies of Mozzi
src/_02b_FMsynth.cpp
.build/uno/src/_02b_FMsynth.cpp:3:15: error: variable or field 'setFreqs' declared void
.build/uno/src/_02b_FMsynth.cpp:3:15: error: 'Q8n8' was not declared in this scope
make: *** [.build/uno/src/_02b_FMsynth.o] Erreur 1
Make failed with code 2

I will investigate but not now !
Thank

@slevirus

With more investigation, the issue come from preproc part of process. the header of output file is generate before all include previously declared in sketch file.
With arduino java

#include <MozziGuts.h>
#include <Oscil.h>
#include <tables/cos2048_int8.h> // table for Oscils to play
#include <utils.h>
#include <fixedMath.h>
#include <EventDelay.h>
#include <Smooth.h>

#define CONTROL_RATE 256 // powers of 2 please

#include "Arduino.h"
void setup();
void setFreqs(Q8n8 midi_note);
void updateControl();
int updateAudio();
void loop();

And with ino env we have:

#include <Arduino.h>
void setup();
void setFreqs(Q8n8 midi_note);
void updateControl();
int updateAudio();
void loop();
#line 1 "src/_02b_FMsynth.ino"
[...]
#include <MozziGuts.h>
#include <Oscil.h>
#include <tables/cos2048_int8.h> // table for Oscils to play
#include <utils.h>
#include <fixedMath.h>
#include <EventDelay.h>
#include <Smooth.h>

#define CONTROL_RATE 256 // powers of 2 please

It's an important issue because we can't compile a lot of sketch correctly I think

@nailxx
Amperka member

Thanks for the investigation. Yes, it's a known bug that will be fixed soon.

@Tudeskie

I had a very similar problem and have a work around. Not sure why it does it.
if you go into ".build/atmega328/src/sketch.spp" move all the includes above the functions, then go back to the project root and rebuild everything works.

Not sure why INO mixes them while it is putting everything together.

@nailxx
Amperka member

Fixed in 0.3.6

@nailxx nailxx closed this Sep 24, 2013
@kellertobi91

Issue #55 isn't the same or this issue isn't fixed, too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment