Skip to content

Commit 7d36132

Browse files
committed
Heavier handed solution to the discord problem
Just reload the whole config every time a new session happens. It might be very briefly wrong, but should be fine.
1 parent b120404 commit 7d36132

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

NK2Tray/Program.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public SysTrayApp()
5757

5858
private void OnSessionCreated(object sender, IAudioSessionControl newSession)
5959
{
60+
LoadAssignments();
61+
/*
6062
Console.WriteLine("OnSessionCreated");
6163
AudioSessionControl newAudioSession = new AudioSessionControl(newSession);
6264
var matchingAssignments = new List<Assignment>();
@@ -82,7 +84,7 @@ private void OnSessionCreated(object sender, IAudioSessionControl newSession)
8284
//NAudioEventCallbacks callbacks = new NAudioEventCallbacks();
8385
//AudioSessionEventsCallback notifications = new AudioSessionEventsCallback(callbacks);
8486
//audioSession.RegisterEventClient(callbacks);
85-
87+
*/
8688
}
8789

8890
public void SaveAssignments()
@@ -126,6 +128,7 @@ public void LoadAssignments()
126128
Console.WriteLine(String.Format("Fader {0} is {1} (master)", i, ident));
127129
assignments[i] = new Assignment("Master Volume", "", -1, AssignmentType.Master, "", "", null);
128130
NanoKontrol2.Respond(ref midiOut, new ControlSurfaceDisplay(ControlSurfaceDisplayType.AssignedState, i, true));
131+
NanoKontrol2.Respond(ref midiOut, new ControlSurfaceDisplay(ControlSurfaceDisplayType.ErrorState, i, false));
129132
Console.WriteLine("Assigned!");
130133
}
131134
else if (ident.Length > 0)
@@ -136,6 +139,7 @@ public void LoadAssignments()
136139
{
137140
assignments[i] = new Assignment(matchingSession, i);
138141
NanoKontrol2.Respond(ref midiOut, new ControlSurfaceDisplay(ControlSurfaceDisplayType.AssignedState, i, true));
142+
NanoKontrol2.Respond(ref midiOut, new ControlSurfaceDisplay(ControlSurfaceDisplayType.ErrorState, i, false));
139143
Console.WriteLine("Assigned!");
140144
}
141145
else

0 commit comments

Comments
 (0)