Subversion Repositories svn.mios

Rev

Rev 715 | Rev 723 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
628 adamjking 1
/*
2
 * @(#)MIOSStudio.java  beta8   2006/04/23
3
 *
4
 * Copyright (C) 2008    Adam King (adamjking@optusnet.com.au)
5
 *
6
 * This application is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This application is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this application; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
20
 
21
package org.midibox.apps.miosstudio;
22
 
23
import java.util.Iterator;
24
import java.util.Observable;
25
import java.util.Observer;
26
 
641 adamjking 27
import javax.sound.midi.MidiDevice;
713 adamjking 28
import javax.sound.midi.ShortMessage;
641 adamjking 29
 
30
import org.midibox.midi.MidiDeviceManager;
628 adamjking 31
import org.midibox.midi.MidiDeviceRouting;
32
import org.midibox.midi.MidiFilterDevice;
641 adamjking 33
import org.midibox.midi.MidiFilterDeviceManager;
628 adamjking 34
import org.midibox.midi.MidiKeyboardControllerDevice;
35
import org.midibox.midi.MidiMonitorFiltered;
36
import org.midibox.midi.MidiMonitorFilteredDevice;
37
import org.midibox.midi.MidiRouterDevice;
38
import org.midibox.mios.DebugFunctionDevice;
39
import org.midibox.mios.HexFileUploadDevice;
40
import org.midibox.mios.HexFileUploadDeviceManager;
41
import org.midibox.mios.LCDMessageDevice;
42
import org.midibox.mios.MIOSTerminal;
43
 
721 adamjking 44
public class MIOSStudio extends Observable implements Observer {
628 adamjking 45
 
721 adamjking 46
    public static Object MIDI_THRU_OUT_PORT = new Object();
47
 
48
    public static Object ROUTE_INDIVIDUAL_DEVICES = new Object();
49
 
628 adamjking 50
    protected MidiDeviceRouting midiDeviceRouting;
51
 
52
    protected MidiRouterDevice miosStudioInPort;
53
 
54
    protected MidiFilterDevice midiThruFilterDevice;
55
 
56
    // TODO: implement a map for MIDI thru
57
 
58
    /*
59
     * private MidiMapDevice midiThruMapDevice;
60
     */
61
 
641 adamjking 62
    protected MidiRouterDevice miosStudioThruPort;
63
 
628 adamjking 64
    protected MidiRouterDevice miosStudioOutPort;
65
 
641 adamjking 66
    private MidiDeviceManager midiDeviceManager;
67
 
68
    private MidiFilterDeviceManager midiFilterManager;
69
 
70
    /*
71
     * private MidiMapDeviceManager midiMapManager;
72
     */
73
 
628 adamjking 74
    private MidiMonitorFilteredDevice midiInPortMonitorDevice;
75
 
76
    private MidiMonitorFilteredDevice midiOutPortMonitorDevice;
77
 
78
    // Debuging for command line
79
 
80
    /*
81
     * private DumpReceiverDevice inDumpReceiverDevice;
82
     *
83
     * private DumpReceiverDevice outDumpReceiverDevice;
84
     */
85
 
86
    private MidiKeyboardControllerDevice midiKeyboardControllerDevice;
87
 
88
    // TODO: implement a manager for sysex sending and receing tasks
89
 
90
    /*
91
     * private SysexSendReceiveDeviceManager sysexSendReceiveDeviceManager;
92
     */
93
 
94
    private HexFileUploadDeviceManager hexFileUploadDeviceManager;
95
 
96
    // TODO: implement a device for reading and writing to MIOS
97
 
98
    /*
99
     * private MemoryReadWriteDevice memoryReadWriteDevice;
100
     */
101
 
102
    private LCDMessageDevice lcdMessageDevice;
103
 
104
    private DebugFunctionDevice debugFunctionDevice;
105
 
106
    private MidiMonitorFilteredDevice miosTerminalDevice;
107
 
108
    private boolean routeIndividualDevices;
109
 
639 adamjking 110
    private boolean midiThruOutPort = false;
628 adamjking 111
 
112
    public MIOSStudio() {
113
 
114
        createDevices();
115
 
116
        setRouteIndividualDevices(false);
117
 
118
        connectDevices();
119
    }
