insertFile function

Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Hi there,

I just started messing with API and cannot figure out

Code: Select all (#)

insertFile(path)
function. Documentation says it's taking string as parameter, which I suspect is path to the file I'd like to load.

even this:

Code: Select all (#)

 const cursorTrack = host.createCursorTrack('Selected Track', 'Selected Track', 1, 1, true);
   const cs = cursorTrack.createCursorDevice()
   cs.exists().markInterested()
   if(cs.exists().get()) {
      cs.replaceDeviceInsertionPoint().browse();
      console.log("exists")
   }else{
      cs.deviceChain().endOfDeviceChainInsertionPoint().browse();
      console.log("does not exist")
   }
seems not to work at all (I've assigned console.log to host.println, in case you would like to point that out).
I'm not sure what is going on and I could not find any sources on github or via google that would illustrate that functionality. Anybody has a clue?

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
yep, got it

Code: Select all (#)

let  deviceBank, cursorDevice, cursorTrack;
let app;
let dev;
let basePath = "C:\\Program Files\\Bitwig Studio\\4.2.2\\Library\\devices\\";
function init() {


    app = host.createApplication()
   host.scheduleTask(run, 10);

   cursorTrack = host.createCursorTrack('Selected Track', 'Selected Track', 1, 1, true);
   cursorDevice = cursorTrack.createCursorDevice("Selected Device", "Selected Device", 0, CursorDeviceFollowMode.FIRST_INSTRUMENT);
    deviceBank = cursorTrack.createDeviceBank(8);
    dev = deviceBank.getDevice(0);
    
}
function run(){
   dev.replaceDeviceInsertionPoint().insertFile(basePath + "Polymer.bwdevice");


}
Seems like those objects are not ready on initialization, so slight delay does the trick

Post Reply

Return to “Controller Scripting”