Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Mozzi example file can't be compiled #53

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

Mozzi example file can't be compiled #53

slevirus opened this issue Dec 16, 2012 · 5 comments

Comments

@slevirus
Copy link

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
Copy link
Author

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

@nkrkv
Copy link
Member

nkrkv commented Dec 16, 2012

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

@Tudeskie
Copy link

Tudeskie commented May 9, 2013

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.

@nkrkv
Copy link
Member

nkrkv commented Sep 24, 2013

Fixed in 0.3.6

@nkrkv nkrkv closed this as completed Sep 24, 2013
@kellertobias
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants