mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Pass buffer size as an argument
This commit is contained in:
parent
ba18a0bf4a
commit
b2dcd8c854
|
@ -152,6 +152,7 @@ agb_arm_func agb_rs__mixer_collapse
|
|||
@ Arguments:
|
||||
@ r0 = target buffer (i8)
|
||||
@ r1 = input buffer (i16) of fixnums with 4 bits of precision (read in sets of i16 in an i32)
|
||||
@ r2 = loop counter
|
||||
|
||||
push {{r4-r11,lr}}
|
||||
|
||||
|
@ -164,8 +165,6 @@ SWAP_SIGN .req r11
|
|||
ldr CONST_127, =127
|
||||
ldr SWAP_SIGN, =0x80808080
|
||||
|
||||
ldr r2, =agb_rs__buffer_size @ loop counter
|
||||
ldr r2, [r2]
|
||||
mov r4, r2
|
||||
|
||||
@ The idea for this solution came from pimpmobile:
|
||||
|
|
|
@ -35,7 +35,11 @@ extern "C" {
|
|||
volume: Num<i16, 4>,
|
||||
);
|
||||
|
||||
fn agb_rs__mixer_collapse(sound_buffer: *mut i8, input_buffer: *const Num<i16, 4>);
|
||||
fn agb_rs__mixer_collapse(
|
||||
sound_buffer: *mut i8,
|
||||
input_buffer: *const Num<i16, 4>,
|
||||
num_samples: usize,
|
||||
);
|
||||
}
|
||||
|
||||
/// The main software mixer struct.
|
||||
|
@ -458,7 +462,11 @@ impl MixerBuffer {
|
|||
let write_buffer = free(|cs| self.state.borrow(cs).borrow_mut().active_advanced());
|
||||
|
||||
unsafe {
|
||||
agb_rs__mixer_collapse(write_buffer, working_buffer.as_ptr());
|
||||
agb_rs__mixer_collapse(
|
||||
write_buffer,
|
||||
working_buffer.as_ptr(),
|
||||
self.frequency.buffer_size(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue