Skip to content

Commit 310d816

Browse files
authored
Merge pull request #11191 from relic-se/synthio-note-panning-fix
Fix implementation of `synthio.Note.panning`
2 parents 2bb088e + dfa5515 commit 310d816

3 files changed

Lines changed: 16141 additions & 5 deletions

File tree

shared-module/synthio/Note.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,11 @@ static uint32_t pitch_bend(uint32_t frequency_scaled, int32_t bend_value) {
196196

197197
uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, int16_t loudness[2]) {
198198
int panning = synthio_block_slot_get_scaled(&self->panning, -ALMOST_ONE, ALMOST_ONE);
199-
int left_panning_scaled, right_panning_scaled;
199+
int left_panning_scaled = 32768, right_panning_scaled = 32768;
200200
if (panning >= 0) {
201-
left_panning_scaled = 32768;
202-
right_panning_scaled = 32767 - panning;
201+
left_panning_scaled = 32767 - panning;
203202
} else {
204-
right_panning_scaled = 32768;
205-
left_panning_scaled = 32767 + panning;
203+
right_panning_scaled = 32767 + panning;
206204
}
207205

208206
int amplitude = synthio_block_slot_get_scaled(&self->amplitude, -ALMOST_ONE, ALMOST_ONE);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from synthnotehelper import *
2+
3+
4+
@synth_test(channel_count=2)
5+
def gen(synth):
6+
l = LFO(sine, offset=0.0, scale=1.0, rate=2)
7+
yield [l]
8+
n = Note(8, panning=l)
9+
synth.press(n)
10+
yield 2

0 commit comments

Comments
 (0)