File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ class MidiManager {
6363 }
6464 }
6565
66+ async disconnect ( ) {
67+ this . _midiInput . removeListener ( ) ;
68+ this . _midiInput = null ;
69+ this . _channelCallbacks = [ ] ;
70+ }
71+
6672 _setupListeners ( ) {
6773 if ( this . _midiInput ) {
6874 Object . entries ( this . _channelCallbacks ) . forEach ( ( [ channel , chanCb ] ) => {
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class SearchToolbar extends AlertsMixin(BpmMixin(QueryMixin(SearchMixin(SearchOp
5757 <options- menu- item @click = "${ this . openMouseCoordsAlert } " > Show Mouse Coordinates </ options- menu- item>
5858 <options- menu- item @click = "${ this . openCommonMultiplesAlert } " > Show Common Multiples </ options- menu- item>
5959 <options- menu- item @click = "${ this . connectToMidiController } " > Connect to Midi controller </ options- menu- item>
60+ <options- menu- item @click = "${ this . disconnectMidiController } " > Disconnect from Midi controller </ options- menu- item>
6061 <options- menu- item @click = "${ this . openAboutPageDialog } " > About </ options- menu- item>
6162 ${ debugMode ? html `<options- menu- item @click = "${ this . showDevTools } " > View Developer Tools </ options- menu- item> ` : '' }
6263 </ options- menu>
@@ -434,6 +435,10 @@ class SearchToolbar extends AlertsMixin(BpmMixin(QueryMixin(SearchMixin(SearchOp
434435 midiManager . connect ( this . settings . getString ( 'midi.controllerName' ) ) ;
435436 }
436437
438+ disconnectMidiController ( e ) {
439+ midiManager . disconnect ( ) ;
440+ }
441+
437442 searchOptionsChanged ( x ) {
438443 if ( this . searchOptionsChanged . bpmRestrict != x . bpmRestrict ||
439444 this . searchOptionsChanged . keyRestrict != x . keyRestrict ||
You can’t perform that action at this time.
0 commit comments