120
 
121
    protected void createDevices() {
122
 
123
        midiDeviceRouting = new MidiDeviceRouting();
124
 
125
        miosStudioInPort = new MidiRouterDevice("MIOS Studio In Port");
126
 
641 adamjking 127
        midiThruFilterDevice = new MidiFilterDevice("MIOS Studio Thru Filter");
628 adamjking 128
 
641 adamjking 129
        /*
130
         * midiThruMapDevice = new MidiMapDevice("MIOS Studio Thru Map");
131
         */
132
 
639 adamjking 133
        miosStudioThruPort = new MidiRouterDevice("MIOS Studio Thru Port");
134
 
641 adamjking 135
        miosStudioOutPort = new MidiRouterDevice("MIOS Studio Out Port");
628 adamjking 136
 
641 adamjking 137
        midiDeviceManager = new MidiDeviceManager();
138
        midiDeviceManager.addObserver(this);
139
 
140
        midiFilterManager = new MidiFilterDeviceManager();
141
        midiFilterManager.addObserver(this);
142
 
628 adamjking 143
        /*
641 adamjking 144
         * midiMapManager = new MidiMapDeviceManager();
145
         * midiMapManager.addObserver(this);
628 adamjking 146
         */
147
 
148
        midiInPortMonitorDevice = new MidiMonitorFilteredDevice(
149
                "MIDI Monitor: IN");
150
 
151
        midiOutPortMonitorDevice = new MidiMonitorFilteredDevice(
152
                "MIDI Monitor: OUT");
153
 
154
        /*
155
         * inDumpReceiverDevice = new DumpReceiverDevice("Dump Receiver: IN");
156
         *
157
         * outDumpReceiverDevice = new DumpReceiverDevice("Dump Receiver: OUT");
158
         */
159
 
160
        midiKeyboardControllerDevice = new MidiKeyboardControllerDevice(
161
                "MIDI Keyboard Controller", 0);
162
 
163
        /*
164
         * sysexSendReceiveDeviceManager = new SysexSendReceiveDeviceManager();
165
         * sysexSendReceiveDeviceManager.newSysexSendReceive();
166
         * sysexSendReceiveDeviceManager.addObserver(this);
167
         */
168
 
169
        hexFileUploadDeviceManager = new HexFileUploadDeviceManager();
693 adamjking 170
 
628 adamjking 171
        hexFileUploadDeviceManager.addObserver(this);
693 adamjking 172
 
628 adamjking 173
        /*
174
         * memoryReadWriteDevice = new MemoryReadWriteDevice( "MIOS Memory
175
         * Read/Write");
176
         */
177
 
178
        lcdMessageDevice = new LCDMessageDevice("MIOS LCD Message");
179
 
180
        debugFunctionDevice = new DebugFunctionDevice("MIOS Debug Function");
181
 
182
        MidiMonitorFiltered miosTerminalFiltered = new MidiMonitorFiltered(
183
                new MIOSTerminal());
184
 
185
        miosTerminalDevice = new MidiMonitorFilteredDevice("MIOS Terminal",
186
                miosTerminalFiltered);
187
 
188
        // special for MIOS Terminal:
189
        // disable all messages by default, only allow pass SysEx
190
        // user can enable other MIDI events again if required
713 adamjking 191
 
715 adamjking 192
 
713 adamjking 193
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.NOTE_OFF, false);
194
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.NOTE_ON, false);
195
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.POLY_PRESSURE, false);
196
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.CONTROL_CHANGE, false);
197
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.PROGRAM_CHANGE, false);
198
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.CHANNEL_PRESSURE, false);
199
        miosTerminalFiltered.getMidiFilter().setVoiceMessage(ShortMessage.PITCH_BEND, false);
628 adamjking 200
 
713 adamjking 201
        miosTerminalFiltered.getMidiFilter().setSystemCommonMessage(ShortMessage.MIDI_TIME_CODE, false);
202
        miosTerminalFiltered.getMidiFilter().setSystemCommonMessage(ShortMessage.SONG_POSITION_POINTER, false);
203
        miosTerminalFiltered.getMidiFilter().setSystemCommonMessage(ShortMessage.SONG_SELECT, false);
