Skip to content

Commit

Permalink
High-level API: Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Jan 24, 2025
1 parent fad3659 commit f5fb3b2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main/high/src/reaper_simple.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//! This file should contain all the top-level REAPER functions which can be implemented with
//! just access to `reaper_medium::Reaper` - without all the advanced stuff like subjects,
//! channels etc. Although they end up in the same struct, this gives a little bit of structure.
use crate::error::ReaperResult;
use crate::{
Action, Fx, FxChain, FxParameter, Guid, MidiInputDevice, MidiOutputDevice, Project, Reaper,
Section,
ReaperError, Section,
};
use camino::Utf8PathBuf;
use helgoboss_midi::ShortMessage;
Expand Down Expand Up @@ -471,9 +472,11 @@ impl Reaper {
let config_var_result = Reaper::get()
.medium_reaper
.get_config_var(name)
.context("preference doesn't exist")?;
.ok_or(ReaperError::new("preference doesn't exist"))?;
let size_matches = config_var_result.size as usize == mem::size_of::<T>();
ensure!(size_matches, "size mismatch");
if !size_matches {
return Err("size mismatch".into());
}
let mut casted_value_ptr = config_var_result.value.cast::<T>();
let casted_value_ref = unsafe { casted_value_ptr.as_mut() };
Ok(casted_value_ref)
Expand Down

0 comments on commit f5fb3b2

Please sign in to comment.