| Thanks Steven and Andy,
I found a temporary inelegant solution using the host console.
It works in local but when I test it online p2 is set with a delay and do not correspond to the score instructions : for example if I trigger the score function three seconds after the "Csound ready" message, the value of p2 equals 3 while in the score line p2 equals 0.
Certainly mistakes or approximations in my code...
html:
csound:
instr 1
; instrument code, etc.
; sprintf and puts to show scorelines in console, the "scoreStatement" for filtering messages later
Stest sprintf "%s %s %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f", "scoreStatement", "i", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22
puts Stest,1
endin
Javascript:
var count = 0;
var scoreOn = false;
function handleMessage(message) {
var element = document.getElementById('console');
element.value += message;
var searchFilter = "scoreStatement"; filter only i instructions messages
if (scoreOn == true) {
message.includes(searchFilter) == true;
var parse = document.getElementById('display');
parse.value = message;
parseInstructions();
}
element.scrollTop = 99999; // focus on bottom
count += 1;
if (count == 1000) {
element.value = ' ';
count = 0;
}
}
function parseInstructions(){
var receiveStatement = document.getElementById('display').value;
var scoreDatas = receiveStatement.split(" ").slice(2); convert the filtered messages in array
/*the rest of the code parse and send values of scoreDatas to each html item using for loop on the array and document.getElementById().value*/
}
function score() {
scoreOn = true;
init();
ctrl();
csound.ReadScore(document.getElementById("scoreTest").value);
if (started == false) {
CsoundObj.CSOUND_AUDIO_CONTEXT.resume();
started = true;
}
}
For test online, just click on score button: http://csound.jeanbasilesosa.com/
Maybe have you an idea about my p2 problem when I trigger the score function?
Mery christmas,
Jean Basile
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here |