204
        miosTerminalFiltered.getMidiFilter().setSystemCommonMessage(ShortMessage.TUNE_REQUEST, false);
205
 
206
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessage(ShortMessage.TIMING_CLOCK, false);   
207
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessage(ShortMessage.START, false);
208
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessage(ShortMessage.CONTINUE, false);
209
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessage(ShortMessage.STOP, false);
210
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessage(ShortMessage.ACTIVE_SENSING, false);
211
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessage(ShortMessage.SYSTEM_RESET, false);
212
 
715 adamjking 213
        /*
214
        miosTerminalFiltered.getMidiFilter().setVoiceMessages(false);
215
 
216
        miosTerminalFiltered.getMidiFilter().setSystemCommonMessages(false);
217
 
218
        miosTerminalFiltered.getMidiFilter().setSystemRealtimeMessages(false);
219
        */
220
 
713 adamjking 221
        miosTerminalFiltered.getMidiFilter().setSysexMessages(true);
222
 
223
        miosTerminalFiltered.getMidiFilter().setMetaMessages(false);
628 adamjking 224
    }
225
 
641 adamjking 226
    public MidiDeviceManager getMidiDeviceManager() {
227
        return midiDeviceManager;
228
    }
229
 
230
    public MidiFilterDeviceManager getMidiFilterManager() {
231
        return midiFilterManager;
232
    }
233
 
234
    /*
235
     * public MidiMapDeviceManager getMidiMapManager() { return midiMapManager;
236
     * }
237
     */
238
 
628 adamjking 239
    public MidiDeviceRouting getMidiDeviceRouting() {
240
        return midiDeviceRouting;
241
    }
242
 
243
    public MidiMonitorFilteredDevice getMidiOutPortMonitorDevice() {
244
        return midiOutPortMonitorDevice;
245
    }
246
 
247
    public MidiMonitorFilteredDevice getMidiInPortMonitorDevice() {
248
        return midiInPortMonitorDevice;
249
    }
250
 
251
    public MidiKeyboardControllerDevice getMidiKeyboardControllerDevice() {
252
        return midiKeyboardControllerDevice;
253
    }
254
 
255
    /*
256
     * public SysexSendReceiveDeviceManager getSysexSendReceiveDeviceManager() {
257
     * return sysexSendReceiveDeviceManager; }
258
     */
259
 
260
    public HexFileUploadDeviceManager getHexFileUploadDeviceManager() {
261
        return hexFileUploadDeviceManager;
262
    }
263
 
264
    public DebugFunctionDevice getDebugFunctionDevice() {
265
        return debugFunctionDevice;
266
    }
267
 
268
    /*
269
     * public MemoryReadWriteDevice getMemoryReadWriteDevice() { return
270
     * memoryReadWriteDevice; }
271
     */
272
 
273
    public LCDMessageDevice getLcdMessageDevice() {
274
        return lcdMessageDevice;
275
    }
276
 
277
    public MidiMonitorFilteredDevice getMIOSTerminalDevice() {
278
        return miosTerminalDevice;
279
    }
280
 
639 adamjking 281
    public boolean isMidiThruOutPort() {
282
        return midiThruOutPort;
628 adamjking 283
    }
284
 
639 adamjking 285
    public void setMidiThruOutPort(boolean midiThru) {
286
        this.midiThruOutPort = midiThru;
628 adamjking 287
 
641 adamjking 288
        midiDeviceRouting
289
                .connectDevices(miosStudioInPort, midiThruFilterDevice);
290
 
628 adamjking 291
        if (midiThru) {
639 adamjking 292
 
628 adamjking 293
            /*
294
             * midiDeviceRouting.connectDevices(midiThruFilterDevice,
295
             * midiThruMapDevice);
296
             */
297
 
639 adamjking 298
            midiDeviceRouting.disconnectDevice(miosStudioThruPort);
641 adamjking 299
 
639 adamjking 300
            midiDeviceRouting.disconnectDevices(midiThruFilterDevice,
641 adamjking 301
                    miosStudioThruPort);
639 adamjking 302
 
628 adamjking 303
            midiDeviceRouting.connectDevices(midiThruFilterDevice,
304
                    miosStudioOutPort);
305
        } else {
641 adamjking 306
 
628 adamjking 307
            /*
308
             * midiDeviceRouting.disconnectDevices(midiThruFilterDevice,
309
             * midiThruMapDevice);
310
             */
641 adamjking 311
 
628 adamjking 312
            midiDeviceRouting.disconnectDevices(midiThruFilterDevice,
641 adamjking 313
                    miosStudioOutPort);
314
 
639 adamjking 315
            midiDeviceRouting.connectDevices(midiThruFilterDevice,
316
                    miosStudioThruPort);
628 adamjking 317
        }
641 adamjking 318
 
639 adamjking 319
        setRouteIndividualDevices(routeIndividualDevices);
721 adamjking 320
 
321
        setChanged();
322
 
323
        notifyObservers(MIDI_THRU_OUT_PORT);
324
 
325
        clearChanged();
628 adamjking 326
    }
