Skip to content

Commit fe4c70a

Browse files
* Fix sample value wraparound at high output level
- +32768 would wrap to -32768 * Use UpdatePercentageProperty for output level - Supports modifier keys and range limit
1 parent 73e2602 commit fe4c70a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

synth.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ DWORD CALLBACK WriteStream(HSTREAM handle, short *buffer, DWORD length, void *us
205205

206206
// left and right channels are the same
207207
//short output = (short)Clamp(int(sample * output_scale * 32768), SHRT_MIN, SHRT_MAX);
208-
short output = (short)(FastTanh(sample * output_scale) * 32768);
208+
short output = (short)(FastTanh(sample * output_scale) * 32767);
209209
*buffer++ = output;
210210
*buffer++ = output;
211211
}
@@ -396,12 +396,12 @@ void __cdecl main(int argc, char **argv)
396396
}
397397
else if (code == VK_OEM_MINUS || code == VK_SUBTRACT)
398398
{
399-
output_scale -= 1.0f / 16.0f;
399+
Menu::UpdatePercentageProperty(output_scale, -1, modifiers, 0, 4);
400400
PrintOutputScale(hOut);
401401
}
402402
else if (code == VK_OEM_PLUS || code == VK_ADD)
403403
{
404-
output_scale += 1.0f / 16.0f;
404+
Menu::UpdatePercentageProperty(output_scale, +1, modifiers, 0, 4);
405405
PrintOutputScale(hOut);
406406
}
407407
else if (code == VK_OEM_4) // '['

0 commit comments

Comments
 (0)