From fb819dd966ca55738d2de01fc541e42351b47f22 Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Thu, 4 Mar 2021 01:11:59 +0100 Subject: [PATCH] new version --- bsv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bsv.c b/bsv.c index ed30e94..6a8deeb 100644 --- a/bsv.c +++ b/bsv.c @@ -11,7 +11,8 @@ u8 g(u8 x, u8 t, u8 o){ u8 notes_ix = t & 0x7; if(3&i2) notes_ix += 8; - u8 result = ((i1<<8|i0)*notes[notes_ix])>>o; + u8 result = ((i1<<8|i0)*notes[notes_ix])>>8; // keep hi byte + result >>= o; result &= x; result &= 3; return result; @@ -23,19 +24,19 @@ void main(void){ u8 n = i2<<2 | i1>>6; u8 s = i2>>1; - sample = g(1,n,12); + sample = g(1,n,4); { u8 tmp; tmp = i2<<3 | i1>>5; tmp ^= n; - sample += g(s,tmp,10); + sample += g(s,tmp,2); } //tmp { u8 tmp1 = s/3; u8 tmp2; tmp2 = (i2<<5|i1>>3)%3; tmp2 += n; - sample += g(tmp1,tmp2,10); + sample += g(tmp1,tmp2,2); } //tmp1, tmp2 { u8 tmp1 = s/5; @@ -44,7 +45,7 @@ void main(void){ tmp2 -= tmp3; } // tmp3 tmp2 += 8; - sample += g(tmp1,tmp2,9); + sample += g(tmp1,tmp2,1); } //tmp1, tmp2 putchar(sample<<4); -- 2.39.3