We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b221e13 commit 1488bf0Copy full SHA for 1488bf0
audio_jack.c
@@ -88,12 +88,7 @@ soxr_io_spec_t io_spec;
88
#endif
89
90
static inline sample_t sample_conv(short sample) {
91
- // It sounds correct, but I don't understand it.
92
- // Zero int needs to be zero float. Check.
93
- // Plus 32767 int is 1.0. Check.
94
- // Minus 32767 int is -0.99997. And here my brain shuts down.
95
- // In my head, it should be 1.0, and we should tolerate an overflow
96
- // at minus 32768. But I'm sure there's a textbook explanation somewhere.
+ // signed 16-bit int to float
97
return ((sample < 0) ? (-1.0 * sample / SHRT_MIN) : (1.0 * sample / SHRT_MAX));
98
}
99
0 commit comments