pub struct InterfaceCallbacks { /* private fields */ }Expand description
Opaque callback adapter owned by the native chip instance.
Implementations§
Source§impl InterfaceCallbacks
impl InterfaceCallbacks
Sourcepub fn new(handler: InterfaceHandler) -> Self
pub fn new(handler: InterfaceHandler) -> Self
Create a callback adapter containing the supplied host handlers.
Examples found in repository?
examples/vgmrender.rs (lines 50-52)
42 fn new(chip_type: ChipType, clock: u32) -> Self {
43 let state = Rc::new(RefCell::new(VgmHandlerState {
44 data: std::array::from_fn(|_| Vec::new()),
45 }));
46 let pcm_offset = Rc::new(RefCell::new(0u32));
47 let chip = ffi::create_chip_with_callbacks(
48 chip_type,
49 clock,
50 Box::new(InterfaceCallbacks::new(vgm_handler_with_state(Rc::clone(
51 &state,
52 )))),
53 );
54 let channels = chip.channels() as usize;
55 let step: EmulatedTime = 0x1_0000_0000i64 / i64::from(chip.sample_rate());
56 Self {
57 chip,
58 channels,
59 queue: std::collections::VecDeque::new(),
60 pos: 0,
61 step,
62 native: vec![0i32; channels],
63 handler_state: state,
64 pcm_offset,
65 }
66 }Auto Trait Implementations§
impl !Freeze for InterfaceCallbacks
impl !RefUnwindSafe for InterfaceCallbacks
impl !Send for InterfaceCallbacks
impl !Sync for InterfaceCallbacks
impl !UnwindSafe for InterfaceCallbacks
impl Unpin for InterfaceCallbacks
impl UnsafeUnpin for InterfaceCallbacks
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more