Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderVocke committed Dec 9, 2024
1 parent 27e864d commit 40ab66b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/rust/backend_bindings/src/audio_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl AudioChannel {

pub fn set_mode(&self, mode: ChannelMode) {
unsafe {
ffi::set_audio_channel_mode(self.unsafe_backend_ptr(), mode as u32);
ffi::set_audio_channel_mode(self.unsafe_backend_ptr(), mode as ffi::shoop_channel_mode_t);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/rust/backend_bindings/src/audio_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ unsafe impl Sync for AudioDriver {}

impl AudioDriver {
pub fn new(driver_type : AudioDriverType) -> Result<Self, anyhow::Error> {
let obj = unsafe { ffi::create_audio_driver(driver_type as u32) };
let obj = unsafe { ffi::create_audio_driver(driver_type as ffi::shoop_audio_driver_type_t) };
if obj.is_null() {
Err(anyhow::anyhow!("create_audio_driver() failed"))
} else {
Expand Down Expand Up @@ -173,8 +173,8 @@ impl AudioDriver {
ffi::dummy_driver_add_external_mock_port(
*obj,
c_name.as_ptr(),
direction,
data_type,
direction as ffi::shoop_port_direction_t,
data_type as ffi::shoop_port_data_type_t,
)
};
}
Expand Down Expand Up @@ -202,7 +202,7 @@ impl AudioDriver {
pub fn find_external_ports(&self, maybe_name_regex: Option<&str>, port_direction: u32, data_type: u32) -> Vec<ExternalPortDescriptor> {
let obj = self.lock();
let regex_ptr = maybe_name_regex.map_or(std::ptr::null(), |s| s.as_ptr() as *const i8);
let result = unsafe { ffi::find_external_ports(*obj, regex_ptr, port_direction, data_type) };
let result = unsafe { ffi::find_external_ports(*obj, regex_ptr, port_direction as ffi::shoop_port_direction_t, data_type as ffi::shoop_port_data_type_t) };
let ports = unsafe { std::slice::from_raw_parts((*result).ports, (*result).n_ports as usize) };
let mut port_descriptors = Vec::new();
unsafe {
Expand Down Expand Up @@ -244,5 +244,5 @@ impl Drop for AudioDriver {
}

pub fn driver_type_supported(driver_type : AudioDriverType) -> bool {
unsafe { ffi::driver_type_supported(driver_type as u32) != 0 }
unsafe { ffi::driver_type_supported(driver_type as ffi::shoop_audio_driver_type_t) != 0 }
}
2 changes: 1 addition & 1 deletion src/rust/backend_bindings/src/audio_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl AudioPort {
(backend_session.unsafe_backend_ptr(),
audio_driver.unsafe_backend_ptr(),
name_hint_ptr,
*direction as u32,
*direction as ffi::shoop_port_direction_t,
min_n_ringbuffer_samples) };
if obj.is_null() {
return Err(anyhow::anyhow!("Failed to create audio port"));
Expand Down
2 changes: 1 addition & 1 deletion src/rust/backend_bindings/src/decoupled_midi_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl DecoupledMidiPort {
let obj = unsafe { ffi::open_decoupled_midi_port
(audio_driver.unsafe_backend_ptr(),
name_hint_ptr,
*direction as u32) };
*direction as ffi::shoop_port_direction_t) };
if obj.is_null() {
return Err(anyhow::anyhow!("Failed to create audio port"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/rust/backend_bindings/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ integer_enum! {
}

pub fn set_global_logging_level(level: &LogLevel) {
unsafe { ffi::set_global_logging_level(*level as u32); }
unsafe { ffi::set_global_logging_level(*level as ffi::shoop_log_level_t); }
}

#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion src/rust/backend_bindings/src/midi_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl MidiChannel {

pub fn set_mode(&self, mode: ChannelMode) {
unsafe {
ffi::set_midi_channel_mode(self.unsafe_backend_ptr(), mode as u32);
ffi::set_midi_channel_mode(self.unsafe_backend_ptr(), mode as ffi::shoop_channel_mode_t);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/rust/backend_bindings/src/midi_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl MidiPort {
(backend_session.unsafe_backend_ptr(),
audio_driver.unsafe_backend_ptr(),
name_hint_ptr,
*direction as u32,
*direction as ffi::shoop_port_direction_t,
min_n_ringbuffer_samples) };
if obj.is_null() {
return Err(anyhow::anyhow!("Failed to create audio port"));
Expand Down
4 changes: 2 additions & 2 deletions src/rust/backend_bindings/src/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ impl ExternalPortDescriptor {
pub fn to_ffi(&self) -> ffi::shoop_external_port_descriptor_t {
ffi::shoop_external_port_descriptor_t {
name: std::ffi::CString::new(self.name.clone()).unwrap().into_raw(),
direction: self.direction as u32,
data_type: self.data_type as u32,
direction: self.direction as ffi::shoop_port_direction_t,
data_type: self.data_type as ffi::shoop_port_data_type_t,
}
}
}
Expand Down

0 comments on commit 40ab66b

Please sign in to comment.