diff --git a/examples/curlywas/tim_ges.cwa b/examples/curlywas/tim_ges.cwa index 77eb363..e532074 100644 --- a/examples/curlywas/tim_ges.cwa +++ b/examples/curlywas/tim_ges.cwa @@ -16,7 +16,7 @@ fn melody(ch: i32, t: i32, T: i32) { export fn upd() { let lazy t = 32!32 / (1000/60); - let lazy T = t / 8; + let lazy T = t / 7; melody(98, t, T - 3); melody(92, t, T); @@ -36,10 +36,10 @@ export fn upd() { data 80 { i8( - 0, 128, 0, 128, 0x40, 0xe, + 0, 64, 0, 128, 0x40, 0xe, 0, 128, 0, 128, 0x8, 0xc8, - 0, 128, 0, 128, 0xa, 0xa, - 0, 128, 0, 128, 0xa, 0xa, + 0, 32, 0, 128, 0xa, 0xa, + 0, 64, 0, 128, 0xa, 0xa, 0xf8, 0x85, 0xc1, 0xf1, 0, 110, 0, 90 ) diff --git a/platform/bin/platform.uw8 b/platform/bin/platform.uw8 index c77b12e..9276f19 100644 Binary files a/platform/bin/platform.uw8 and b/platform/bin/platform.uw8 differ diff --git a/platform/src/ges.cwa b/platform/src/ges.cwa index ad75ae8..99ade94 100644 --- a/platform/src/ges.cwa +++ b/platform/src/ges.cwa @@ -63,6 +63,9 @@ export fn gesSnd(t: i32) -> f32 { let phase = i32.load16_u(channelState, GesChannelState.Phase) << 8; + let inline pulseWidth = channelReg?1; + let phaseShift = (pulseWidth - 128) * 255; + i = 0; let wave = ctrl >> 6; if wave < 2 { @@ -76,7 +79,8 @@ export fn gesSnd(t: i32) -> f32 { else { loop rectLoop { - i!(GesBufferOffset + 128*4) = select(phase & 32768, -32768, 32767); + let p = (phase & 65535) + phaseShift; + i!(GesBufferOffset + 128*4) = select(p >= 32768, -32768, 32767); phase = phase + phaseInc; branch_if (i := i + 4) < 64*4: rectLoop; } diff --git a/src/run-web.html b/src/run-web.html index c690081..7631b88 100644 --- a/src/run-web.html +++ b/src/run-web.html @@ -1 +1 @@ -