Scanning through all tracks and devices

Post Reply New Topic
RELATED
PRODUCTS

Post

hi. i am trying to get my head around how i can scan through all tracks and devices to get their names and values.

i managed to get all track names and tracktypes. but when i try to get through all devices in a track and try to display the name i get this error: "TypeError: undefined has no such function "name"


here is part of the code:

Code: Select all

function init() {
   
   trackBank = host.createTrackBank (100, 0, 0);
   numTracks = trackBank.getSizeOfBank();
   
   //var track = null;

   for (var i = 0; i < numTracks; i++)
   {
      var track = trackBank.getItemAt(i);
      var devices = track.createDeviceBank(50);
      var numDevices = devices.getSizeOfBank();

      tracks.push(tracks);
      
      track.name().addValueObserver(nameCallbackFunction(i, function(index, name)
      {
         if(name != "")
         {
            println("Track: " + name);
            tracknames.push(name);
             
         }
      }));
      track.trackType().addValueObserver(trackTypeCallbackFunction(i, function(index, tracktype)
		{
         if(tracktype =="Instrument" || tracktype =="Audio" || tracktype =="Group")
         {
            println("|| " + tracktype);
            tracktypes.push(tracktype);
            //getDevices(devices, index);  
            
         }
         
		}));
      for (var j = 0; j < numDevices; j++)
      {
         //var device = devices.getDevice(j);
         if(devices[j] != undefined)
         {
            devices[j].name().addValueObserver(nameCallbackFunction(j, function(index, name)
            {
               println("Device: " + name);
            }));
         }
        
      }
     
   }
   
   
   
   println("LockStates initialized!    " + new Date().toLocaleTimeString());
}
i have tried to add "host.scheduleTask". but the code never gets executed then.
any help is very appreciated. cheers, steve

the goal here is to save all parameter values of all devices in a project into arrays
maybe thats not possible at all and i am just wasting my time. please let me know

Post

Hey.. take a look at my extension. Might give you some ideas. I'm only mapping 1 value the plugin window. Still need to fine tune.

https://github.com/kirkwoodwest/Bitwig- ... ow-Control

Also watch mosses tutorials on extension making.
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

thanks man
Kirkwood West wrote: Thu Mar 02, 2023 12:20 pm Hey.. take a look at my extension. Might give you some ideas. I'm only mapping 1 value the plugin window. Still need to fine tune.

https://github.com/kirkwoodwest/Bitwig- ... ow-Control

Also watch mosses tutorials on extension making.

Post Reply

Return to “Controller Scripting”