Skip to content

Commit

Permalink
[ci] Fix issue with clang-format & EM_ASM
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jun 27, 2023
1 parent af59498 commit 2e73ca0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 2
UseTab: Never
WhitespaceSensitiveMacros:
- EM_ASM
- EM_ASM_INT
- get_js_string


SortIncludes: true
Expand Down
12 changes: 6 additions & 6 deletions include/libremidi/detail/emscripten.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class midi_access_emscripten

const bool available() const noexcept
{
return EM_ASM_INT(return typeof globalThis.__libreMidi_access != = undefined;);
return EM_ASM_INT(return typeof globalThis.__libreMidi_access !== undefined;);
}

const int input_count() const noexcept
Expand All @@ -33,7 +33,7 @@ class midi_access_emscripten

const void load_current_infos() noexcept
{
#define get_js_string(variable_to_read, ...) \
#define get_js_string(variable_to_read, ...) \
(char*)EM_ASM_INT( \
{ \
var jsstr = variable_to_read; \
Expand Down Expand Up @@ -82,7 +82,7 @@ class midi_access_emscripten
char* midi_name = get_js_string(globalThis.__libreMidi_currentInputs[$0].name, i);

const bool connected
= EM_ASM_INT(return globalThis.__libreMidi_currentInputs[$0].state == = "connected", i);
= EM_ASM_INT(return globalThis.__libreMidi_currentInputs[$0].state === "connected", i);

m_current_inputs[device_index].id = midi_id;
m_current_inputs[device_index].name = midi_name;
Expand Down Expand Up @@ -111,7 +111,7 @@ class midi_access_emscripten
char* midi_name = get_js_string(globalThis.__libreMidi_currentOutputs[$0].name, i);

const bool connected
= EM_ASM_INT(return globalThis.__libreMidi_currentOutputs[$0].state == = "connected", i);
= EM_ASM_INT(return globalThis.__libreMidi_currentOutputs[$0].state === "connected", i);

m_current_outputs[device_index].id = midi_id;
m_current_outputs[device_index].name = midi_name;
Expand Down Expand Up @@ -217,8 +217,8 @@ class midi_access_emscripten
EM_ASM(
if (navigator.requestMIDIAccess) {
navigator.requestMIDIAccess().then(
(midiAccess) = > globalThis.__libreMidi_access = midiAccess,
() = > console.log('MIDI support rejected, MIDI will not be available;'));
(midiAccess) => globalThis.__libreMidi_access = midiAccess,
() => console.log('MIDI support rejected, MIDI will not be available;'));
} else { console.log('WebMIDI is not supported in this browser.'); });
}

Expand Down

0 comments on commit 2e73ca0

Please sign in to comment.