-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook more web-ui calls, fix linux build
Signed-off-by: falkTX <[email protected]>
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* DISTRHO Plugin Framework (DPF) | ||
* Copyright (C) 2012-2023 Filipe Coelho <[email protected]> | ||
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]> | ||
* | ||
* Permission to use, copy, modify, and/or distribute this software for any purpose with | ||
* or without fee is hereby granted, provided that the above copyright notice and this | ||
|
@@ -230,14 +230,17 @@ UI::PrivateData::createNextWindow(UI* const ui, uint width, uint height, const b | |
|
||
UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetAsMinimumSize) | ||
: UIWidget(UI::PrivateData::createNextWindow(this, | ||
// width | ||
#ifdef DISTRHO_UI_DEFAULT_WIDTH | ||
width == 0 ? DISTRHO_UI_DEFAULT_WIDTH : | ||
#endif | ||
width, | ||
// height | ||
#ifdef DISTRHO_UI_DEFAULT_HEIGHT | ||
height == 0 ? DISTRHO_UI_DEFAULT_HEIGHT : | ||
#endif | ||
height, | ||
// adjustForScaleFactor | ||
#ifdef DISTRHO_UI_DEFAULT_WIDTH | ||
width == 0 | ||
#else | ||
|
@@ -271,6 +274,10 @@ UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetA | |
"setParameterValue=function(index,value){window.webkit.messageHandlers.external.postMessage('setparam '+index+' '+value)};" | ||
#if DISTRHO_PLUGIN_WANT_STATE | ||
"setState=function(key,value){window.webkit.messageHandlers.external.postMessage('setstate '+key+' '+value)};" | ||
"requestStateFile=function(key){window.webkit.messageHandlers.external.postMessage('reqstatefile '+key)};" | ||
#endif | ||
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT | ||
"sendNote=function(channel,note,velocity){window.webkit.messageHandlers.external.postMessage('sendnote '+channel+' '+note+' '+velocity)};" | ||
#endif | ||
); | ||
#endif | ||
|
@@ -594,6 +601,35 @@ void UI::onMessage(char* const message) | |
setState(key, value); | ||
return; | ||
} | ||
|
||
if (std::strncmp(message, "reqstatefile ", 13) == 0) | ||
{ | ||
const char* const key = message + 13; | ||
requestStateFile(key); | ||
return; | ||
} | ||
#endif | ||
|
||
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT | ||
if (std::strncmp(message, "sendnote ", 9) == 0) | ||
{ | ||
const char* const strchannel = message + 9; | ||
char* strnote = nullptr; | ||
char* strvelocity = nullptr; | ||
char* end = nullptr; | ||
|
||
const ulong channel = std::strtoul(strchannel, &strnote, 10); | ||
DISTRHO_SAFE_ASSERT_RETURN(strnote != nullptr && strchannel != strnote,); | ||
|
||
const ulong note = std::strtoul(strnote, &strvelocity, 10); | ||
DISTRHO_SAFE_ASSERT_RETURN(strvelocity != nullptr && strchannel != strvelocity,); | ||
|
||
const ulong velocity = std::strtoul(strvelocity, &end, 10); | ||
DISTRHO_SAFE_ASSERT_RETURN(end != nullptr && strvelocity != end,); | ||
|
||
sendNote(channel, note, started); | ||
return; | ||
} | ||
#endif | ||
|
||
d_stderr("UI received unknown message %s", message); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters