Get clipnames from first track
-
wimvandenborre wimvandenborre https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=462766
- KVRer
- Topic Starter
- 12 posts since 18 Apr, 2020
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?
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?
-
wimvandenborre wimvandenborre https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=462766
- KVRer
- Topic Starter
- 12 posts since 18 Apr, 2020
Ok found it:
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?
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");
}
});
}
-
wimvandenborre wimvandenborre https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=462766
- KVRer
- Topic Starter
- 12 posts since 18 Apr, 2020
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!
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!
-
wimvandenborre wimvandenborre https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=462766
- KVRer
- Topic Starter
- 12 posts since 18 Apr, 2020
Continueing my monologue
I found the trackname, now when i try to put an observer on the track i always get a null error any ideas?
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);
}
}));
}
- KVRist
- 325 posts since 12 Apr, 2020
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
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
-
wimvandenborre wimvandenborre https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=462766
- KVRer
- Topic Starter
- 12 posts since 18 Apr, 2020
Hey hey, switched over to java and solved the problem, see you on the discord (i'm borrierulez on there )
- KVRer
- 18 posts since 18 Jul, 2021
I found it:
But how can I get the playback state of a scene? For tracks there is the addPlaybackStateObserver but that doesn't work for scenes.
Code: Select all
sceneBank = host.createSceneBank(numScenes);
sceneBank.addNameObserver(function (slotIndex, name) { ... });
- KVRist
- 325 posts since 12 Apr, 2020
Scenes don't have any playback state they are containers to launch and stop clips.arsc wrote: ↑Sun Dec 31, 2023 2:12 pm I found it:
But how can I get the playback state of a scene? For tracks there is the addPlaybackStateObserver but that doesn't work for scenes.Code: Select all
sceneBank = host.createSceneBank(numScenes); sceneBank.addNameObserver(function (slotIndex, name) { ... });
----------------------------------------------------------------------
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest
http://instagram.com/kirkwoodwest/
http://soundcloud.com/kirkwoodwest