Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #36667

Read in cakewalk instrument files banks and their content and hold in coherent manner.

Newsgroups comp.lang.javascript
Date 2019-05-29 06:43 -0700
Message-ID <30b489af-8a97-43be-9ef8-94da87ce7d7a@googlegroups.com> (permalink)
Subject Read in cakewalk instrument files banks and their content and hold in coherent manner.
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Well i skipped creating any object probably for the better, it reads in bank names in arrays and list array in the bank option list. The same with respective instruments in bank.

And at change read in the instrument for bank in question into the option list for the bank selected, just by split the string iont array "and tweaking empty lines not perfect". Simple is better.... or.... 

Yeah i know it will do it everytime.... Well that had only been once with an object but added complexity, that i am not the man to handle. I also fixed so one can read in other instrument files but "my KORG N364" is default.

Now it is just to send the message for bank chosen to synth, depending on selection.

function splitInstrumentFile(ATXT){
	bankName=[];
	var PatchStart = ATXT.indexOf(".Patch Names",0);
	var NoteStart = ATXT.indexOf(".Note Names",0);
	var allBANKS=ATXT.substring(PatchStart+12,NoteStart);
	listBanks(allBANKS);
}

function listBanks(allBANKS){
	console.log("Write out just the banks"+allBANKS);
	Abank = allBANKS.split("[");
	Abank.shift();
	for(i=0;i<Abank.length;i++){
    //alert(Abank[i]);
	getBankName(i);	
    }
	//alert(bankName);
	bankOptionList();
	defaultBank=1;
	document.getElementById("selBank").selectedIndex = defaultBank;
	ListBankInstruments(defaultBank);
}

function getBankName(i){
	var ENDBANKNAME = Abank[i].indexOf("]",0);
	bankName[i]=Abank[i].substring(0,ENDBANKNAME);
}

function ListBankInstruments(current){
	//REMOVE EMPTY LINES FROM BANK
    Abank[current]=Abank[current].replace(/^\s*[\r]/gm,"");
	//SPLIT BANK INTO ARRAY OF INSTRUMENTS
	instName=Abank[current].split("\n");
	//REMOVE FIRST LINE "BANKNAME"
	instName.shift();
	//alert(instName);
	instOptionList();
}

function bankSelection(){
	current=document.getElementById("selBank").selectedIndex;
	ListBankInstruments(current);
}

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-29 06:43 -0700
  Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 04:26 -0700
    Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. JJ <jj4public@vfemail.net> - 2019-06-02 09:28 +0700
      Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 23:23 -0700
        Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 23:26 -0700
          Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. JJ <jj4public@vfemail.net> - 2019-06-03 10:51 +0700
            Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-02 22:32 -0700
            Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2019-06-03 11:43 +0300
            Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. dr.j.r.stockton@gmail.com - 2019-06-03 02:31 -0700
              Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-03 12:25 +0200
              Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-03 04:07 -0700
  Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 04:27 -0700
  Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 07:04 -0700
    Re: Read in cakewalk instrument files banks and their content and hold in coherent manner. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 07:05 -0700

csiph-web