Unable to get project name or filepath #84
-
Ref #82 I'm having trouble getting the project info I need, and previously I was using the crates.io version and didn't realize I needed to use master, so I ended up writing the plugin using the ReaPy from PyPy to write the plugin logic. I'm able to get this output and the python plugin works fine, but I'd really like to use reaper-rs to do this. Here is a json blob created by the python plugin: {
"name": "test_proj.RPP",
"media_path": "/home/eureka/Documents/REAPER Media/test_proj/Media",
"rpp_filepath": "/home/eureka/Documents/REAPER Media/test_proj/test_proj.RPP",
"tracks": [
{
"name": "Empty_Track",
"project_name": "test_proj.RPP",
"project_media_path": "/home/eureka/Documents/REAPER Media/test_proj/Media",
"project_rpp_filepath": "/home/eureka/Documents/REAPER Media/test_proj/test_proj.RPP",
"media_items": []
}
],
"modtime": "2025-04-03T05:24:10.555949+00:00",
"author": "eureka",
"host": "tensorbook",
"trigger": "OnStart"
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Here is my rust plugin and my toml contents: use reaper_high::Reaper;
use reaper_macros::reaper_extension_plugin;
#[reaper_extension_plugin(
name = "reaper_lib_cloud_reaper",
support_email_address = "cloudscythelabs@gmail.com",
update_url = "github.com/Cloud-Scythe-Labs"
)]
pub fn plugin_main() -> Result<(), Box<dyn std::error::Error>> {
let reaper = Reaper::get();
reaper.show_console_msg("reaper_lib_cloud_reaper was initialized");
let project = reaper.current_project();
if let Some(file_path) = project.file() {
reaper.show_console_msg(format!("Found file path: '{file_path}'"));
} else {
reaper.show_console_msg("did not find the file path");
}
Ok(())
} [package]
name = "reaper_lib_cloud_reaper"
version.workspace = true
edition.workspace = true
publish.workspace = true
[features]
default = ["debug_console"]
# Enables debug messages to be printed to the REAPER console.
debug_console = []
# Important:
#
# Compiled REAPER extension plug-ins (i.e. .dll files) must be prefixed with reaper_ in order
# for REAPER to load them during startup - even on Linux and macOS, where library file names
# usually start with lib. On Windows, it's enough to name the library reaper_my_extension
# in Cargo.toml and it will result in the compiled file being named reaper_my_extension, thus
# obeying this rule. On Linux and macOS, you still need to remove the lib prefix. In any case,
# make sure that the compiled file placed in REAPER_RESOURCE_PATH/UserPlugins is prefixed with
# reaper_ before attempting to test it!
[lib]
name = "_cloud_reaper" # A post-build fix-up phase will handle the above.
crate-type = ["cdylib"]
[dependencies]
c_str_macro = "1.0"
reaper-high = { git = "https://github.com/helgoboss/reaper-rs.git", branch = "master" }
reaper-low.workspace = true # also on master just in the workspace
reaper-macros = { git = "https://github.com/helgoboss/reaper-rs.git", branch = "master" }
reaper-medium = { git = "https://github.com/helgoboss/reaper-rs.git", branch = "master" } |
Beta Was this translation helpful? Give feedback.
-
This returns Let me quickly adjust the official example extension to show how this would work. Oh, and again: Please don't use the high-level API (except for the entry point macro). It has breaking changes very often and will eventually be removed. I won't give any support for it and should not have made it available here in the first place ;) And for better understanding: The medium-level API is very close to the original REAPER C++ SDK. It intentionally doesn't add convenience! So what you currently struggle with is actually REAPER's SDK, not reaper-rs. In most cases, if something doesn't work in the medium-level API, it also wouldn't work with the original REAPER C++ SDK. You are coming from ReaPy, which AFAIK adds a little convenience on top of the original REAPER SDK, such as waiting for a project to become active. This is probably why it prints out a project path after load. |
Beta Was this translation helpful? Give feedback.
This returns
None
because the project is not loaded yet at the point when the extension is initialized, so there's indeed no file path.Let me quickly adjust the official example extension to show how this would work.
Oh, and again: Please don't use the high-level API (except for the entry point macro). It has breaking changes very often and will eventually be removed. I won't give any support for it and should not have made it available here in the first place ;)
And for better understanding: The medium-level API is very close to the original REAPER C++ SDK. It intentionally doesn't add convenience! So what you currently struggle with is actually REAPER's SDK, not reaper-rs. In most case…