Skip to content

Commit

Permalink
devsyncv 8f20be2 #99 #29
Browse files Browse the repository at this point in the history
  • Loading branch information
eh2k committed Oct 29, 2024
1 parent 291cebc commit 432cb0f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<summary><b>ChangeLog</b></summary>

````
== 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
Expand Down
Binary file modified app/DRUMS/TR707.bin
Binary file not shown.
24 changes: 21 additions & 3 deletions app/DRUMS/TR707.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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++)
{
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions app/squares-and-circles-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

#define V_OCT "V_OCT"
#define V_QTZ "V_QTZ"
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [email protected] ; https://github.com/platformio/platform-teensy/releases
board = teensy41 ; fake setting - the engines are compatibe with all targets

0 comments on commit 432cb0f

Please sign in to comment.