Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
paopre committed Jan 16, 2023
1 parent 571164c commit 0be1ebf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion documentation/miscellaneous.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ All the notes will be written in the language set in the very first line of the
![img](images/midiInput.gif)

Accidentals are written as sharp: you can swap them to flat (or from flat to sharp) by selecting the corresponding notes with the mouse (or by placing the cursor inside them) and then pressing **Ctrl + b** keys.
The MIDI input feature uses Web MIDI API, and it works natively on Chrome. On Firefox, Web MIDI API is not supported natively, but there are some addons for enabling it, like **[this one](https://addons.mozilla.org/en-US/firefox/addon/web-midi-api/)**.

The MIDI input feature uses Web MIDI API, and it works natively on Chrome.

On Firefox, Web MIDI API is not supported natively, but there are some addons for enabling it, like **[this one](https://addons.mozilla.org/en-US/firefox/addon/web-midi-api/)**. Note too that, if you want to enable MIDI input on Firefox, you have to set **firefoxWebMidiEnabled** tag to **true**, inside **[global-custom-vars.js](../lib/webgui/js/global-custom-vars.js)**.

On Windows, and probably on macOS too, a running virtual loopback MIDI program is required too, in order to make Web MIDI API work. There are some free programs for creating a virtual MIDI cable: just pick and run one of them, then visit **[THIS](https://www.onlinemusictools.com/webmiditest/)** page, for example, for checking if the MIDI input works correctly on your browser.

### MIDI VLC PLUGIN
Expand Down
1 change: 1 addition & 0 deletions lib/webgui/js/global-custom-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var pdfPointAndClickRectStrokeWidth = "2px"
var pdfPointAndClickRectColor = "cyan"
var midiInputTimeout = 300 //milliseconds
var midiInputBaseOctave = 3
var firefoxWebMidiEnabled = false

/***** Possible layouts *****
Expand Down
7 changes: 5 additions & 2 deletions lib/webgui/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
*/

dialogEnabled = true
isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1

if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
if(isFirefox){
if (!window.HTMLDialogElement) {
var notSupportedDialogErr = '<h2 style="text-align: center;">&nbsp;</h2>'+
'<h2 style="text-align: center;">One last step to do!</h2>'+
Expand Down Expand Up @@ -116,7 +117,9 @@ data = {
param1: "default-midi-input-channel"
}

if(navigator.requestMIDIAccess)
if (isFirefox && !firefoxWebMidiEnabled)
;
else if(navigator.requestMIDIAccess)
sendMsgToSpontiniServer(data, function(statusTxt, responseTxt) {
if (responseTxt != "-1") {
if (!isNaN(responseTxt))
Expand Down

0 comments on commit 0be1ebf

Please sign in to comment.