Skip to content

Commit

Permalink
Fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Oct 23, 2024
1 parent d2d1f7a commit 01ec6dc
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 206 deletions.
5 changes: 4 additions & 1 deletion main/src/domain/accelerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use crate::domain::{
use helgoboss_learn::AbstractTimestamp;
use reaper_high::Reaper;
use reaper_low::raw;
use reaper_medium::{AccelMsg, AccelMsgKind, AcceleratorBehavior, TranslateAccel, TranslateAccelArgs, TranslateAccelResult, AcceleratorKeyCode, virt_keys};
use reaper_medium::{
virt_keys, AccelMsg, AccelMsgKind, AcceleratorBehavior, TranslateAccel, TranslateAccelArgs,
TranslateAccelResult,
};
use swell_ui::{SharedView, View, Window};

pub trait HelgoboxWindowSnitch {
Expand Down
74 changes: 31 additions & 43 deletions main/src/infrastructure/plugin/backbone_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,15 @@ use helgobox_api::runtime::{AutoAddedControllerEvent, GlobalInfoEvent};
use itertools::Itertools;
use once_cell::sync::Lazy;
use reaper_high::{
ChangeEvent, CrashInfo, Fx, GroupingBehavior, Guid, MiddlewareControlSurface, Project, Reaper,
Track,
ChangeEvent, CrashInfo, Fx, Guid, MiddlewareControlSurface, Project, Reaper, Track,
};
use reaper_low::{raw, PluginContext, Swell};
use reaper_macros::reaper_extension_plugin;
use reaper_medium::{
reaper_str, AccelMsg, AcceleratorPosition, ActionValueChange, CommandId, GangBehavior, Hmenu,
HookCustomMenu, HookPostCommand, HookPostCommand2, Hwnd, HwndInfo, HwndInfoType,
InputMonitoringMode, MenuHookFlag, MidiInputDeviceId, MidiOutputDeviceId, ReaProject,
ReaperStr, RecordingInput, RegistrationHandle, SectionContext, ToolbarIconMap, WindowContext,
reaper_str, AccelMsg, AcceleratorPosition, ActionValueChange, CommandId, Hmenu, HookCustomMenu,
HookPostCommand, HookPostCommand2, Hwnd, HwndInfo, HwndInfoType, MenuHookFlag,
MidiInputDeviceId, MidiOutputDeviceId, ReaProject, ReaperStr, RegistrationHandle,
SectionContext, ToolbarIconMap, WindowContext,
};
use reaper_rx::{ActionRxHookPostCommand, ActionRxHookPostCommand2};
use rxrust::prelude::*;
Expand Down Expand Up @@ -553,30 +552,6 @@ impl BackboneShell {
TEMP_DIR.as_ref()
}

/// Creates a new track in the given project and adds a new Helgobox instance to it.
pub async fn create_new_instance_in_project(
project: Project,
track_name: &str,
) -> anyhow::Result<NewInstanceOutcome> {
let track = project.insert_track_at(0)?;
track.set_name(track_name);
track.set_recording_input(Some(RecordingInput::Midi {
device_id: None,
channel: None,
}));
track.arm(
false,
GangBehavior::DenyGang,
GroupingBehavior::PreventGrouping,
);
track.set_input_monitoring_mode(
InputMonitoringMode::Normal,
GangBehavior::DenyGang,
GroupingBehavior::PreventGrouping,
);
Self::create_new_instance_on_track(&track).await
}

/// Creates a new Helgobox instance on the given track.
pub async fn create_new_instance_on_track(track: &Track) -> anyhow::Result<NewInstanceOutcome> {
let fx = track
Expand Down Expand Up @@ -1416,13 +1391,6 @@ impl BackboneShell {
f(&self.unit_infos.borrow())
}

pub fn find_session_by_containing_fx(&self, fx: &Fx) -> Option<SharedUnitModel> {
self.find_session(|session| {
let session = session.borrow();
session.processor_context().containing_fx() == fx
})
}

pub fn register_instance(&self, instance_shell: &SharedInstanceShell) {
debug!("Registering new instance...");
let instance = Rc::downgrade(instance_shell.instance());
Expand Down Expand Up @@ -3002,16 +2970,13 @@ pub struct NewInstanceOutcome {
#[cfg(feature = "playtime")]
mod playtime_impl {
use crate::infrastructure::data::LicenseManager;
use crate::infrastructure::plugin::helgobox_plugin::HELGOBOX_UNIQUE_VST_PLUGIN_ADD_STRING;
use crate::infrastructure::plugin::BackboneShell;
use crate::infrastructure::plugin::{BackboneShell, NewInstanceOutcome};
use anyhow::Context;
use base::future_util::millis;
use base::metrics_util::{record_duration, record_occurrence};
use base::Global;
use camino::Utf8PathBuf;
use playtime_api::persistence::PlaytimeSettings;
use playtime_clip_engine::PlaytimeEngine;
use reaper_high::{GroupingBehavior, Reaper};
use reaper_high::{GroupingBehavior, Project, Reaper};
use reaper_medium::{GangBehavior, InputMonitoringMode, RecordingInput};
use std::fs;

Expand All @@ -3032,10 +2997,33 @@ mod playtime_impl {

async fn add_and_show_playtime() -> anyhow::Result<()> {
let project = Reaper::get().current_project();
BackboneShell::create_new_instance_in_project(project, "Playtime").await?;
create_new_instance_in_project(project, "Playtime").await?;
enable_playtime_for_first_helgobox_instance_and_show_it()?;
Ok(())
}
/// Creates a new track in the given project and adds a new Helgobox instance to it.
pub async fn create_new_instance_in_project(
project: Project,
track_name: &str,
) -> anyhow::Result<NewInstanceOutcome> {
let track = project.insert_track_at(0)?;
track.set_name(track_name);
track.set_recording_input(Some(RecordingInput::Midi {
device_id: None,
channel: None,
}));
track.arm(
false,
GangBehavior::DenyGang,
GroupingBehavior::PreventGrouping,
);
track.set_input_monitoring_mode(
InputMonitoringMode::Normal,
GangBehavior::DenyGang,
GroupingBehavior::PreventGrouping,
);
BackboneShell::create_new_instance_on_track(&track).await
}

pub fn init_clip_engine(license_manager: &LicenseManager) {
#[derive(Debug)]
Expand Down
5 changes: 2 additions & 3 deletions main/src/infrastructure/test/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::domain::{FinalSourceFeedbackValue, PLUGIN_PARAMETER_COUNT};
use crate::infrastructure::plugin::helgobox_plugin::HELGOBOX_UNIQUE_VST_PLUGIN_ADD_STRING;
use crate::infrastructure::plugin::{BackboneShell, NewInstanceOutcome, SET_STATE_PARAM_NAME};
use approx::assert_abs_diff_eq;
use base::future_util::millis;
use base::{Global, SenderToNormalThread};
use helgoboss_learn::{MidiSourceValue, BASE_EPSILON, FEEDBACK_EPSILON};
use helgoboss_midi::test_util::*;
use helgoboss_midi::{DataEntryByteOrder, ParameterNumberMessage, RawShortMessage, ShortMessage};
use reaper_high::{Fx, FxParameter, Reaper, Track};
use reaper_high::{FxParameter, Reaper, Track};
use reaper_medium::{Db, ReaperPanValue, StuffMidiMessageTarget};
use std::ffi::CString;
use std::future::Future;
Expand Down Expand Up @@ -1457,7 +1456,7 @@ mod macos_impl {
use std::fs;
use std::path::PathBuf;
use swell_ui::View;
use xcap::image::{imageops, DynamicImage, RgbaImage};
use xcap::image::{imageops, DynamicImage};

pub async fn take_screenshots() {
// Given
Expand Down
1 change: 0 additions & 1 deletion main/src/infrastructure/ui/help.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::infrastructure::ui::help::SourceTopic::{Category, Learn, Type};
use derive_more::Display;
use helgoboss_learn::ModeParameter;
use include_dir::{include_dir, Dir};
Expand Down
Loading

0 comments on commit 01ec6dc

Please sign in to comment.