From 6ed65f8698528df6f04881f520ba7fd93fbb3716 Mon Sep 17 00:00:00 2001 From: Alessandro Date: Sat, 28 Dec 2024 17:16:58 +0100 Subject: [PATCH] insert file --- .../mossgrabers/bitwig/framework/daw/data/SlotImpl.java | 7 +++++++ .../mossgrabers/controller/osc/module/AbstractModule.java | 1 + .../de/mossgrabers/controller/osc/module/TrackModule.java | 3 +++ .../java/de/mossgrabers/framework/daw/data/ISlot.java | 5 +++++ .../mossgrabers/framework/daw/data/empty/EmptySlot.java | 8 ++++++++ 5 files changed, 24 insertions(+) diff --git a/src/main/java/de/mossgrabers/bitwig/framework/daw/data/SlotImpl.java b/src/main/java/de/mossgrabers/bitwig/framework/daw/data/SlotImpl.java index f7c3a9ca6..d7e12f75e 100755 --- a/src/main/java/de/mossgrabers/bitwig/framework/daw/data/SlotImpl.java +++ b/src/main/java/de/mossgrabers/bitwig/framework/daw/data/SlotImpl.java @@ -251,6 +251,13 @@ public void duplicate () this.slot.duplicateClip (); } + /** {@inheritDoc} */ + @Override + public void insertFile (String path) + { + this.slot.replaceInsertionPoint ().insertFile (path); + } + /** {@inheritDoc} */ @Override diff --git a/src/main/java/de/mossgrabers/controller/osc/module/AbstractModule.java b/src/main/java/de/mossgrabers/controller/osc/module/AbstractModule.java index 08e8785e5..e56692535 100644 --- a/src/main/java/de/mossgrabers/controller/osc/module/AbstractModule.java +++ b/src/main/java/de/mossgrabers/controller/osc/module/AbstractModule.java @@ -35,6 +35,7 @@ public abstract class AbstractModule implements IModule protected static final String TAG_SELECTED = "selected"; protected static final String TAG_SELECT = "select"; protected static final String TAG_DUPLICATE = "duplicate"; + protected static final String TAG_INSERT_FILE = "insertFile"; protected static final String TAG_REMOVE = "remove"; protected static final String TAG_VOLUME = "volume"; protected static final String TAG_PAGE = "page"; diff --git a/src/main/java/de/mossgrabers/controller/osc/module/TrackModule.java b/src/main/java/de/mossgrabers/controller/osc/module/TrackModule.java index 18393f1c7..ae2ad5ba5 100644 --- a/src/main/java/de/mossgrabers/controller/osc/module/TrackModule.java +++ b/src/main/java/de/mossgrabers/controller/osc/module/TrackModule.java @@ -524,6 +524,9 @@ private void parseClipValue (final ITrack track, final LinkedList path, case "create": this.model.createNoteClip (track, slot, toInteger (value), true); break; + case TAG_INSERT_FILE: + slot.insertFile (toString (value)); + break; case TAG_DUPLICATE: slot.duplicate (); break; diff --git a/src/main/java/de/mossgrabers/framework/daw/data/ISlot.java b/src/main/java/de/mossgrabers/framework/daw/data/ISlot.java index 3a52c6c96..339cd4855 100755 --- a/src/main/java/de/mossgrabers/framework/daw/data/ISlot.java +++ b/src/main/java/de/mossgrabers/framework/daw/data/ISlot.java @@ -112,6 +112,11 @@ public interface ISlot extends IItem */ void duplicate (); + /** + * Insert a file in a clip. + * @param path the file path + */ + void insertFile (String path); /** * Past the content of the given slot into this slot. diff --git a/src/main/java/de/mossgrabers/framework/daw/data/empty/EmptySlot.java b/src/main/java/de/mossgrabers/framework/daw/data/empty/EmptySlot.java index 6fabe70f4..d718d01fe 100644 --- a/src/main/java/de/mossgrabers/framework/daw/data/empty/EmptySlot.java +++ b/src/main/java/de/mossgrabers/framework/daw/data/empty/EmptySlot.java @@ -132,6 +132,14 @@ public void duplicate () } + /** {@inheritDoc} */ + @Override + public void insertFile (String path) + { + // Intentionally empty + } + + /** {@inheritDoc} */ @Override public void paste (final ISlot slot)