Jump to content


Photo

[Solved] .copy_device_chain_at(track_index1, track_index2) ???

copy device chain device chain track

  • Please log in to reply
6 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 931 posts
  • Gender:Male
  • Location:Spain

Posted 29 June 2017 - 12:00

Is there any easy way to copy a complete device chain from one track to another track?

 

It would be nice to have this:

1. renoise.song().copy_device_chain_at(track_index1, track_index2)

 

    &

 

2. renoise.song().tracks[].device[]:copy_from(other device of other track)

Note: with device[ i ] would be possible to iterate to copy the entire device chain of the desired track, for example: for i = 1, max_number_devices do. Thus, it might be possible to discard some devices of the selection as well, checking the type of device with a if ... then.

 

Existing related documentation:

-- Insert a new device at the given position. "device_path" must be one of
-- renoise.song().tracks[].available_devices.
renoise.song().tracks[]:insert_device_at(device_path, device_index)
  -> [newly created renoise.AudioDevice object]
-- Delete an existing device in a track. The mixer device at index 1 can not
-- be deleted from a track.
renoise.song().tracks[]:delete_device_at(device_index)
-- Swap the positions of two devices in the device chain. The mixer device at
-- index 1 can not be swapped or moved.
renoise.song().tracks[]:swap_devices_at(device_index1, device_index2)

-- Access to a single device by index. Use properties 'devices' to iterate 
-- over all devices and to query the device count.
renoise.song().tracks:device(index)
  -> [renoise.AudioDevice object]

My intention is simple. Being able to copy the entire device chain from one track to another track, and if possible, have some flexibility. It would include in a button for cloning entire track (which I have already built).

 

Any idea to do this?


Edited by Raul (ulneiz), 30 June 2017 - 12:36.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 18 July 2017):

Spoiler

#2 danoise

danoise

    Probably More God or Borg Than Human Member

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

Posted 29 June 2017 - 15:01

Nope, not a track-wide copy function. The API is expecting you to iterate through, and copy each device, one by one. 

However, it gets (a lot!) more tricky if you're using meta-devices, as they can link to other devices - even devices outside the source track. 

 

My xrni-merger tool contains code, which can identify such "networks" (multiple chains linked together with meta-devices) and can recreate the network in a different place. 

Would be cool (actually, is planned) to extract this functionality and include it in the xLib library as a one-liner. 


Tracking with Stuff. API wishlist | Soundcloud


#3 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 931 posts
  • Gender:Male
  • Location:Spain

Posted 30 June 2017 - 10:00

Nope, not a track-wide copy function. The API is expecting you to iterate through, and copy each device, one by one. 

However, it gets (a lot!) more tricky if you're using meta-devices, as they can link to other devices - even devices outside the source track. 

 

My xrni-merger tool contains code, which can identify such "networks" (multiple chains linked together with meta-devices) and can recreate the network in a different place. 

Would be cool (actually, is planned) to extract this functionality and include it in the xLib library as a one-liner. 

 

Thanks! I would like to have a function that could also prevent the meta-devices (or not), have some control with the function. What I do not know is what code line you can use to copy a device from one track to another. In the documentation there does not seem to be such a thing.

 

Is it also necessary to store in a cache or something the parameters of each device in order to copy or duplicate it? Or is there a form of pure copy?


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 18 July 2017):

Spoiler

#4 danoise

danoise

    Probably More God or Borg Than Human Member

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

Posted 30 June 2017 - 10:16

What I do not know is what code line you can use to copy a device from one track to another. In the documentation there does not seem to be such a thing.

 

You can use the 'active_preset_data' for this purpose.

 

As a reference, you can see how I'm doing it in the xrni-merger: 

https://github.com/r.../main.lua#L1784


Tracking with Stuff. API wishlist | Soundcloud


#5 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 931 posts
  • Gender:Male
  • Location:Spain

Posted 30 June 2017 - 11:42

You can use the 'active_preset_data' for this purpose.

 

As a reference, you can see how I'm doing it in the xrni-merger: 

https://github.com/r.../main.lua#L1784

 

Thanks! Ok, I'll look at it in depth. Let's see if I understood correctly: 'active_preset_data' are the configuration values of the individual selected devide, or all the values of the entire chain? Or is it something else?

 

Spoiler

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 18 July 2017):

Spoiler

#6 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 931 posts
  • Gender:Male
  • Location:Spain

Posted 30 June 2017 - 12:35

Ok, doubts resolved!!  :D

 

Thanks!


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 18 July 2017):

Spoiler

#7 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 931 posts
  • Gender:Male
  • Location:Spain

Posted 30 June 2017 - 14:55

This is a crude function for clone the device chain in next track:

function clone_devices( song, sti, devices, device_path )
  song = renoise.song()
  sti = song.selected_track_index
  devices = #song.tracks[ sti ].devices
  
  --rprint (song.tracks[ sti ].available_devices)

  for dev = 1, devices do
    device_path = song.tracks[ sti ]:device( dev ).device_path
    if ( dev > 1 ) then
      song.tracks[ sti + 1 ]:insert_device_at( device_path, dev )
    end
    song.tracks[ sti + 1 ].devices[ dev ].active_preset_data = song.tracks[ sti ].devices[ dev ].active_preset_data
  end
end

If exist a problem with meta-devices, it would be possible to discard the device number inside the iterate. This is possible to insert inside a button for cloning entire track.

 

I suppose there is something similar to be able to clone the automation curves. I have created a multibutton with these characteristics:

  1. Principal button for clone track (without notes)
  2. A minibutton-checkbox for clone the notes to pattern-track
  3. A minibutton-checkbox for clone the notes to entire track
  4. A minibutton-checkbox for clone the entire device chain
  5. A minibutton-checkbox for clone the automation to pattern-track
  6. A minibutton-checkbox for clone the automation to entire track

Possible estructure:

 

[ 2 ]   |            |   [ 5 ]   |    |

         |     1     |            | 4 |

[ 3 ]   |            |   [ 6 ]   |    |

 

I still need to create the functions for buttons 5 and 6.


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 18 July 2017):

Spoiler