Fix compile issue with ParameterAutomation. Make the OLED in Mulverse_BasicDemo optional.

master
Steve Lascos 2 days ago
parent 4478a4db48
commit 06c50ba38f
  1. 9
      README.md
  2. 23
      examples/Tests/Multiverse_BasicDemo/Multiverse_BasicDemo.ino
  3. 25
      examples/Tests/Multiverse_BasicDemo/PhysicalControls.cpp
  4. 2
      examples/Tests/Multiverse_BasicDemo/PhysicalControls.h
  5. 6
      src/common/ParameterAutomation.cpp

@ -1,9 +1,9 @@
## BALibrary
This library is under active development as of 2023.
This library was lasted tested and updated in Feb. 2025.
Last tested with:
Arduino IDE: v2.0.4
Teensyduino: v1.57
Arduino IDE: v2.3.4
Teensyduino: v1.59
*TGA PRO MKII by Blackaddr Audio*
![](TGA_Pro_MKII_rev1.jpg)
@ -37,7 +37,8 @@ The audio primitives and effects provided in the BALibrary library require no sp
This library was originally designed as a companion to the TGA Pro series of hardware boards. These boards expand Teensy by adding the necessary analog audio, preamp and MIDI circuitry needed to make guitar effects, MIDI synths, etc.
*** Aviate Audio Multiverse ***
This library also supports the Aviate Audio Multiverse (based upon the Teensy MicroMod) which means in addition to the amazing guitar effects ecosystem it provides, you can also program it yourself just like any other Teensy! So, this library also includes pinout support this device. A simple demo is provided that exercises all the hardware features of this platform. See examples/Tests/Multiverse_BasicDemo.
This library also supports the Aviate Audio Multiverse (based upon the Teensy MicroMod) which means in addition to the amazing guitar effects ecosystem it provides, you can also program it yourself just like any other Teensy! So, this library also includes pinout support this device. A simple demo is provided that exercises all the hardware features of this platform. See examples/Tests/Multiverse_BasicDemo. Please note this demo requires the installation of a few additional
libraries. See the demo source code for more details.
**BALibrary CONTENTS**
- WM871 advanced codec control

