mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +11:00
If volume is 0, don't actually play anything
This commit is contained in:
parent
6ebe08e528
commit
8009ffea09
|
@ -446,26 +446,28 @@ impl MixerBuffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if channel.is_stereo {
|
if channel.volume != 0.into() {
|
||||||
unsafe {
|
if channel.is_stereo {
|
||||||
agb_rs__mixer_add_stereo(
|
unsafe {
|
||||||
channel.data.as_ptr().add(channel.pos.floor()),
|
agb_rs__mixer_add_stereo(
|
||||||
self.working_buffer.as_mut_ptr(),
|
channel.data.as_ptr().add(channel.pos.floor()),
|
||||||
channel.volume,
|
self.working_buffer.as_mut_ptr(),
|
||||||
);
|
channel.volume,
|
||||||
}
|
);
|
||||||
} else {
|
}
|
||||||
let right_amount = ((channel.panning + 1) / 2) * channel.volume;
|
} else {
|
||||||
let left_amount = ((-channel.panning + 1) / 2) * channel.volume;
|
let right_amount = ((channel.panning + 1) / 2) * channel.volume;
|
||||||
|
let left_amount = ((-channel.panning + 1) / 2) * channel.volume;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
agb_rs__mixer_add(
|
agb_rs__mixer_add(
|
||||||
channel.data.as_ptr().add(channel.pos.floor()),
|
channel.data.as_ptr().add(channel.pos.floor()),
|
||||||
self.working_buffer.as_mut_ptr(),
|
self.working_buffer.as_mut_ptr(),
|
||||||
playback_speed,
|
playback_speed,
|
||||||
left_amount,
|
left_amount,
|
||||||
right_amount,
|
right_amount,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue