-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#422 ReaLearn: Support MIDI editor and media explorer actions
- Loading branch information
Showing
19 changed files
with
256 additions
and
105 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "helgobox" | ||
version = "2.16.2" | ||
version = "2.16.3" | ||
authors = ["Benjamin Klum <[email protected]>"] | ||
edition = "2021" | ||
build = "build.rs" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::base::notification; | ||
use reaper_high::{Action, Reaper}; | ||
use reaper_medium::SectionId; | ||
|
||
pub fn build_smart_command_name_from_action(action: &Action) -> Option<String> { | ||
match action.command_name() { | ||
// Built-in actions don't have a command name but a persistent command ID. | ||
// Use command ID as string. | ||
None => action.command_id().ok().map(|id| id.to_string()), | ||
// ReaScripts and custom actions have a command name as persistent identifier. | ||
Some(name) => Some(name.into_string()), | ||
} | ||
} | ||
|
||
pub fn build_action_from_smart_command_name( | ||
section_id: SectionId, | ||
smart_command_name: &str, | ||
) -> Option<Action> { | ||
match smart_command_name.parse::<u32>() { | ||
// Could parse this as command ID integer. This is a built-in action. | ||
Ok(command_id_int) => match command_id_int.try_into() { | ||
Ok(command_id) => Some( | ||
Reaper::get() | ||
.section_by_id(section_id) | ||
.action_by_command_id(command_id), | ||
), | ||
Err(_) => { | ||
notification::warn(format!("Invalid command ID {command_id_int}")); | ||
None | ||
} | ||
}, | ||
// Couldn't parse this as integer. This is a ReaScript or custom action. | ||
Err(_) => Some(Reaper::get().action_by_command_name(smart_command_name)), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,8 @@ mod props; | |
pub use props::*; | ||
|
||
mod auto_units; | ||
|
||
mod actions; | ||
pub use actions::*; | ||
|
||
pub use auto_units::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.