Skip to content
Snippets Groups Projects
Commit bc1f0d77 authored by RANWEZ Pierre's avatar RANWEZ Pierre :anchor:
Browse files

:bug: bug: bug bounty after refactor

parent 616b102c
No related branches found
No related tags found
1 merge request!1✨ feat: CSSLSD V2
......@@ -17,7 +17,7 @@ var audioSample = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
function parseCSS(cssObj) {
var parser = new CSSParser();
var sheet = parser.parse(cssObj, false, true);
var audioVars = ['loud', 'low', 'lomi', 'mid', 'mihi', 'hi', 'attack'];
var audioVars = ['loud', 'low', 'lomi', 'mid', 'mihi', 'hi', 'attack', 'onset'];
var midiVars = ['cc', 'note'];
chrome.runtime.sendMessage({ type: 'updateUi', data: true });
sheet.cssRules.forEach(element => {
......@@ -84,9 +84,9 @@ function templateToDict(string) {
});
}
else {
if (string.includes(':')) {
eventType = string.split(':')[0];
eventName = string.split(':')[1];
if (template.includes(':')) {
eventType = template.split(':')[0];
eventName = template.split(':')[1];
}
else {
eventType = eventString;
......@@ -102,6 +102,7 @@ function templateToDict(string) {
}
string = string.replace('[' + template + ']', '');
}
console.log(returnValue);
return returnValue;
}
......@@ -458,7 +459,7 @@ function audioEvent() {
volume = meter.volume * 1.4;
value = value.replace('[' + template['templateFull'] + ']', (meter.volume * 1.4 < 1 ? parseInt(template['min']) + Math.round((template['max'] - template['min']) * volume) : 0));
}
if (template['eventType'] == 'note' && template['eventName'] == note) {
if (template['eventType'] == 'onset' && template['eventName'] == noteStrings[note % 12]) {
eventIn = true;
value = value.replace('[' + template['templateFull'] + ']', '');
}
......@@ -490,6 +491,7 @@ function onMessage({ type, data }) {
case 'update': {
const css = data.cssStr;
audioEvents = [];
midiEvents = [];
parseCSS(css)
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment