From 1b3f7d121899d97b19ccc7ddb7efcb08ce449917 Mon Sep 17 00:00:00 2001 From: Benjamin Klum Date: Mon, 11 Mar 2024 22:42:07 +0100 Subject: [PATCH] Playtime: Add learning for some toolbar actions --- api/src/persistence/target.rs | 12 +++ main/src/application/target_model.rs | 43 +++++++--- main/src/domain/reaper_target.rs | 82 ++++++++++-------- .../targets/playtime_matrix_action_target.rs | 73 +++++++++++++++- main/src/infrastructure/proto/generated.rs | 84 +++++++++++++++---- .../proto/playtime_request_handler.rs | 42 +++++++++- playtime-api/src/runtime/app.rs | 4 + playtime-clip-engine | 2 +- 8 files changed, 276 insertions(+), 66 deletions(-) diff --git a/api/src/persistence/target.rs b/api/src/persistence/target.rs index c7628a74c..8baa72081 100644 --- a/api/src/persistence/target.rs +++ b/api/src/persistence/target.rs @@ -1515,6 +1515,18 @@ pub enum PlaytimeMatrixAction { ClickOnOffState, #[display(fmt = "Enable/disable MIDI auto-quantize")] MidiAutoQuantizationOnOffState, + #[display(fmt = "Smart record")] + SmartRecord, + #[display(fmt = "Enable silence mode or play ignited")] + EnterSilenceModeOrPlayIgnited, + #[display(fmt = "Enable/disable silence mode")] + SilenceModeOnOffState, + #[display(fmt = "Panic")] + Panic, + #[display(fmt = "Enable/disable sequencer recording")] + SequencerRecordOnOffState, + #[display(fmt = "Enable/disable sequencer playing")] + SequencerPlayOnOffState, } impl Default for PlaytimeMatrixAction { diff --git a/main/src/application/target_model.rs b/main/src/application/target_model.rs index ca4d5eee2..159c452cf 100644 --- a/main/src/application/target_model.rs +++ b/main/src/application/target_model.rs @@ -59,13 +59,14 @@ use std::error::Error; use crate::domain::ui_util::format_tags_as_csv; use base::hash_util::NonCryptoHashSet; +use realearn_api::persistence::Target::PlaytimeColumnAction; use realearn_api::persistence::{ Axis, BrowseTracksMode, FxChainDescriptor, FxDescriptorCommons, FxToolAction, LearnTargetMappingModification, LearnableTargetKind, MappingModification, MappingSnapshotDescForLoad, MappingSnapshotDescForTake, MonitoringMode, MouseAction, - MouseButton, PlaytimeColumnDescriptor, PlaytimeRowDescriptor, PlaytimeSlotDescriptor, - PotFilterKind, SeekBehavior, SetTargetToLastTouchedMappingModification, TargetTouchCause, - TrackDescriptorCommons, TrackFxChain, TrackScope, TrackToolAction, + MouseButton, PlaytimeColumnDescriptor, PlaytimeMatrixAction, PlaytimeRowDescriptor, + PlaytimeSlotDescriptor, PotFilterKind, SeekBehavior, SetTargetToLastTouchedMappingModification, + TargetTouchCause, TrackDescriptorCommons, TrackFxChain, TrackScope, TrackToolAction, }; use reaper_medium::{ AutomationMode, BookmarkId, GlobalAutomationModeOverride, InputMonitoringMode, TrackArea, @@ -1780,6 +1781,15 @@ impl TargetModel { self.automation_mode = RealearnAutomationMode::from_reaper(am); } }, + PlaytimeMatrixAction(t) => { + self.clip_matrix_action = t.action; + } + PlaytimeColumnAction(t) => { + self.clip_column_action = t.action; + } + PlaytimeRowAction(t) => { + self.clip_row_action = t.basics.action; + } PlaytimeSlotTransportAction(t) => { self.clip_transport_action = t.basics.action; } @@ -2667,32 +2677,41 @@ impl TargetModel { pub fn simple_target(&self) -> Option { use playtime_api::runtime::SimpleMappingTarget; use realearn_api::persistence; - use ReaperTargetType::*; + use ReaperTargetType as T; if self.category != TargetCategory::Reaper { return None; } let t = match self.r#type { - PlaytimeSlotTransportAction + T::PlaytimeSlotTransportAction if self.clip_transport_action() == persistence::PlaytimeSlotTransportAction::Trigger => { SimpleMappingTarget::TriggerSlot(self.clip_slot.fixed_address()?) } - PlaytimeColumnAction + T::PlaytimeColumnAction if self.clip_column_action() == persistence::PlaytimeColumnAction::Stop => { SimpleMappingTarget::TriggerColumn(self.clip_column.fixed_address()?) } - PlaytimeRowAction + T::PlaytimeRowAction if self.clip_row_action() == persistence::PlaytimeRowAction::PlayScene => { SimpleMappingTarget::TriggerRow(self.clip_row.fixed_address()?) } - PlaytimeMatrixAction - if self.clip_matrix_action() == persistence::PlaytimeMatrixAction::Stop => - { - SimpleMappingTarget::TriggerMatrix - } + T::PlaytimeMatrixAction => match self.clip_matrix_action { + PlaytimeMatrixAction::Stop => SimpleMappingTarget::TriggerMatrix, + PlaytimeMatrixAction::SmartRecord => SimpleMappingTarget::SmartRecord, + PlaytimeMatrixAction::EnterSilenceModeOrPlayIgnited => { + SimpleMappingTarget::EnterSilenceModeOrPlayIgnited + } + PlaytimeMatrixAction::SequencerRecordOnOffState => { + SimpleMappingTarget::SequencerRecordOnOffState + } + PlaytimeMatrixAction::SequencerPlayOnOffState => { + SimpleMappingTarget::SequencerPlayOnOffState + } + _ => return None, + }, _ => return None, }; Some(t) diff --git a/main/src/domain/reaper_target.rs b/main/src/domain/reaper_target.rs index a7122c5ba..22cf76d73 100644 --- a/main/src/domain/reaper_target.rs +++ b/main/src/domain/reaper_target.rs @@ -21,7 +21,10 @@ use strum::EnumIter; use helgoboss_learn::{ AbsoluteValue, ControlType, ControlValue, NumericValue, PropValue, Target, UnitValue, }; -use realearn_api::persistence::{SeekBehavior, TrackScope}; +use realearn_api::persistence::{ + PlaytimeColumnAction, PlaytimeMatrixAction, PlaytimeRowAction, PlaytimeSlotTransportAction, + SeekBehavior, TrackScope, +}; use crate::domain::ui_util::convert_bool_to_unit_value; use crate::domain::{ @@ -32,12 +35,14 @@ use crate::domain::{ FxOnlineTarget, FxOpenTarget, FxParameterTarget, FxParameterTouchStateTarget, FxPresetTarget, FxToolTarget, GoToBookmarkTarget, HierarchyEntry, HierarchyEntryProvider, LoadFxSnapshotTarget, LoadPotPresetTarget, MappingControlContext, MidiSendTarget, ModifyMappingTarget, OscSendTarget, - PlayrateTarget, PreviewPotPresetTarget, RealTimeControlContext, RealTimeFxParameterTarget, - RouteMuteTarget, RoutePanTarget, RouteTouchStateTarget, RouteVolumeTarget, SeekTarget, - TakeMappingSnapshotTarget, TargetTypeDef, TempoTarget, TrackArmTarget, - TrackAutomationModeTarget, TrackMonitoringModeTarget, TrackMuteTarget, TrackPanTarget, - TrackParentSendTarget, TrackPeakTarget, TrackSelectionTarget, TrackShowTarget, TrackSoloTarget, - TrackTouchStateTarget, TrackVolumeTarget, TrackWidthTarget, TransportTarget, UnitEvent, + PlayrateTarget, PlaytimeColumnActionTarget, PlaytimeMatrixActionTarget, + PlaytimeRowActionTarget, PlaytimeSlotTransportTarget, PreviewPotPresetTarget, + RealTimeControlContext, RealTimeFxParameterTarget, RouteMuteTarget, RoutePanTarget, + RouteTouchStateTarget, RouteVolumeTarget, SeekTarget, TakeMappingSnapshotTarget, TargetTypeDef, + TempoTarget, TrackArmTarget, TrackAutomationModeTarget, TrackMonitoringModeTarget, + TrackMuteTarget, TrackPanTarget, TrackParentSendTarget, TrackPeakTarget, TrackSelectionTarget, + TrackShowTarget, TrackSoloTarget, TrackTouchStateTarget, TrackVolumeTarget, TrackWidthTarget, + TransportTarget, UnitEvent, }; use crate::domain::{ AnyOnTarget, BrowseGroupMappingsTarget, CompoundChangeEvent, EnableInstancesTarget, @@ -47,6 +52,7 @@ use crate::domain::{ }; use base::default_util::is_default; use base::Global; +use playtime_api::runtime::SimpleMappingTarget; /// This target character is just used for GUI and auto-correct settings! It doesn't have influence /// on control/feedback. @@ -138,11 +144,11 @@ pub enum ReaperTarget { SendMidi(MidiSendTarget), SendOsc(OscSendTarget), Dummy(DummyTarget), - PlaytimeMatrixAction(crate::domain::PlaytimeMatrixActionTarget), + PlaytimeMatrixAction(PlaytimeMatrixActionTarget), PlaytimeControlUnitScroll(crate::domain::PlaytimeControlUnitScrollTarget), - PlaytimeSlotTransportAction(crate::domain::PlaytimeSlotTransportTarget), - PlaytimeColumnAction(crate::domain::PlaytimeColumnActionTarget), - PlaytimeRowAction(crate::domain::PlaytimeRowActionTarget), + PlaytimeSlotTransportAction(PlaytimeSlotTransportTarget), + PlaytimeColumnAction(PlaytimeColumnActionTarget), + PlaytimeRowAction(PlaytimeRowActionTarget), PlaytimeSlotSeek(crate::domain::PlaytimeSlotSeekTarget), PlaytimeSlotVolume(crate::domain::PlaytimeSlotVolumeTarget), PlaytimeSlotManagementAction(crate::domain::PlaytimeSlotManagementActionTarget), @@ -273,36 +279,44 @@ impl Default for FxDisplayType { } impl ReaperTarget { - pub fn from_simple_target(simple_target: playtime_api::runtime::SimpleMappingTarget) -> Self { - use playtime_api::runtime::SimpleMappingTarget::*; + pub fn from_simple_target(simple_target: SimpleMappingTarget) -> Self { + use SimpleMappingTarget::*; match simple_target { - TriggerMatrix => { - Self::PlaytimeMatrixAction(crate::domain::PlaytimeMatrixActionTarget { - action: realearn_api::persistence::PlaytimeMatrixAction::Stop, - }) - } - TriggerColumn(t) => { - Self::PlaytimeColumnAction(crate::domain::PlaytimeColumnActionTarget { - column_index: t.index, - action: realearn_api::persistence::PlaytimeColumnAction::Stop, - }) - } - TriggerRow(t) => Self::PlaytimeRowAction(crate::domain::PlaytimeRowActionTarget { + TriggerMatrix => Self::PlaytimeMatrixAction(PlaytimeMatrixActionTarget { + action: PlaytimeMatrixAction::Stop, + }), + TriggerColumn(t) => Self::PlaytimeColumnAction(PlaytimeColumnActionTarget { + column_index: t.index, + action: PlaytimeColumnAction::Stop, + }), + TriggerRow(t) => Self::PlaytimeRowAction(PlaytimeRowActionTarget { basics: crate::domain::ClipRowTargetBasics { row_index: t.index, - action: realearn_api::persistence::PlaytimeRowAction::PlayScene, + action: PlaytimeRowAction::PlayScene, }, }), - TriggerSlot(t) => { - Self::PlaytimeSlotTransportAction(crate::domain::PlaytimeSlotTransportTarget { - project: Reaper::get().current_project(), - basics: crate::domain::ClipTransportTargetBasics { - slot_address: t, - action: realearn_api::persistence::PlaytimeSlotTransportAction::Trigger, - options: Default::default(), - }, + TriggerSlot(t) => Self::PlaytimeSlotTransportAction(PlaytimeSlotTransportTarget { + project: Reaper::get().current_project(), + basics: crate::domain::ClipTransportTargetBasics { + slot_address: t, + action: PlaytimeSlotTransportAction::Trigger, + options: Default::default(), + }, + }), + SmartRecord => Self::PlaytimeMatrixAction(PlaytimeMatrixActionTarget { + action: PlaytimeMatrixAction::SmartRecord, + }), + EnterSilenceModeOrPlayIgnited => { + Self::PlaytimeMatrixAction(PlaytimeMatrixActionTarget { + action: PlaytimeMatrixAction::EnterSilenceModeOrPlayIgnited, }) } + SequencerRecordOnOffState => Self::PlaytimeMatrixAction(PlaytimeMatrixActionTarget { + action: PlaytimeMatrixAction::SequencerRecordOnOffState, + }), + SequencerPlayOnOffState => Self::PlaytimeMatrixAction(PlaytimeMatrixActionTarget { + action: PlaytimeMatrixAction::SequencerPlayOnOffState, + }), } } diff --git a/main/src/domain/targets/playtime_matrix_action_target.rs b/main/src/domain/targets/playtime_matrix_action_target.rs index f88c893dd..92fc26ad4 100644 --- a/main/src/domain/targets/playtime_matrix_action_target.rs +++ b/main/src/domain/targets/playtime_matrix_action_target.rs @@ -79,10 +79,14 @@ mod playtime_impl { use helgoboss_learn::{AbsoluteValue, ControlType, ControlValue, Target, UnitValue}; use playtime_api::persistence::{EvenQuantization, RecordLength}; - use playtime_clip_engine::base::{ClipMatrixEvent, Matrix}; + use playtime_clip_engine::base::{ClipMatrixEvent, Matrix, SequencerStatus}; use playtime_clip_engine::rt::{QualifiedSlotChangeEvent, SlotChangeEvent}; use realearn_api::persistence::PlaytimeMatrixAction; + use realearn_api::persistence::PlaytimeMatrixAction::{ + EnterSilenceModeOrPlayIgnited, SequencerPlayOnOffState, SequencerRecordOnOffState, + SilenceModeOnOffState, + }; use std::borrow::Cow; impl PlaytimeMatrixActionTarget { @@ -148,6 +152,46 @@ mod playtime_impl { PlaytimeMatrixAction::MidiAutoQuantizationOnOffState => { matrix.set_midi_auto_quantize_enabled(value.is_on()); } + PlaytimeMatrixAction::SmartRecord => { + if !value.is_on() { + return Ok(HitResponse::ignored()); + } + matrix.trigger_smart_record()?; + } + PlaytimeMatrixAction::EnterSilenceModeOrPlayIgnited => { + if value.is_on() { + matrix.enter_silence_mode(); + } else { + matrix.play_all_ignited(); + } + } + PlaytimeMatrixAction::SilenceModeOnOffState => { + if value.is_on() { + matrix.enter_silence_mode(); + } else { + matrix.leave_silence_mode(); + } + } + PlaytimeMatrixAction::Panic => { + if !value.is_on() { + return Ok(HitResponse::ignored()); + } + matrix.panic(); + } + PlaytimeMatrixAction::SequencerRecordOnOffState => { + if value.is_on() { + matrix.record_new_sequence(); + } else { + matrix.stop_sequencer(); + } + } + PlaytimeMatrixAction::SequencerPlayOnOffState => { + if value.is_on() { + matrix.play_active_sequence()?; + } else { + matrix.stop_sequencer(); + } + } } Ok(HitResponse::processed_with_effect()) } @@ -281,6 +325,22 @@ mod playtime_impl { PlaytimeMatrixAction::MidiAutoQuantizationOnOffState => { matrix.midi_auto_quantize_enabled() } + PlaytimeMatrixAction::SmartRecord => { + return None; + } + PlaytimeMatrixAction::EnterSilenceModeOrPlayIgnited => { + matrix.is_in_silence_mode() + } + PlaytimeMatrixAction::SilenceModeOnOffState => matrix.is_in_silence_mode(), + PlaytimeMatrixAction::Panic => { + return None; + } + PlaytimeMatrixAction::SequencerRecordOnOffState => { + matrix.sequencer().status() == SequencerStatus::Recording + } + PlaytimeMatrixAction::SequencerPlayOnOffState => { + matrix.sequencer().status() == SequencerStatus::Playing + } }; Some(AbsoluteValue::from_bool(bool_value)) }) @@ -341,11 +401,18 @@ mod playtime_impl { | Stop | Undo | Redo - | BuildScene => ( + | BuildScene + | Panic + | SmartRecord => ( ControlType::AbsoluteContinuousRetriggerable, TargetCharacter::Trigger, ), - ClickOnOffState | MidiAutoQuantizationOnOffState => { + ClickOnOffState + | MidiAutoQuantizationOnOffState + | SilenceModeOnOffState + | SequencerRecordOnOffState + | SequencerPlayOnOffState + | EnterSilenceModeOrPlayIgnited => { (ControlType::AbsoluteContinuous, TargetCharacter::Switch) } } diff --git a/main/src/infrastructure/proto/generated.rs b/main/src/infrastructure/proto/generated.rs index 642d9f1f7..0b8d3b0d9 100644 --- a/main/src/infrastructure/proto/generated.rs +++ b/main/src/infrastructure/proto/generated.rs @@ -1512,9 +1512,17 @@ pub enum TriggerMatrixAction { SequencerStop = 20, SequencerWriteToArrangement = 21, SequencerCleanArrangement = 22, - ToggleLearnSimpleMapping = 23, - RemoveSimpleMapping = 24, TriggerSmartRecord = 25, + ToggleLearnSimpleMappingTrigger = 23, + ToggleLearnSimpleMappingSmartRecord = 26, + ToggleLearnSimpleMappingEnterSilenceModeOrPlayIgnited = 27, + ToggleLearnSimpleMappingSequencerRecordOnOffState = 28, + ToggleLearnSimpleMappingSequencerPlayOnOffState = 29, + RemoveSimpleMappingTrigger = 24, + RemoveSimpleMappingSmartRecord = 30, + RemoveSimpleMappingEnterSilenceModeOrPlayIgnited = 31, + RemoveSimpleMappingSequencerRecordOnOffState = 32, + RemoveSimpleMappingSequencerPlayOnOffState = 33, } impl TriggerMatrixAction { /// String value of the enum field names used in the ProtoBuf definition. @@ -1552,15 +1560,39 @@ impl TriggerMatrixAction { TriggerMatrixAction::SequencerCleanArrangement => { "TRIGGER_MATRIX_ACTION_SEQUENCER_CLEAN_ARRANGEMENT" } - TriggerMatrixAction::ToggleLearnSimpleMapping => { - "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING" - } - TriggerMatrixAction::RemoveSimpleMapping => { - "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING" - } TriggerMatrixAction::TriggerSmartRecord => { "TRIGGER_MATRIX_ACTION_TRIGGER_SMART_RECORD" } + TriggerMatrixAction::ToggleLearnSimpleMappingTrigger => { + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_TRIGGER" + } + TriggerMatrixAction::ToggleLearnSimpleMappingSmartRecord => { + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_SMART_RECORD" + } + TriggerMatrixAction::ToggleLearnSimpleMappingEnterSilenceModeOrPlayIgnited => { + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_ENTER_SILENCE_MODE_OR_PLAY_IGNITED" + } + TriggerMatrixAction::ToggleLearnSimpleMappingSequencerRecordOnOffState => { + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_SEQUENCER_RECORD_ON_OFF_STATE" + } + TriggerMatrixAction::ToggleLearnSimpleMappingSequencerPlayOnOffState => { + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_SEQUENCER_PLAY_ON_OFF_STATE" + } + TriggerMatrixAction::RemoveSimpleMappingTrigger => { + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_TRIGGER" + } + TriggerMatrixAction::RemoveSimpleMappingSmartRecord => { + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_SMART_RECORD" + } + TriggerMatrixAction::RemoveSimpleMappingEnterSilenceModeOrPlayIgnited => { + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_ENTER_SILENCE_MODE_OR_PLAY_IGNITED" + } + TriggerMatrixAction::RemoveSimpleMappingSequencerRecordOnOffState => { + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_SEQUENCER_RECORD_ON_OFF_STATE" + } + TriggerMatrixAction::RemoveSimpleMappingSequencerPlayOnOffState => { + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_SEQUENCER_PLAY_ON_OFF_STATE" + } } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1589,15 +1621,39 @@ impl TriggerMatrixAction { "TRIGGER_MATRIX_ACTION_SEQUENCER_CLEAN_ARRANGEMENT" => { Some(Self::SequencerCleanArrangement) } - "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING" => { - Some(Self::ToggleLearnSimpleMapping) - } - "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING" => { - Some(Self::RemoveSimpleMapping) - } "TRIGGER_MATRIX_ACTION_TRIGGER_SMART_RECORD" => { Some(Self::TriggerSmartRecord) } + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_TRIGGER" => { + Some(Self::ToggleLearnSimpleMappingTrigger) + } + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_SMART_RECORD" => { + Some(Self::ToggleLearnSimpleMappingSmartRecord) + } + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_ENTER_SILENCE_MODE_OR_PLAY_IGNITED" => { + Some(Self::ToggleLearnSimpleMappingEnterSilenceModeOrPlayIgnited) + } + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_SEQUENCER_RECORD_ON_OFF_STATE" => { + Some(Self::ToggleLearnSimpleMappingSequencerRecordOnOffState) + } + "TRIGGER_MATRIX_ACTION_TOGGLE_LEARN_SIMPLE_MAPPING_SEQUENCER_PLAY_ON_OFF_STATE" => { + Some(Self::ToggleLearnSimpleMappingSequencerPlayOnOffState) + } + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_TRIGGER" => { + Some(Self::RemoveSimpleMappingTrigger) + } + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_SMART_RECORD" => { + Some(Self::RemoveSimpleMappingSmartRecord) + } + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_ENTER_SILENCE_MODE_OR_PLAY_IGNITED" => { + Some(Self::RemoveSimpleMappingEnterSilenceModeOrPlayIgnited) + } + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_SEQUENCER_RECORD_ON_OFF_STATE" => { + Some(Self::RemoveSimpleMappingSequencerRecordOnOffState) + } + "TRIGGER_MATRIX_ACTION_REMOVE_SIMPLE_MAPPING_SEQUENCER_PLAY_ON_OFF_STATE" => { + Some(Self::RemoveSimpleMappingSequencerPlayOnOffState) + } _ => None, } } diff --git a/main/src/infrastructure/proto/playtime_request_handler.rs b/main/src/infrastructure/proto/playtime_request_handler.rs index a2b4d7122..598bc223d 100644 --- a/main/src/infrastructure/proto/playtime_request_handler.rs +++ b/main/src/infrastructure/proto/playtime_request_handler.rs @@ -277,14 +277,52 @@ impl PlaytimeProtoRequestHandler { matrix.tap_tempo(); Ok(()) } - TriggerMatrixAction::ToggleLearnSimpleMapping => { + TriggerMatrixAction::ToggleLearnSimpleMappingTrigger => { matrix.toggle_learn_source_by_target(SimpleMappingTarget::TriggerMatrix); Ok(()) } - TriggerMatrixAction::RemoveSimpleMapping => { + TriggerMatrixAction::ToggleLearnSimpleMappingEnterSilenceModeOrPlayIgnited => { + matrix.toggle_learn_source_by_target( + SimpleMappingTarget::EnterSilenceModeOrPlayIgnited, + ); + Ok(()) + } + TriggerMatrixAction::ToggleLearnSimpleMappingSmartRecord => { + matrix.toggle_learn_source_by_target(SimpleMappingTarget::SmartRecord); + Ok(()) + } + TriggerMatrixAction::ToggleLearnSimpleMappingSequencerPlayOnOffState => { + matrix.toggle_learn_source_by_target(SimpleMappingTarget::SequencerPlayOnOffState); + Ok(()) + } + TriggerMatrixAction::ToggleLearnSimpleMappingSequencerRecordOnOffState => { + matrix + .toggle_learn_source_by_target(SimpleMappingTarget::SequencerRecordOnOffState); + Ok(()) + } + TriggerMatrixAction::RemoveSimpleMappingTrigger => { matrix.toggle_learn_source_by_target(SimpleMappingTarget::TriggerMatrix); Ok(()) } + TriggerMatrixAction::RemoveSimpleMappingEnterSilenceModeOrPlayIgnited => { + matrix.toggle_learn_source_by_target( + SimpleMappingTarget::EnterSilenceModeOrPlayIgnited, + ); + Ok(()) + } + TriggerMatrixAction::RemoveSimpleMappingSmartRecord => { + matrix.toggle_learn_source_by_target(SimpleMappingTarget::SmartRecord); + Ok(()) + } + TriggerMatrixAction::RemoveSimpleMappingSequencerPlayOnOffState => { + matrix.toggle_learn_source_by_target(SimpleMappingTarget::SequencerPlayOnOffState); + Ok(()) + } + TriggerMatrixAction::RemoveSimpleMappingSequencerRecordOnOffState => { + matrix + .toggle_learn_source_by_target(SimpleMappingTarget::SequencerRecordOnOffState); + Ok(()) + } TriggerMatrixAction::TriggerSmartRecord => matrix.trigger_smart_record(), }) } diff --git a/playtime-api/src/runtime/app.rs b/playtime-api/src/runtime/app.rs index cae66b498..127529f7e 100644 --- a/playtime-api/src/runtime/app.rs +++ b/playtime-api/src/runtime/app.rs @@ -46,4 +46,8 @@ pub enum SimpleMappingTarget { TriggerColumn(ColumnAddress), TriggerRow(RowAddress), TriggerSlot(SlotAddress), + SmartRecord, + EnterSilenceModeOrPlayIgnited, + SequencerRecordOnOffState, + SequencerPlayOnOffState, } diff --git a/playtime-clip-engine b/playtime-clip-engine index 729e1c95c..2d4df20fc 160000 --- a/playtime-clip-engine +++ b/playtime-clip-engine @@ -1 +1 @@ -Subproject commit 729e1c95c32f5d8f75d32aef3dc5304ddb22a95d +Subproject commit 2d4df20fcc33bcbc0a8ce8b4ad00a083905bfb08