Jump to content


Photo

Copy track to buffer, copy buffer to track


  • Please log in to reply
6 replies to this topic

#1 ffx

ffx

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2750 posts
  • Gender:Not Telling
  • Interests:Renoise Sidechain

Posted 10 August 2015 - 01:45

Hi,

 

I would like to copy a track content (notes, fx,...) to a buffer/table, and then later copy contents from buffer to track again.

 

My questions are:

 

1.  Does this copy the contents of track with num "tracked" in the current pattern to the buffer or just the reference or nothing?:

local buffer = s.patterns[s.selected_pattern_index].tracks[trackid]   -

 

2.  Does this copy contents from buffer to the track of the current pattern?

 

s.patterns[s.selected_pattern_index].tracks[trackid].copy_from(buffer)

 

3. Is the syntax above right?  I didn't get this difference between pattern track object and track object. 

 

Thanks for help



#2 ffx

ffx

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2750 posts
  • Gender:Not Telling
  • Interests:Renoise Sidechain

Posted 10 August 2015 - 08:56

And 4.

 

Is it possible to get the xml data from a track node, like tracks[num].to_xml() ?    Is tracks[num]  return a xml string?

 

If 1. is just a reference, can I duplicate the object using a standard lua recursive duplication function for objects?  This would I guess only work if there were magic methods defined for each kind of object, right?  


Edited by Jurek, 10 August 2015 - 08:59.


#3 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6069 posts
  • Gender:Male
  • Interests:wildlife + urban trekking

Posted 10 August 2015 - 10:43

1.  Does this copy the contents of track with num "tracked" in the current pattern to the buffer or just the reference or nothing?:

local buffer = s.patterns[s.selected_pattern_index].tracks[trackid]   -

 

2.  Does this copy contents from buffer to the track of the current pattern?

 

s.patterns[s.selected_pattern_index].tracks[trackid].copy_from(buffer)

 

3. Is the syntax above right?  I didn't get this difference between pattern track object and track object. 

 

Thanks for help

 

1. You are creating a reference to "live" userdata (C+ object), but not a new instance. 

You can't create new instances of these objects that are not tied to the song, somehow. 

 

So, your code might do the mistake of assuming that the source pattern is still around when it's time to copy to the target. 

But, at this time the source pattern might actually be gone, or have changed somehow. 

 

If you need to copy an entire pattern, I would recommend using a temp pattern to hold the results - so, that temp pattern essentially becomes the "buffer" 

 

 

Is it possible to get the xml data from a track node, like tracks[num].to_xml() ? 

 

If 1. is just a reference, can I duplicate the object using a standard lua recursive duplication function for objects?  This would I guess only work if there were magic methods defined for each kind of object, right?  

 

XML support in the API would be very nice to see. But right now, answer would be no :-D

 

PS: If you are planning to do recursive copies of tables, don't forget the 'extended' table.rcopy method - it's part in the Renoise API, but not standard Lua...

https://github.com/r...rd.API.lua#L123


Tracking with Stuff. API wishlist | Soundcloud


#4 ffx

ffx

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2750 posts
  • Gender:Not Telling
  • Interests:Renoise Sidechain

Posted 10 August 2015 - 11:00

Thanks for the info!

 

Yes, .toXML() would be a dream wouldn't?  As far as I understand, your simply could then copy any content to a variable and later insert the xml to the renoise xml song data...?

 

And a .revertToObject() of course :)

 

One problem do I have now:

 

I want to make a pattern copy-paste functionality / shortcuts that takes care of track names and also works for two Renoise app instances...

Like I have opened a song in an older version in Renoise A, and a newer version of the song in Renoise B. The newer song has some additional tracks, but the naming of the old tracks is identical with the naming in the old song version.

 

So I would like to copy each track data (including commands + automation) to a table with track name keys and then somehow then... convert to xml ? 

 

I think this idea won't work by using lua for cross-instance-copying, since

 

1. .copy_from() only works with a track object instance in the same app

 

2. No way to transfer custom copy-buffer data?

 

Any ideas here?

 

 

Wouldn't it be cool to have to more shortcuts "Pattern Editor:Pattern Operations:Copy by track names" and "Pattern Editor:Pattern Operations:Paste by track names" that would work cross-app-instance? I would set those to super-ctrl-F4 and super-ctrl-F5 then...



#5 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6069 posts
  • Gender:Male
  • Interests:wildlife + urban trekking

Posted 10 August 2015 - 11:40

So I would like to copy each track data (including commands + automation) to a table 

 
If you are copying from one song to another, how would you go about copying the automation data?

I mean, this would only work if you re-create the devices being automated in the target song as well. 

 

Or are you somehow assuming that the two songs are identical? 


Tracking with Stuff. API wishlist | Soundcloud


#6 ffx

ffx

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2750 posts
  • Gender:Not Telling
  • Interests:Renoise Sidechain

Posted 10 August 2015 - 13:03

no, songs would be almost  identical, assuming that identical named tracks would be have identical devices. (btw i think copy paste patterns, internally the automation is already copied by device name, not by device position). Currently if copy-paste pattern, it will simply paste the tracks contents in the order of the source song. So if a new track was inserted later, the pasting doesn't fit anymore. I would like this by track name...


Edited by Jurek, 10 August 2015 - 13:04.


#7 ffx

ffx

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2750 posts
  • Gender:Not Telling
  • Interests:Renoise Sidechain

Posted 10 August 2015 - 13:09

...or the internal copy-paste-pattern function of Renoise should be improved that it takes care of source and target track names, instead just positions. This would not change anything while copying within one song, but improve transferring between songs! If track names/ids not match = no copying.
 
But I won't write a feature request. Seems not make sense.  

<?xml version="1.0" encoding="UTF-8"?>
<PatternClipboard.PatternBuffer doc_version="0">
<Tracks>
<Track>
<Track>
<TrackName>Trackname</TrackName>

<AliasPatternIndex>-1</AliasPatternIndex>

<SelectedPresetName>Init</SelectedPresetName>
<SelectedPresetIsModified>false</SelectedPresetIsModified>
<ColorEnabled>false</ColorEnabled>
<Color>0,0,0</Color>
</Track>
...


Edited by Jurek, 12 August 2015 - 12:17.