sensorium / Mozzi

sound synthesis library for Arduino
https://sensorium.github.io/Mozzi/
GNU Lesser General Public License v2.1
1.07k stars 186 forks source link

04.Audio_Input error 'AUDIO_INPUT_PIN' was not declared in this scope #268

Closed justinjools22 closed 1 month ago

justinjools22 commented 1 month ago

Hi, I tried to compile this code as is and get error - other sketches under 04.AudioInput the same. I am using Windows 11 Mozzi@2.0.0 STM32F4 and Arduino Nano boards same error.

In file included from c:\Users\m\Documents\Arduino\libraries\Mozzi/MozziGuts.h:205, from c:\Users\m\Documents\Arduino\libraries\Mozzi/Mozzi.h:33, from C:\Users\m\AppData\Local\Temp.arduinoIDE-unsaved2024626-3808-2cxc72.nn99x\Audio_Input\Audio_Input.ino:29: c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts.hpp: In function 'void MozziPrivate::advanceADCStep()': c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts.hpp:175:43: error: 'AUDIO_INPUT_PIN' was not declared in this scope; did you mean 'MOZZI_AUDIO_INPUT_PIN'? 175 | adcStartConversion(adcPinToChannelNum(AUDIO_INPUT_PIN)); // -> result is ignored, but first thing in the next cycle, a second reading is taken. | ^~~~~~~ | MOZZI_AUDIO_INPUT_PIN

exit status 1

Compilation error: exit status 1

https://github.com/sensorium/Mozzi/blob/master/examples/04.Audio_Input/Audio_Input/Audio_Input.ino

justinjools22 commented 1 month ago

I looked in Mozziguts.hpp from the error at 175. The sketches need to change:

define MOZZI_AUDIO_INPUT_PIN 0 to

define AUDIO_INPUT_PIN 0

adcStartConversion(adcPinToChannelNum(AUDIO_INPUT_PIN));  // -> result is ignored, but first thing in the next cycle, a second reading is taken.
break;
tomcombriat commented 1 month ago

Or the other way around?

This comes from the changes to Mozzi2, trying to make internal variables less likely to conflict. Please don't hesitate submit a PR if you solved it :)

tfry-git commented 1 month ago

@tomcombriat You fixed that one a month ago, yourself: https://github.com/sensorium/Mozzi/commit/fdd36681c08e2f5306fa8a2cb1080198904df58a

Perhaps we should have a quick bugfix release?

tomcombriat commented 1 month ago

Ah... Aging.... And I thought it rang a bell when I saw it.

Yes, maybe we should..

justinjools22 commented 1 month ago

Or the other way around?

This comes from the changes to Mozzi2, trying to make internal variables less likely to conflict. Please don't hesitate submit a PR if you solved it :)

Yes, I guess your naming intention is MOZZI_AUDIO_INPUT_PIN. Because it is incorrectly named AUDIO_INPUT_PIN works.

tfry-git commented 1 month ago

Yes, maybe we should..

You are more experienced in this step. Could you take a look at my draft: https://github.com/sensorium/Mozzi/releases/tag/untagged-64bc2f81715cb7b13227 . Anything else missing?

tomcombriat commented 1 month ago

Could you take a look at my draft: https://github.com/sensorium/Mozzi/releases/tag/untagged-64bc2f81715cb7b13227 . Anything else missing?

Looks good to me! I will publish it.

tomcombriat commented 1 month ago

Closing. Fixed by #260