Skip to content

Commit

Permalink
Make plug-in scanning faster
Browse files Browse the repository at this point in the history
by preventing to load all kinds of stuff when scanning plug-in
  • Loading branch information
helgoboss committed Oct 27, 2023
1 parent 845a05a commit 5c1d9b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
13 changes: 13 additions & 0 deletions main/src/infrastructure/plugin/realearn_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,19 @@ impl Plugin for RealearnPlugin {

fn init(&mut self) {
firewall(|| {
if self.reaper_is_scanning_plugins() {
return;
}
self._reaper_guard = Some(self.ensure_reaper_setup());
self.schedule_session_creation();
});
}

fn get_editor(&mut self) -> Option<Box<dyn Editor>> {
firewall(|| {
if self.reaper_is_scanning_plugins() {
return None;
}
let boxed: Box<dyn Editor> = Box::new(RealearnEditor::new(self.main_panel.clone()));
Some(boxed)
})
Expand Down Expand Up @@ -355,6 +361,13 @@ impl Plugin for RealearnPlugin {
}

impl RealearnPlugin {
fn reaper_is_scanning_plugins(&self) -> bool {
// REAPER uses version "0" to indicate that this is only the plug-in scanning
// process.
let (version, _, _) = self.host.get_info();
version == 0
}

/// Should be called in real-time thread only.
fn is_now_playing(&self) -> bool {
use vst::api::TimeInfoFlags;
Expand Down
6 changes: 0 additions & 6 deletions main/src/infrastructure/plugin/realearn_plugin_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ impl RealearnPluginParameters {
}
}

impl Drop for RealearnPluginParameters {
fn drop(&mut self) {
debug!(Reaper::get().logger(), "Dropping plug-in parameters...");
}
}

/// This will be returned if ReaLearn cannot return reasonable bank data yet.
const NOT_READY_YET: &str = "not-ready-yet";

Expand Down
6 changes: 0 additions & 6 deletions main/src/infrastructure/ui/main_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,3 @@ impl SessionUi for Weak<MainPanel> {
fn upgrade_panel(panel: &Weak<MainPanel>) -> Rc<MainPanel> {
panel.upgrade().expect("main panel not existing anymore")
}

impl Drop for MainPanel {
fn drop(&mut self) {
debug!(Reaper::get().logger(), "Dropping main panel...");
}
}

0 comments on commit 5c1d9b4

Please sign in to comment.