diff --git a/README.md b/README.md
index cbb44c1..f3a8787 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,11 @@
ChangeLog
````
+== 2024-10-29
+ * Enhancement:
+ * TR707 - dynamic level/pan params in io-page/mixer section #29
+ * Bugfix:
+ * setPixel missing (scope app not working) #99
== 2024-10-28
* Enhancement:
* Mod/SEQ - 4-step sequencer modulation #91
diff --git a/app/DRUMS/TR707.bin b/app/DRUMS/TR707.bin
index 366a5fe..e493825 100644
Binary files a/app/DRUMS/TR707.bin and b/app/DRUMS/TR707.bin differ
diff --git a/app/DRUMS/TR707.cpp b/app/DRUMS/TR707.cpp
index dac4991..4fb0151 100644
--- a/app/DRUMS/TR707.cpp
+++ b/app/DRUMS/TR707.cpp
@@ -23,6 +23,9 @@ void engine::setup()
auto IC34_TR707_SNDROM_bin = machine::fs_read("707_IC34");
auto IC35_TR707_SNDROM_bin = machine::fs_read("707_IC35");
+ if(IC34_TR707_SNDROM_bin == nullptr || IC35_TR707_SNDROM_bin == nullptr )
+ return;
+
auto BD0 = &IC34_TR707_SNDROM_bin[0x0000];
auto BD1 = &IC34_TR707_SNDROM_bin[0x0001];
auto SD0 = &IC34_TR707_SNDROM_bin[0x2000];
@@ -64,8 +67,13 @@ void engine::setup()
void engine::process()
{
+ if(sample_ptr[0] == nullptr)
+ return;
+
auto outputL = engine::outputBuffer<0>();
memset(outputL, 0, sizeof(float) * FRAME_BUFFER_SIZE);
+ auto outputR = engine::outputBuffer<1>();
+ memset(outputR, 0, sizeof(float) * FRAME_BUFFER_SIZE);
for (uint32_t i = 0; i < LEN_OF(sample_ptr); i++)
{
@@ -86,14 +94,24 @@ void engine::process()
_midi_trigs &= ~(1 << i);
}
-
- dsp_process_sample(sample_ptr[i], _start, _end, -2.f + (_pitch * 4), outputL);
+ float tmp[FRAME_BUFFER_SIZE] = {};
+ dsp_process_sample(sample_ptr[i], _start, _end, -2.f + (_pitch * 4), tmp);
+ float levelL = engine::mixLevelL(i);
+ float levelR = engine::mixLevelR(i);
+ for(size_t i = 0; i < FRAME_BUFFER_SIZE; i++)
+ {
+ outputL[i] += tmp[i] * levelL;
+ outputR[i] += tmp[i] * levelR;
+ }
}
}
void engine::draw()
{
- gfx::drawSample(sample_ptr[_select]);
+ if(sample_ptr[0] == nullptr)
+ gfx::drawString(20, 20, "ROMS NOT FOUND\n \n 707_IC34\n 707_IC35");
+ else
+ gfx::drawSample(sample_ptr[_select]);
}
void engine::onMidiNote(uint8_t key, uint8_t velocity) // NoteOff: velocity == 0
diff --git a/app/squares-and-circles-api.h b/app/squares-and-circles-api.h
index fceaffc..9c42d15 100644
--- a/app/squares-and-circles-api.h
+++ b/app/squares-and-circles-api.h
@@ -34,6 +34,7 @@
#include
#include
#include
+#include
#define V_OCT "V_OCT"
#define V_QTZ "V_QTZ"
@@ -110,6 +111,9 @@ EXTERN_C
extern int16_t *__output_l_i16p;
extern int16_t *__output_r_i16p;
+ extern uint8_t *__mixer_level;
+ extern uint8_t *__mixer_pan;
+
extern float **__audio_in_l_fpp;
extern float **__audio_in_r_fpp;
@@ -213,6 +217,10 @@ namespace engine
template <>
inline float *inputBuffer<1>() { return *__audio_in_r_fpp; }
+ inline float mixLevel(int ch) { return ((4.f / UINT16_MAX) * __mixer_level[ch]) * __mixer_level[ch]; } // exp range 0 - 4
+ inline float mixLevelL(int ch) { return cosf((float)__mixer_pan[ch] / 255.f * (float)M_PI_2) * mixLevel(ch); }
+ inline float mixLevelR(int ch) { return sinf((float)__mixer_pan[ch] / 255.f * (float)M_PI_2) * mixLevel(ch); }
+
EXTERN_C void setup();
EXTERN_C void process();
EXTERN_C void draw();
diff --git a/platformio.ini b/platformio.ini
index eafc9ba..a51078a 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -10,6 +10,6 @@
[env:squares-and-circles]
apps_json = ./app/index.json
extra_scripts = build.py
-squares_and_circles_loader = a2a6378 ; minimum loader version
+squares_and_circles_loader = 8f20be2 ; minimum loader version
platform = teensy@5.0.0 ; https://github.com/platformio/platform-teensy/releases
board = teensy41 ; fake setting - the engines are compatibe with all targets