327
 
328
    public MidiRouterDevice getMiosStudioInPort() {
329
        return miosStudioInPort;
330
    }
331
 
332
    public MidiRouterDevice getMiosStudioOutPort() {
333
        return miosStudioOutPort;
334
    }
335
 
336
    public MidiFilterDevice getMidiThruFilterDevice() {
337
        return midiThruFilterDevice;
338
    }
339
 
340
    /*
341
     * public MidiMapDevice getMidiThruMapDevice() { return midiThruMapDevice; }
342
     */
343
 
344
    public boolean isRouteIndividualDevices() {
345
        return routeIndividualDevices;
346
    }
347
 
348
    public void setRouteIndividualDevices(boolean routeIndividualDevices) {
349
        this.routeIndividualDevices = routeIndividualDevices;
350
 
351
        // remove all devices
352
        midiDeviceRouting.removeAllMidiReadDevices();
353
        midiDeviceRouting.removeAllMidiWriteDevices();
354
 
355
        // add internal MIOSStudio devices if selected
356
        if (routeIndividualDevices) {
357
 
358
            routeIndividualDevices();
359
 
360
        } else {
361
            midiDeviceRouting.addMidiWriteDevice(miosStudioInPort);
362
            midiDeviceRouting.addMidiReadDevice(miosStudioOutPort);
641 adamjking 363
 
639 adamjking 364
            if (!midiThruOutPort) {
365
                midiDeviceRouting.addMidiReadDevice(miosStudioThruPort);
366
            }
628 adamjking 367
        }
368
 
641 adamjking 369
        reorder();
721 adamjking 370
 
371
        setChanged();
372
 
373
        notifyObservers(ROUTE_INDIVIDUAL_DEVICES);
374
 
375
        clearChanged();
628 adamjking 376
    }
377
 
641 adamjking 378
    public void reorder() {
379
 
380
        midiDeviceRouting.getMidiReadDevices().removeAll(
381
                midiFilterManager.getMidiFilterDevices());
382
        midiDeviceRouting.getMidiWriteDevices().removeAll(
383
                midiFilterManager.getMidiFilterDevices());
384
 
385
        midiDeviceRouting.getMidiReadDevices().removeAll(
386
                midiDeviceManager.getSelectedMidiReadDevices());
387
        midiDeviceRouting.getMidiWriteDevices().removeAll(
388
                midiDeviceManager.getSelectedMidiWriteDevices());
389
 
390
        /*
391
         * midiReadDevices.removeAll(midiMapManager.getMidiMapDevices());
392
         * midiWriteDevices.removeAll(midiMapManager.getMidiMapDevices());
393
         */
394
 
395
        midiDeviceRouting.addMidiReadDevices(midiFilterManager
396
                .getMidiFilterDevices());
397
        midiDeviceRouting.addMidiWriteDevices(midiFilterManager
398
                .getMidiFilterDevices());
399
 
400
        Iterator it = midiDeviceManager.getMidiReadDevices().iterator();
401
 
402
        while (it.hasNext()) {
403
 
404
            Object object = it.next();
405
 
406
            if (midiDeviceManager.getSelectedMidiReadDevices().contains(object)) {
407
                midiDeviceRouting.addMidiReadDevice((MidiDevice) object);
408
            }
409
        }
410
 
411
        it = midiDeviceManager.getMidiWriteDevices().iterator();
412
        while (it.hasNext()) {
413
 
414
            Object object = it.next();
415
 
416
            if (midiDeviceManager.getSelectedMidiWriteDevices()
417
                    .contains(object)) {
418
                midiDeviceRouting.addMidiWriteDevice((MidiDevice) object);
419
            }
420
        }
421
 
422
        /*
423
         * midiReadDevices.addAll(midiMapManager.getMidiMapDevices());
424
         * midiWriteDevices.addAll(midiMapManager.getMidiMapDevices());
425
         */
426
    }
