I’m using the ardvoice library by @igvina and it’s been going well but in a different part of the game I’d like to use the playtune library for some music.
The problem is if you call playVoice before you call playTune, then playTune won’t work. If you call playTune first, it will work until you call playVoice.
It seems that something in the playVoice function is not releasing, overwriting or otherwise messing with the initialization (timers I’m assuming), needed by playTune.
PlayTune.ino-arduboy.hex (30.2 KB)
Press A for voice and B for tune
I’ve already tried all different combinations of stopVoice and stopTune and all that, but doesn’t seem to work. Here is some example code that illustrates the problem:
#include <Arduboy2.h>
#include <ArdVoice.h>
#include <ArduboyPlaytune.h>
#include "sounds.h"
Arduboy2 arduboy;
ArdVoice ardvoice;
ArduboyPlaytune tunes(arduboy.audio.enabled);
void setup()
{
arduboy.begin();
tunes.initChannel(PIN_SPEAKER_1);
tunes.initChannel(PIN_SPEAKER_2);
}
void loop()
{
if (arduboy.pressed(A_BUTTON) ) {
ardvoice.playVoice(voice);
}
if ( arduboy.pressed(B_BUTTON)) {
tunes.playScore(score);
}
}
This is pretty deep into the library for me to understand, but any help would be appreciated, it’s kind of the last thing I need to finish my latest game!