From 432cb0faa29e6768de81674868fd78eabe472af5 Mon Sep 17 00:00:00 2001 From: eh2k Date: Tue, 29 Oct 2024 20:13:03 +0100 Subject: [PATCH] devsyncv 8f20be2 #99 #29 --- README.md | 5 +++++ app/DRUMS/TR707.bin | Bin 3012 -> 3480 bytes app/DRUMS/TR707.cpp | 24 +++++++++++++++++++++--- app/squares-and-circles-api.h | 8 ++++++++ platformio.ini | 2 +- 5 files changed, 35 insertions(+), 4 deletions(-) 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 366a5fe396cfac1f007d6b6c9b4b608adc43db67..e493825bf394842d6b06cbdba3a693b62dbef3aa 100644 GIT binary patch literal 3480 zcma))1*|b6sG-=t$#%8G=(O$FoX|rAF0rH`S)x zRJ#FCZK^@FsfGlo2Gyn-RC_0&+IB#-n*i1RE}+_v0;;_WP|jxX82DJwQn5<{^Spr@ z@i%A#^qC)xcc(yc#qFF0ACWBndaTZ)y?$~R}488>A{4) z$910T1w6Q6F~5u#xE|x0;yS_gEw1Oe{+{b6TtDUd8P}U!1zkSBf$L_jTe#M9-Nn_( zwY8(Wt@Dwtj$O80%LkX`x7W2OVXD}29d4q?8;e=Q9hXVt_7&?d6b_HVoAG2sI z(i@D&Sv;5+iXti+3$CW}2E&0n`r-+HEP>uT!fxv*#1v{We<0xT$NYodkbUQ>(+8(7 z?u`Zg0Tzfyy>b6wbRg&*YDW5CxIYvQVm^^*9ByPN5gkf+2fTezHW(blbXPlL)amsm zVxfL54PO&ahmpb1a4_bL`opX@67MT^3}A}}SUeQ&%U2I33NwgC;*7SZQ=3rUMEY>Q zc5PvE@w_e?m4i8*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%ss0OeDXMVjJv07|0!&7nSq^JT<2aOl-Dk94EayeOF^IFK2i1-|7Rk= z3ZZm$Xy;zby@`7>_cPpS?l-s(a_6`|;6BeiCYx=X~wKdrj zhe)JwH=+Fq9ZI{lGlpbP#JT zD&;emX^dH`n~j@0RK;9WC(l55ZsmY38}lW1Yx)-X(#$#k-2CTs+%?WfbxX^gdv95n z{$E{OmyC}jcWTpr@`0a=^65S@b{tMTsx$9!RGfTGrd$0Lr5ltp=`_BWsy$h&>&G$U zRf#fwpOc}+O7BG)imoYj`&Zo9C07JzqpNt-ufffCOC45(4i{XC8gpyR6EJOU9?TP> z*a?>D`wA8XXW^?wP>h^hSL+&zF45mD?}9kp&nS`$G|`^%v)sh2MulxxO5D3T)JD&# zrxPzs94`0{T`Kqn&;z^k(FSn(v`oMo@=;FK8}xNhUY7~^E|W#UP^KTSLZkCX+))n| z7AuLwRIy#j1jfxBs%ye#8AZQUfSunKm_qT5rZ^7_6gg(A1>V1QWHFb1z%ho6~Fp=w%NGZ1I)-5I~-HR1U6-Z z)MDIB!c;M+P=5I!pZp@^M}8Ccj$EGF2WQ8=>|E{fc-rVQT}hvFKh1FLKCoGdMS{C)#18^2Y@bc*qWfg1OgVWcM{m22N^;dXM`0$cxw_h}2zwqge zt5>cY$x4TCtt{zpTCqLGw#phoxj_r#c;#9(gSGDz~^LvY|3(`{bW8|hf%Sxy^# Ke!sD(YQsPD=A|Y8 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