427
 
628 adamjking 428
    protected void routeIndividualDevices() {
429
 
430
        midiDeviceRouting.addMidiWriteDevice(miosStudioInPort);
431
        midiDeviceRouting.addMidiReadDevice(miosStudioInPort);
432
 
433
        midiDeviceRouting.addMidiWriteDevice(midiThruFilterDevice);
434
        midiDeviceRouting.addMidiReadDevice(midiThruFilterDevice);
435
 
436
        /*
437
         * midiDeviceRouting.addMidiWriteDevice(midiThruMapDevice);
438
         * midiDeviceRouting.addMidiReadDevice(midiThruMapDevice);
439
         */
641 adamjking 440
 
639 adamjking 441
        if (!midiThruOutPort) {
641 adamjking 442
 
639 adamjking 443
            midiDeviceRouting.addMidiWriteDevice(miosStudioThruPort);
444
            midiDeviceRouting.addMidiReadDevice(miosStudioThruPort);
445
        }
628 adamjking 446
        midiDeviceRouting.addMidiWriteDevice(miosStudioOutPort);
447
        midiDeviceRouting.addMidiReadDevice(miosStudioOutPort);
448
 
449
        midiDeviceRouting.addMidiWriteDevice(midiOutPortMonitorDevice);
450
 
451
        midiDeviceRouting.addMidiWriteDevice(midiInPortMonitorDevice);
452
 
453
        /*
454
         * midiDeviceRouting.addMidiWriteDevice(inDumpReceiverDevice);
455
         *
456
         * midiDeviceRouting.addMidiWriteDevice(outDumpReceiverDevice);
457
         */
458
 
459
        midiDeviceRouting.addMidiWriteDevice(midiKeyboardControllerDevice);
460
        midiDeviceRouting.addMidiReadDevice(midiKeyboardControllerDevice);
461
 
462
        /*
463
         * midiDeviceRouting.addMidiReadDevices(sysexSendReceiveDeviceManager
464
         * .getSysexSendReceiveDevices()); midiDeviceRouting.addMidiWriteDevices
465
         * (sysexSendReceiveDeviceManager .getSysexSendReceiveDevices());
466
         */
467
 
468
        midiDeviceRouting.addMidiReadDevices(hexFileUploadDeviceManager
469
                .getHexFileUploadDevices());
470
        midiDeviceRouting.addMidiWriteDevices(hexFileUploadDeviceManager
471
                .getHexFileUploadDevices());
472
        /*
473
         * midiDeviceRouting.addMidiWriteDevice(memoryReadWriteDevice);
474
         * midiDeviceRouting.addMidiReadDevice(memoryReadWriteDevice);
475
         */
476
 
477
        midiDeviceRouting.addMidiReadDevice(lcdMessageDevice);
478
 
479
        midiDeviceRouting.addMidiWriteDevice(debugFunctionDevice);
480
        midiDeviceRouting.addMidiReadDevice(debugFunctionDevice);
481
 
482
        midiDeviceRouting.addMidiWriteDevice(miosTerminalDevice);
483
    }
484
 
