cursed additions

This commit is contained in:
sigil-03 2025-08-16 21:40:14 -06:00
parent c8d33b3c41
commit ba25b7c89f

View file

@ -169,6 +169,10 @@ impl<'a> DpcmDecoder<'a> {
// output the next sample's amplitude
pub fn output_next(&mut self) -> usize {
if let Some(data) = self.data {
if (self.index >= data.len() * 2) {
return 0;
}
let sub_index = 1 - self.index % 2;
let sample = DpcmSample::new(data[self.index / 2], sub_index);
@ -188,11 +192,11 @@ impl<'a> DpcmDecoder<'a> {
self.index = self.index + 1;
// reset the index to 0 if we roll over
if (self.index >= data.len() * 2) {
self.index = 0;
self.prev_amplitude = 0x74;
samples_remaining = false;
}
// if (self.index >= data.len() * 2) {
// self.index = 0;
// self.prev_amplitude = 0x74;
// samples_remaining = false;
// }
// return the normalized amplitude
return normalized_amplitude;