@ -13,10 +13,14 @@
* REQUIREMENTS:
* This demo for Multiverse uses its OLED display which requires several Arduino
* libraries be downloaded first. The SH1106 library is modifed to work with Teensy
* and must be downloaded from the AviateAudio github.
* and must be downloaded from the AviateAudio github link below.
*
* Adafruit_BusIO : https://github.com/adafruit/Adafruit_BusIO
* Adafruit_GFX_Library : https://github.com/adafruit/Adafruit-GFX-Library
* If you do not wish to use the OLED display, or run into difficulties you can
* comment out the #define USE_OLED line in PhysicalControls.h to avoid the need for
* the Adafruit/Aviate dependencies.
*
* Adafruit_BusIO : https://github.com/adafruit/Adafruit_BusIO (tested with v1.17)
* Adafruit_GFX_Library : https://github.com/adafruit/Adafruit-GFX-Library (tested with v1.11.11)
* Adafruit_SH1106 : https://github.com/AviateAudio/Adafruit_SH1106
*
*
@ -37,12 +41,14 @@
using namespace BALibrary;
// OLED display stuff
#ifdef USE_OLED
#include "Adafruit_SH1106.h"
#include "Adafruit_GFX.h"
#include "Fonts/FreeSansBold9pt7b.h"
constexpr unsigned SCREEN_WIDTH = 128; // OLED display width, in pixels
constexpr unsigned SCREEN_HEIGHT = 64; // OLED display height, in pixels
Adafruit_SH1106 display(37, 35, 10);
#endif // USE_OLED
// External SPI RAM
ExternalSramManager sramManager;
@ -75,12 +81,15 @@ unsigned loopCounter = 0;
void drawProgressBar(float completion); // declaration
#ifdef USE_OLED
void drawBlackaddrAudio() {
display.setCursor(0, 24); // (x,y)
display.printf(" Blackaddr");
display.setCursor(0, 40); // (x,y)
display.printf(" Audio");
}
#endif
void setup() {
@ -97,6 +106,7 @@ void setup() {
MULTIVERSE_REV1(); // constants defined in BALibrary become valid only after this call
SPI_MEM1_64M(); // Declare the correct memory size
#ifdef USE_OLED
// Init the display
display.begin(SH1106_SWITCHCAPVCC, SH1106_I2C_ADDRESS, true);
display.clearDisplay();
@ -105,6 +115,7 @@ void setup() {
display.setFont(&FreeSansBold9pt7b);
drawBlackaddrAudio();
display.display();
#endif
configPhysicalControls(&controls, &codec);
@ -163,16 +174,19 @@ void loop() {
// Adjusting one of the knobs/switches will result in its value being display for
// 2 seconds in the check*() functions.
if (timer > 2000) {
loopCounter++;
loopCounter++;
#ifdef USE_OLED
display.clearDisplay();
drawBlackaddrAudio();
drawSramProgress(sramCompletion);
display.display();
#endif
}
}
// This function will draw on the display which stage the memory test is in, and
// the percentage complete for that stage.
#ifdef USE_OLED
void drawSramProgress(float completion)
{
if (errorCount > 0) { // If errors, print the error count
@ -194,6 +208,7 @@ void drawSramProgress(float completion)
display.setCursor(SCREEN_WIDTH*0.63f, SCREEN_HEIGHT-1); // position to lower right corner
display.printf("%0.f%%", 100.0f * completion);
}
#endif
// Create a predictable data pattern based on address.
constexpr int mask0 = 0x5555;

@ -2,11 +2,14 @@
#include "Adafruit_SH1106.h"
#include "BALibrary.h"
#include "DebugPrintf.h"
#include "PhysicalControls.h"
using namespace BALibrary;
// Declare the externally shared variables from the main .ino
#ifdef USE_OLED
extern Adafruit_SH1106 display;
#endif
extern BAAudioControlWM8731master codec;
extern AudioMixer4 volumeOut;
extern elapsedMillis timer;
@ -90,12 +93,16 @@ void checkPot(unsigned id)
DEBUG_PRINT(Serial.println(String("POT") + id + String(" value: ") + potValue));
timer = 0;
#ifdef USE_OLED
display.clearDisplay();
display.setCursor(0,displayRow);
#endif
switch(id) {
case 0 :
{
display.printf("Gain: %0.f\n", potValue * 100.0f);
#ifdef USE_OLED
display.printf("Gain: %0.f\n", potValue * 100.0f);
#endif
int gain = static_cast<int>(std::roundf(31.0f * potValue));
codecPtr->setLeftInputGain(gain);
codecPtr->setRightInputGain(gain);
@ -104,20 +111,26 @@ void checkPot(unsigned id)
}
case 1 :
{
#ifdef USE_OLED
display.printf("Level: %0.f\n", potValue * 100.0f);
#endif
volumeOut.gain(0, potValue);
volumeOut.gain(1, potValue);
break;
}
#ifdef USE_OLED
case 2 : display.printf("Exp T: %0.f\n", potValue * 100.0f); break;
case 3 : display.printf("Exp R: %0.f\n", potValue * 100.0f); break;
#endif
}
display.display();
#ifdef USE_OLED
display.display();
#endif
}
}
int checkSwitch(unsigned id, bool getValueOnly=false)
int checkSwitch(unsigned id, bool getValueOnly)
{
unsigned swHandle = -1;
unsigned ledHandle = -1;
@ -159,6 +172,7 @@ int checkSwitch(unsigned id, bool getValueOnly=false)
if (changed) {
DEBUG_PRINT(Serial.println(String("Button ") + id + String(" pressed")));
timer = 0;
#ifdef USE_OLED
display.clearDisplay();
display.setCursor(0, displayRow);
switch(id) {
@ -170,6 +184,7 @@ int checkSwitch(unsigned id, bool getValueOnly=false)
case 5 : display.printf("EncSw D: %d\n", switchValue); break;
}
display.display();
#endif // USE_OLED
}
if (swHandle < 2) { // these SWs map to LEDs
@ -207,7 +222,8 @@ void checkEncoder(unsigned id)
int adj= controlPtr->getRotaryAdjustUnit(encHandle);
if (adj != 0) {
DEBUG_PRINT(Serial.printf("Enc %d: %d\n\r", id, adj); Serial.flush());
DEBUG_PRINT(Serial.printf("Enc %d: %d\n\r", id, adj); Serial.flush());
#ifdef USE_OLED
display.clearDisplay();
display.setCursor(0, displayRow);
switch(id) {
@ -217,6 +233,7 @@ void checkEncoder(unsigned id)
case 3 : enc4 += adj; display.printf("Enc D: %d", enc4); break;
}
display.display();
#endif // USE_OLED
timer = 0;
}
}

@ -3,6 +3,8 @@
#include "BALibrary.h"
#define USE_OLED // Comment this line if you don't want to use the OLED or it's dependencies.
void configPhysicalControls(BALibrary::BAPhysicalControls* controls, BALibrary::BAAudioControlWM8731master* codec);
void checkPot(unsigned id);
int checkSwitch(unsigned id, bool getValueOnly=false);

@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cmath>
#include "LibBasicFunctions.h"
namespace BALibrary {
@ -71,7 +71,7 @@ void ParameterAutomation<T>::reconfigure(T startValue, T endValue, size_t durati
float duration = m_duration / static_cast<float>(AUDIO_BLOCK_SAMPLES);
m_slopeX = (1.0f / static_cast<float>(duration));
m_scaleY = abs(endValue - startValue);
m_scaleY = std::abs(endValue - startValue);
if (endValue >= startValue) {
// value is increasing
m_positiveSlope = true;
@ -143,7 +143,6 @@ T ParameterAutomation<T>::getNextValue()
// Template instantiation
template class ParameterAutomation<float>;
template class ParameterAutomation<int>;
template class ParameterAutomation<unsigned>;
///////////////////////////////////////////////////////////////////////////////
// ParameterAutomationSequence
@ -236,6 +235,5 @@ bool ParameterAutomationSequence<T>::isFinished()
// Template instantiation
template class ParameterAutomationSequence<float>;
template class ParameterAutomationSequence<int>;
template class ParameterAutomationSequence<unsigned>;
}

Loading…
Cancel
Save