485
    public void connectDevices() {
486
 
639 adamjking 487
        setMidiThruOutPort(midiThruOutPort);
641 adamjking 488
 
628 adamjking 489
        midiDeviceRouting.connectDevices(miosStudioInPort,
490
                midiInPortMonitorDevice);
491
 
492
        midiDeviceRouting.connectDevices(miosStudioOutPort,
493
                midiOutPortMonitorDevice);
494
 
495
        /*
496
         * midiDeviceRouting.connectDevices(inVirtualMidiPortDevice,
497
         * inDumpReceiverDevice);
498
         * midiDeviceRouting.connectDevices(outVirtualMidiPortDevice,
499
         * outDumpReceiverDevice);
500
         */
641 adamjking 501
 
628 adamjking 502
        midiDeviceRouting.connectDevices(miosStudioInPort,
503
                midiKeyboardControllerDevice);
504
        midiDeviceRouting.connectDevices(midiKeyboardControllerDevice,
505
                miosStudioOutPort);
506
        /*
507
         * Iterator it = sysexSendReceiveDeviceManager
508
         * .getSysexSendReceiveDevices().iterator(); while (it.hasNext()) {
509
         * SysexSendReceiveDevice ssrt = (SysexSendReceiveDevice) it.next();
510
         * midiDeviceRouting.connectDevices(miosStudioInPort, ssrt);
511
         * midiDeviceRouting.connectDevices(ssrt, miosStudioOutPort); }
512
         */
513
        Iterator it = hexFileUploadDeviceManager.getHexFileUploadDevices()
514
                .iterator();
515
        while (it.hasNext()) {
516
            HexFileUploadDevice hutd = (HexFileUploadDevice) it.next();
517
            midiDeviceRouting.connectDevices(miosStudioInPort, hutd);
518
            midiDeviceRouting.connectDevices(hutd, miosStudioOutPort);
519
        }
520
        /*
521
         * midiDeviceRouting.connectDevices(miosStudioInPort,
522
         * memoryReadWriteDevice);
523
         * midiDeviceRouting.connectDevices(memoryReadWriteDevice,
524
         * miosStudioOutPort);
525
         */
526
 
527
        midiDeviceRouting.connectDevices(lcdMessageDevice, miosStudioOutPort);
528
        midiDeviceRouting.connectDevices(miosStudioInPort, debugFunctionDevice);
529
        midiDeviceRouting
530
                .connectDevices(debugFunctionDevice, miosStudioOutPort);
531
 
532
        midiDeviceRouting.connectDevices(miosStudioInPort, miosTerminalDevice);
533
    }
534
 
535
    public void update(Observable observable, Object object) {
693 adamjking 536
 
628 adamjking 537
        if (observable == hexFileUploadDeviceManager) {
538
 
693 adamjking 539
            HexFileUploadDevice hexFileUploadDevice = (HexFileUploadDevice) object;
628 adamjking 540
 
541
            if (hexFileUploadDeviceManager.getHexFileUploadDevices().contains(
693 adamjking 542
                    hexFileUploadDevice)) {
628 adamjking 543
 
693 adamjking 544
                midiDeviceRouting.connectDevices(miosStudioInPort,
545
                        hexFileUploadDevice);
546
                midiDeviceRouting.connectDevices(hexFileUploadDevice,
547
                        miosStudioOutPort);
628 adamjking 548
            } else {
693 adamjking 549
                midiDeviceRouting.disconnectDevice(hexFileUploadDevice);
641 adamjking 550
            }
628 adamjking 551
 
641 adamjking 552
            setRouteIndividualDevices(routeIndividualDevices);
553
        }
554
 
555
        if (observable == midiDeviceManager) {
556
 
557
            MidiDevice midiDevice = (MidiDevice) object;
558
 
642 adamjking 559
            if (!midiDeviceManager.getSelectedMidiReadDevices().contains(
560
                    midiDevice)
561
                    && !midiDeviceManager.getSelectedMidiWriteDevices()
562
                            .contains(midiDevice)) {
641 adamjking 563
                midiDeviceRouting.disconnectDevice(midiDevice);
628 adamjking 564
            }
641 adamjking 565
 
566
            setRouteIndividualDevices(routeIndividualDevices);
628 adamjking 567
        }
568
 
641 adamjking 569
        if (observable == midiFilterManager) {
628 adamjking 570
 
641 adamjking 571
            MidiDevice midiFilter = (MidiDevice) object;
628 adamjking 572
 
641 adamjking 573
            if (!midiFilterManager.getMidiFilterDevices().contains(midiFilter)) {
574
                midiDeviceRouting.disconnectDevice(midiFilter);
628 adamjking 575
            }
641 adamjking 576
 
577
            setRouteIndividualDevices(routeIndividualDevices);
628 adamjking 578
        }
579
    }
580
}