mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Fix volume zero and power of 2 (#375)
Fixes #371. If the volume was zero, the calculation for leading zeros was incorrect. So both reduce the amount of work done for 0 volume and also count the leading zeros correctly in the fast path. - [x] Changelog updated / no changelog update needed
This commit is contained in:
commit
43aebe4092
|
@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
- Text renderer can now be re-used which is useful for rpg style character/word at a time text boxes.
|
||||
|
||||
### Fixed
|
||||
- Zero volume now plays no sound.
|
||||
- Fixed issue where volume was incorrect for volumes which were powers of 2.
|
||||
|
||||
## [0.12.2] - 2022/10/22
|
||||
|
||||
This is a minor release to fix an alignment issue with background tiles.
|
||||
|
|
|
@ -64,6 +64,8 @@ same_modification:
|
|||
lsrs r7, r7, #1
|
||||
bne 1b
|
||||
|
||||
sub r3, r3, #1
|
||||
|
||||
mov r5, #0 @ current index we're reading from
|
||||
ldr r8, =agb_rs__buffer_size @ the number of steps left
|
||||
ldr r8, [r8]
|
||||
|
|
|
@ -446,6 +446,7 @@ impl MixerBuffer {
|
|||
}
|
||||
}
|
||||
|
||||
if channel.volume != 0.into() {
|
||||
if channel.is_stereo {
|
||||
unsafe {
|
||||
agb_rs__mixer_add_stereo(
|
||||
|
@ -468,6 +469,7 @@ impl MixerBuffer {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
channel.pos += playback_speed * self.frequency.buffer_size();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue