Skip to content

Commit

Permalink
#1391 Improve instance picker
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Jan 7, 2025
1 parent 6afb56c commit a2db407
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 38 deletions.
55 changes: 31 additions & 24 deletions main/src/infrastructure/proto/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ use crate::infrastructure::data::{
};
use crate::infrastructure::plugin::{BackboneShell, InstanceShell};
use crate::infrastructure::proto::{
event_reply, fx_chain_location, occasional_global_update, occasional_instance_update,
event_reply, fx_chain_location_info, occasional_global_update, occasional_instance_update,
qualified_occasional_unit_update, ArrangementPlayState, AudioInputChannel, AudioInputChannels,
CellAddress, Compartment, ContinuousColumnUpdate, ContinuousMatrixUpdate, Empty,
FxChainLocation, FxLocation, GetContinuousColumnUpdatesReply, GetContinuousMatrixUpdatesReply,
GetContinuousSlotUpdatesReply, GetOccasionalClipUpdatesReply, GetOccasionalColumnUpdatesReply,
GetOccasionalGlobalUpdatesReply, GetOccasionalInstanceUpdatesReply,
GetOccasionalMatrixUpdatesReply, GetOccasionalPlaytimeEngineUpdatesReply,
GetOccasionalRowUpdatesReply, GetOccasionalSlotUpdatesReply, GetOccasionalTrackUpdatesReply,
GetOccasionalUnitUpdatesReply, HelgoboxInstance, HelgoboxInstanceData, HelgoboxInstances,
HostColorScheme, MidiDeviceStatus, MidiInputDevice, MidiInputDevices, MidiOutputDevice,
MidiOutputDevices, OccasionalGlobalUpdate, OccasionalInstanceUpdate, OccasionalMatrixUpdate,
OccasionalPlaytimeEngineUpdate, PitchShiftMode, PitchShiftModes, PitchShiftSubMode,
ProjectLocation, QualifiedContinuousSlotUpdate, QualifiedOccasionalClipUpdate,
QualifiedOccasionalColumnUpdate, QualifiedOccasionalRowUpdate, QualifiedOccasionalSlotUpdate,
QualifiedOccasionalTrackUpdate, QualifiedOccasionalUnitUpdate, ResampleMode, ResampleModes,
RgbColor, Scope, Severity, SlotAddress, TrackFxChainLocation, TrackLocation, Unit, Units,
Warning, Warnings,
FxChainLocationInfo, FxLocationInfo, GetContinuousColumnUpdatesReply,
GetContinuousMatrixUpdatesReply, GetContinuousSlotUpdatesReply, GetOccasionalClipUpdatesReply,
GetOccasionalColumnUpdatesReply, GetOccasionalGlobalUpdatesReply,
GetOccasionalInstanceUpdatesReply, GetOccasionalMatrixUpdatesReply,
GetOccasionalPlaytimeEngineUpdatesReply, GetOccasionalRowUpdatesReply,
GetOccasionalSlotUpdatesReply, GetOccasionalTrackUpdatesReply, GetOccasionalUnitUpdatesReply,
HelgoboxInstance, HelgoboxInstanceData, HelgoboxInstances, HostColorScheme, MidiDeviceStatus,
MidiInputDevice, MidiInputDevices, MidiOutputDevice, MidiOutputDevices, OccasionalGlobalUpdate,
OccasionalInstanceUpdate, OccasionalMatrixUpdate, OccasionalPlaytimeEngineUpdate,
PitchShiftMode, PitchShiftModes, PitchShiftSubMode, ProjectLocationInfo,
QualifiedContinuousSlotUpdate, QualifiedOccasionalClipUpdate, QualifiedOccasionalColumnUpdate,
QualifiedOccasionalRowUpdate, QualifiedOccasionalSlotUpdate, QualifiedOccasionalTrackUpdate,
QualifiedOccasionalUnitUpdate, ResampleMode, ResampleModes, RgbColor, Scope, Severity,
SlotAddress, TrackFxChainLocationInfo, TrackLocationInfo, Unit, Units, Warning, Warnings,
};
use crate::infrastructure::server::data::get_controller_routing;

Expand Down Expand Up @@ -249,31 +249,38 @@ impl HelgoboxInstances {
let fx = info.processor_context.containing_fx();
let fx_chain_location = match fx.chain().context() {
FxChainContext::Monitoring => {
fx_chain_location::Location::MonitoringFx(Empty {})
fx_chain_location_info::Location::MonitoringFx(Empty {})
}
FxChainContext::Track { track, is_input_fx } => {
let project = track.project();
let project_location = ProjectLocation {
let project_location = ProjectLocationInfo {
index: project.index().ok()?,
path: project.file().map(|f| f.into_string()),
};
let track_location = TrackLocation {
let track_location = TrackLocationInfo {
project: Some(project_location),
id: track.guid().to_string_without_braces(),
index: track.index()?,
name: track.name()?.to_string(),
};
fx_chain_location::Location::TrackFx(TrackFxChainLocation {
track: Some(track_location),
input_fx: *is_input_fx,
})
fx_chain_location_info::Location::TrackFx(
TrackFxChainLocationInfo {
track: Some(track_location),
input_fx: *is_input_fx,
},
)
}
// Not supported anyway
FxChainContext::Take(_) => return None,
};
let fx_chain_location = FxChainLocation {
let fx_chain_location = FxChainLocationInfo {
location: Some(fx_chain_location),
};
let fx_location = FxLocation {
let fx_location = FxLocationInfo {
fx_chain: Some(fx_chain_location),
id: fx.get_or_query_guid().ok()?.to_string_without_braces(),
index: fx.index(),
name: fx.name().to_string(),
};
let helgobox_instance = HelgoboxInstance {
data: Some(data),
Expand Down
43 changes: 29 additions & 14 deletions main/src/infrastructure/proto/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ pub struct HelgoboxInstance {
#[prost(message, optional, tag = "1")]
pub data: ::core::option::Option<HelgoboxInstanceData>,
#[prost(message, optional, tag = "2")]
pub fx: ::core::option::Option<FxLocation>,
pub fx: ::core::option::Option<FxLocationInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand All @@ -1571,57 +1571,72 @@ pub struct HelgoboxInstanceData {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FxLocation {
pub struct FxLocationInfo {
/// Location of the containing FX chain.
#[prost(message, optional, tag = "1")]
pub fx_chain: ::core::option::Option<FxChainLocation>,
pub fx_chain: ::core::option::Option<FxChainLocationInfo>,
/// Unique ID of the FX.
#[prost(string, tag = "2")]
pub id: ::prost::alloc::string::String,
/// Index of FX within chain.
#[prost(uint32, tag = "3")]
pub index: u32,
/// FX name.
#[prost(string, tag = "4")]
pub name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FxChainLocation {
#[prost(oneof = "fx_chain_location::Location", tags = "1, 2")]
pub location: ::core::option::Option<fx_chain_location::Location>,
pub struct FxChainLocationInfo {
#[prost(oneof = "fx_chain_location_info::Location", tags = "1, 2")]
pub location: ::core::option::Option<fx_chain_location_info::Location>,
}
/// Nested message and enum types in `FxChainLocation`.
pub mod fx_chain_location {
/// Nested message and enum types in `FxChainLocationInfo`.
pub mod fx_chain_location_info {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Location {
#[prost(message, tag = "1")]
TrackFx(super::TrackFxChainLocation),
TrackFx(super::TrackFxChainLocationInfo),
#[prost(message, tag = "2")]
MonitoringFx(super::Empty),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrackFxChainLocation {
pub struct TrackFxChainLocationInfo {
/// Location of the containing track.
#[prost(message, optional, tag = "1")]
pub track: ::core::option::Option<TrackLocation>,
pub track: ::core::option::Option<TrackLocationInfo>,
/// Whether it's the normal or input FX chain.
#[prost(bool, tag = "2")]
pub input_fx: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TrackLocation {
pub struct TrackLocationInfo {
/// Location of the containing project.
#[prost(message, optional, tag = "1")]
pub project: ::core::option::Option<ProjectLocation>,
pub project: ::core::option::Option<ProjectLocationInfo>,
/// Unique ID of the track.
#[prost(string, tag = "2")]
pub id: ::prost::alloc::string::String,
/// Index of the track within the project.
#[prost(uint32, tag = "3")]
pub index: u32,
/// Track name.
#[prost(string, tag = "4")]
pub name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProjectLocation {
pub struct ProjectLocationInfo {
/// Index within the currently open project tabs.
#[prost(uint32, tag = "1")]
pub index: u32,
/// Project path (if saved).
#[prost(string, optional, tag = "2")]
pub path: ::core::option::Option<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down

0 comments on commit a2db407

Please sign in to comment.