|
|
|
@@ -1,8 +1,20 @@ |
|
|
|
function (event) { |
|
|
|
|
|
|
|
function hideAllIfConnectionsPresent() { |
|
|
|
if (event.icon.find('.input-connected').length === 0 && event.icon.find('.output-connected').length === 0) |
|
|
|
return; |
|
|
|
event.icon.find('.mod-pedal-input .mod-audio-input').removeClass('cardinal-expanded'); |
|
|
|
event.icon.find('.mod-pedal-output .mod-audio-output').removeClass('cardinal-expanded'); |
|
|
|
event.icon.find('.mod-pedal-input .mod-cv-input').removeClass('cardinal-expanded'); |
|
|
|
event.icon.find('.mod-pedal-output .mod-cv-output').removeClass('cardinal-expanded'); |
|
|
|
event.icon.find('.visibility-audio').text('Show Audio'); |
|
|
|
event.icon.find('.visibility-cv').text('Show CV'); |
|
|
|
} |
|
|
|
|
|
|
|
if (event.type == 'start') { |
|
|
|
event.data['visibility-audio'] = true; |
|
|
|
event.data['visibility-cv'] = true; |
|
|
|
event.data['visibility-triggered'] = false; |
|
|
|
event.icon.find('.visibility-audio').click(function() { |
|
|
|
var visible = event.data['visibility-audio']; |
|
|
|
if (visible) { |
|
|
|
@@ -15,6 +27,7 @@ function (event) { |
|
|
|
$(this).text('Show Audio'); |
|
|
|
} |
|
|
|
event.data['visibility-audio'] = !visible; |
|
|
|
event.data['visibility-triggered'] = true; |
|
|
|
}); |
|
|
|
event.icon.find('.visibility-cv').click(function() { |
|
|
|
var visible = event.data['visibility-cv']; |
|
|
|
@@ -33,7 +46,6 @@ function (event) { |
|
|
|
} |
|
|
|
|
|
|
|
if (event.type == 'change') { |
|
|
|
console.log("change", event) |
|
|
|
if (event.uri === "https://distrho.kx.studio/plugins/cardinal#screenshot") { |
|
|
|
if (event.value) { |
|
|
|
event.icon.find('.screenshot').css({'background-image':'url(data:image/png;base64,'+event.value+')'}); |
|
|
|
@@ -43,6 +55,11 @@ function (event) { |
|
|
|
event.icon.find('.cardinal-main.mod-pedal .cardinal-patch-screeenshot').hide(); |
|
|
|
event.icon.find('.cardinal-main.mod-pedal .cardinal-patch-comment').show(); |
|
|
|
} |
|
|
|
// if we got a screenshot without the user ever triggering a visibility change, it is like from PB load |
|
|
|
if (!event.data['visibility-triggered']) { |
|
|
|
event.data['visibility-triggered'] = true; |
|
|
|
setTimeout(hideAllIfConnectionsPresent, 500); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|