@@ -40,6 +40,13 @@ public KezBoardView(
4040 this . communication = communication ;
4141
4242 midiDevices = midiDeviceManager . GetMidiDevices ( ) ;
43+
44+ PrintInstructions ( ) ;
45+ }
46+ public override void NotifyStartup ( )
47+ {
48+ base . NotifyStartup ( ) ;
49+
4350 bool setDevice = false ;
4451
4552 if ( ! string . IsNullOrEmpty ( midiBindingConfig . MidiDevice ) && midiDevices . Contains ( midiBindingConfig . MidiDevice ) )
@@ -49,7 +56,7 @@ public KezBoardView(
4956
5057 if ( setDevice )
5158 {
52- communication . SendDebugMessage ( $ "Midi Device connected from settings: { midiBindingConfig . MidiDevice } ") ;
59+ communication . SendDebugMessage ( $ "Midi Device connected from settings: { midiBindingConfig . MidiDevice } \n ") ;
5360 }
5461 }
5562
@@ -60,16 +67,14 @@ public KezBoardView(
6067
6168 if ( setDevice )
6269 {
63- communication . SendDebugMessage ( $ "Midi Device set to first device detected: { midiDevices [ 0 ] } ") ;
70+ communication . SendDebugMessage ( $ "Midi Device set to first device detected: { midiDevices [ 0 ] } \n ") ;
6471 }
6572 }
6673
6774 if ( ! setDevice )
6875 {
69- communication . SendDebugMessage ( $ "No Midi Device detected") ;
76+ communication . SendDebugMessage ( $ "No Midi Device detected\n ") ;
7077 }
71-
72- PrintInstructions ( ) ;
7378 }
7479
7580 private void PrintInstructions ( )
@@ -81,52 +86,52 @@ private void PrintInstructions()
8186 "\n ********* EDIT ***********\n " +
8287 "Press ESCAPE to end binding editing and enable playing.\n " +
8388 "Press A to Add/Edit a binding.\n " +
84- "Press S to Remove a binding." ) ;
89+ "Press S to Remove a binding.\n " ) ;
8590
8691 if ( midiBindingConfig . KeyMapping . Count > 0 )
8792 {
88- communication . SendDebugMessage ( $ "Current Bindings:\n { string . Join ( "\n " , midiBindingConfig . KeyMapping . Select ( x => $ " Key { x . Key } -> { x . Value . ToString ( ) [ 4 ..] } ") ) } ") ;
93+ communication . SendDebugMessage ( $ "Current Bindings:\n { string . Join ( "\n " , midiBindingConfig . KeyMapping . Select ( x => $ " Key { x . Key } -> { x . Value . ToString ( ) [ 4 ..] } ") ) } \n ") ;
8994 }
9095 else
9196 {
92- communication . SendDebugMessage ( $ "Current Bindings: NONE") ;
97+ communication . SendDebugMessage ( $ "Current Bindings: NONE\n ") ;
9398 }
9499 break ;
95100
96101 case State . EditingAddBinding :
97102 communication . SendDebugMessage (
98103 "\n ********* ADD ***********\n " +
99- "Press the Midi key to bind, then the keyboard key to bind it to." ) ;
104+ "Press the Midi key to bind, then the keyboard key to bind it to.\n " ) ;
100105 break ;
101106
102107 case State . EditingRemoveBinding :
103108 communication . SendDebugMessage (
104109 "\n ********* REMOVE ***********\n " +
105- "Press the Midi key to unbind." ) ;
110+ "Press the Midi key to unbind.\n " ) ;
106111 break ;
107112
108113 case State . Playing :
109114 communication . SendDebugMessage (
110115 "\n ********* PLAY ***********\n " +
111116 "Press CTRL-Q to save and quit\n " +
112117 "Press A to Change the current Midi Device.\n " +
113- "Press S to Edit current bindings." ) ;
118+ "Press S to Edit current bindings.\n " ) ;
114119 break ;
115120
116121 case State . SettingDevice :
117122 communication . SendDebugMessage (
118123 "\n ********* SET DEVICE ***********\n " +
119124 "Press ESCAPE to Abort device selection.\n " +
120- "Press the NUMBER corresponding to a midi device below to select that device." ) ;
125+ "Press the NUMBER corresponding to a midi device below to select that device.\n " ) ;
121126
122127 midiDevices = midiDeviceManager . GetMidiDevices ( ) ;
123128 if ( midiDevices . Count > 0 )
124129 {
125- communication . SendDebugMessage ( $ "Midi Devices:\n { string . Join ( "\n " , midiDevices . Select ( ( x , i ) => $ " { i + 1 } ) { x } ") ) } ") ;
130+ communication . SendDebugMessage ( $ "Midi Devices:\n { string . Join ( "\n " , midiDevices . Select ( ( x , i ) => $ " { i + 1 } ) { x } ") ) } \n ") ;
126131 }
127132 else
128133 {
129- communication . SendDebugMessage ( "Midi Devices: None Detected" ) ;
134+ communication . SendDebugMessage ( "Midi Devices: None Detected\n " ) ;
130135 }
131136 break ;
132137
@@ -488,6 +493,8 @@ public void HandleKeyDown(int key)
488493 communication . SendDebugMessage ( $ "Key { key } unbound.") ;
489494 state = State . EditingModeSelection ;
490495 PrintInstructions ( ) ;
496+
497+ midiBindingConfig . Serialize ( ) ;
491498 }
492499 break ;
493500 }
0 commit comments