remotescript - best practice for copy/paste clip_slot?

Learn about building and using Max for Live devices.
Post Reply
Angstrom
Posts: 14923
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

remotescript - best practice for copy/paste clip_slot?

Post by Angstrom » Fri Dec 16, 2016 5:44 pm

Hi all, slightly off-topic from M4L but not that much.

I'm making a remotescript for my FCB and most of the functions are in place but I'm looking for a the best method for copy/paste clip_slot . Does a method exist which I have missed?

Obviously we have access to the (somewhat awkward) duplicate_clip_slot which takes a scene index, and will place the duplicate in the slot directly beneath. I've made one of those before in JS for M4L and can port that to Python ... but what I really need is "copy clip_slot [a] on track [x] - to clip_slot on track[z]"
I'm choosing source and destination slots via launchpad and that part is all fine - but I can't find an authoritative method for "copy this clip" / "paste this clip"

Does one exist, did I miss it? or should I just make it myself?
I don't want to duplicate a function hidden somewhere.

S4racen
Posts: 5837
Joined: Fri Aug 24, 2007 4:08 pm
Location: Dunstable
Contact:

Re: remotescript - best practice for copy/paste clip_slot?

Post by S4racen » Fri Dec 16, 2016 7:36 pm

I may be wrong but that might only exist in the Push Two script??

Cheers
D

Angstrom
Posts: 14923
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Re: remotescript - best practice for copy/paste clip_slot?

Post by Angstrom » Fri Dec 16, 2016 8:00 pm

If it does exist in the push2 script then it's going to find itself being lifted out of there pretty shortly!
I'll see how easy it is to find the crucial section in that big pile of .py file which drive push2.

My strategy was going to be : source-clip-> grab the notes, then on the destination clipslot delete any existing clip then create a new clip with the required length and dump the notes into the new clip.
That's all very do-able, but if I can find a more elegant method I'll steal it.

I'll take a look through the push2 files this evening, thanks.

eclipxe
Posts: 96
Joined: Thu Dec 27, 2007 2:27 am

Re: remotescript - best practice for copy/paste clip_slot?

Post by eclipxe » Tue Dec 20, 2016 10:26 pm

Grabbing notes that way would lose the envelopes.

I'll check the decompiled 9.7 Push 2 scripts to see how they do this

Angstrom
Posts: 14923
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Re: remotescript - best practice for copy/paste clip_slot?

Post by Angstrom » Tue Dec 20, 2016 11:52 pm

Yeah, I manually scrolled through the relevant files, but didn't spot anything. So I did a directory wide search on the push2 .py files for stuff like "copy" "paste". But turned up nothing but some stuff related to drum cells. I spent 30 mins trying to think of searchable synonyms for "copy" :lol:
I got sidetracked into something else. I'll keep digging through the holiday break.

I can deal with losing the envelopes because my use cases for this are - 1: duplicate a pattern "bassline" to the same track to make a variation - so I'd be writing new envelopes. Case 2: dupe to a different track/ instrument (where the macros wouldnt match up)
So really the notes into a buffer dict would work OK.

eclipxe
Posts: 96
Joined: Thu Dec 27, 2007 2:27 am

Re: remotescript - best practice for copy/paste clip_slot?

Post by eclipxe » Wed Dec 21, 2016 7:13 am

pushbase/special_session_component.pyc_dis

def _perform_copy(self, target_clip_slot):
self._source_clip_slot.duplicate_clip_to(target_clip_slot)
self._on_duplicated(self._source_clip_slot, target_clip_slot)
self._reset_copying_state()


-----

_source_clip_slot.duplicate_clip_to(target_clip_slot)

Looks like a new API method - "duplicate_clip_to"

Hope this helps!

Angstrom
Posts: 14923
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Re: remotescript - best practice for copy/paste clip_slot?

Post by Angstrom » Wed Dec 21, 2016 9:06 am

Thanks that's great. My search totally missed those methods!
I'm pretty confident I can incorporate them now. I'll update the thread if I create anything amazing, or if I run into another wall of bafflement.
Thanks again.

Post Reply