-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate "SelectProjectInstance()" for TODO's missing ability to specify ReaProject #47
Comments
Thanks Gavin! That could be a solution. Just would need to make sure that the function doesn't do anything with the GUI, otherwise this could lead to flickering. |
Spoke with @cfillion about this, he said calling proj1, _ = reaper.EnumProjects(0)
proj2, _ = reaper.EnumProjects(1)
reaper.PreventUIRefresh(1)
reaper.SelectProjectInstance(proj2)
t = reaper.GetTrack(0, 0) -- 0 = "current project"
_, name = reaper.GetTrackName(t)
reaper.ShowConsoleMsg("Proj2 track 1 name = " .. name)
reaper.SelectProjectInstance(proj1)
reaper.PreventUIRefresh(-1) Can probably make this a generic/higher-order function or trait, something roughly like this (excuse poor Rust): fn prevent_ui_refresh<FnType, FnReturn>(F: FnType) -> FnReturn
where
F: Fn() -> FnReturn
{
reaper.PreventUIRefresh(1);
let result = f();
reaper.PreventUIRefresh(-1);
return result;
}
fn main() {
let myfunc = |x: i32| -> i32 { x * x };
let result = prevent_ui_refresh(|| {
myfunc(5)
});
println!("Result is {}", result);
} |
Uncertain what this does (never seen it used in code), but if it switches the internal pointer to the current
ReaProject
for functions that don't take aReaProject
as a param, maybe it could work to quickly swap to another project + back to the original hackily?https://www.reaper.fm/sdk/reascript/reascripthelp.html#SelectProjectInstance
So maybe we can fix this ->
:(
// TODO-low reaper::InsertTrackAtIndex unfortunately doesn't allow to specify ReaProject :(
Current impl:
Naive theoretical impl (if
SelectProjectInstance
does what I hope):🙂
The text was updated successfully, but these errors were encountered: