Get clipnames from first track

Post Reply New Topic
RELATED
PRODUCTS

Post

Hey everyone,

Taking my first steps to read the clipname in from a clip that's playing for example in track 1.

I've tried setting observers (i can see if a clip is playing) but after a few hours of struggle i don't know how to get the name out of a clip. I don't seem to wrap my head around how this is build.

Anyone an idea?

Post

Ok found it:

Code: Select all

    var cursorClip = host.createLauncherCursorClip(1, 1); // Create a global cursor clip
    var trackBank = host.createTrackBank(1, 0, 1);  // Create a single track bank
    var track = trackBank.getItemAt(0);  // Get the first track
    
    var clipLauncherSlots = track.getClipLauncherSlots();
    
    clipLauncherSlots.addNameObserver(function(slotIndex, name) {
        if (name !== "Unnamed") {  // Check if clip has a name
            println("Clip at slot " + slotIndex + " has name: " + name);
          host.showPopupNotification("Clip at slot " + slotIndex + " has name: " + name);
        }
    });
    
    clipLauncherSlots.addIsPlayingObserver(function(slotIndex, isPlaying) {
        if (isPlaying) {
            println("Clip at slot " + slotIndex + " is playing!");

            var slot = clipLauncherSlots.getItemAt(slotIndex);
            slot.select();
            // cursorClip.setName("NewName");
        }
    });
}
How could i display the name now in a real window? Is there an external lib i could use and should i transmit the string over OSC or other methods?

Post

ok send to osc works also.

If someone would know how to display a native window in Bitwig (if possible) would be Awesome.

Also i would like the script to scan the project, look for a track named "displaynames" for example and have the name popup whenever i play a clip in this track.

help would be much appreciated!

Post

Continueing my monologue :D
I found the trackname, now when i try to put an observer on the track i always get a null error any ideas?

Code: Select all

function makeIndexedFunction (index, f)
{
    return function (value)
    {
        f (index,value);
    }
}

function onTrackFound(track) {
    var clipLauncherSlotsTest= track.getClipLauncherSlots();

    clipLauncherSlotsTest.addNameObserver(function (slotIndex, name) {
        if (name !== "Unnamed") { // Check if clip has a name
            println("Clip at slot " + slotIndex + " has name: " + name);
            host.showPopupNotification("Clip at slot " + slotIndex + " has name: " + name);
        }
    });
}


const MAX_TRACKS = 100;
var trackBank = null;
var defIndex = -1;

function init() {
    
  println("ReadClipNamePopup initialized!");
  var trackNameToSearch = "showPopupInfo";
  
  trackBank = host.createTrackBank (MAX_TRACKS, 0, 0, true);

  for (var i = 0; i < MAX_TRACKS; i++) {
      trackBank.getChannel(i).name().addValueObserver(makeIndexedFunction(i, function (index, name) {
          if (name.length == 0)
              return;
          // Match the new track name against all settings
          if (name === trackNameToSearch) {
              println("found trackname: " + name);
              println("index: " + index);
              defIndex = index;
            var trackFound = trackBank.getItemAt(index);
            onTrackFound(trackFound);
          }
      }));
  }

Post

Been a while since I’ve done the .js. Did you solve your problem? What line do you get your null error on?
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post

Hey hey, switched over to java and solved the problem, see you on the discord (i'm borrierulez on there :) )

Post

Any idea how to get the scenenames?

Post

I found it:

Code: Select all

sceneBank = host.createSceneBank(numScenes);
sceneBank.addNameObserver(function (slotIndex, name) { ... });
But how can I get the playback state of a scene? For tracks there is the addPlaybackStateObserver but that doesn't work for scenes.

Post

arsc wrote: Sun Dec 31, 2023 2:12 pm I found it:

Code: Select all

sceneBank = host.createSceneBank(numScenes);
sceneBank.addNameObserver(function (slotIndex, name) { ... });
But how can I get the playback state of a scene? For tracks there is the addPlaybackStateObserver but that doesn't work for scenes.
Scenes don't have any playback state they are containers to launch and stop clips.
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest

Post Reply

Return to “Controller Scripting”