< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/RealTimeSequencer.java

Print this page

 826             playThread.start();
 827         }
 828     }
 829 
 830     void implStop() {
 831         if (playThread == null) {
 832             if (Printer.err) Printer.err("RealTimeSequencer.implStop() called, but playThread not instanciated!");
 833             return;
 834         }
 835 
 836         recording = false;
 837         if (running) {
 838             running = false;
 839             playThread.stop();
 840         }
 841     }
 842 
 843     private static EventDispatcher getEventDispatcher() {
 844         // create and start the global event thread
 845         //TODO  need a way to stop this thread when the engine is done

 846         final ThreadGroup tg = Thread.currentThread().getThreadGroup();
 847         synchronized (dispatchers) {
 848             EventDispatcher eventDispatcher = dispatchers.get(tg);
 849             if (eventDispatcher == null) {
 850                 eventDispatcher = new EventDispatcher();
 851                 dispatchers.put(tg, eventDispatcher);
 852                 eventDispatcher.start();
 853             }
 854             return eventDispatcher;
 855         }
 856     }
 857 
 858     /**
 859      * Send midi player events.
 860      * must not be synchronized on "this"
 861      */
 862     void sendMetaEvents(MidiMessage message) {
 863         if (metaEventListeners.size() == 0) return;
 864 
 865         getEventDispatcher().sendAudioEvents(message, metaEventListeners);

 826             playThread.start();
 827         }
 828     }
 829 
 830     void implStop() {
 831         if (playThread == null) {
 832             if (Printer.err) Printer.err("RealTimeSequencer.implStop() called, but playThread not instanciated!");
 833             return;
 834         }
 835 
 836         recording = false;
 837         if (running) {
 838             running = false;
 839             playThread.stop();
 840         }
 841     }
 842 
 843     private static EventDispatcher getEventDispatcher() {
 844         // create and start the global event thread
 845         //TODO  need a way to stop this thread when the engine is done
 846         @SuppressWarnings("deprecation")
 847         final ThreadGroup tg = Thread.currentThread().getThreadGroup();
 848         synchronized (dispatchers) {
 849             EventDispatcher eventDispatcher = dispatchers.get(tg);
 850             if (eventDispatcher == null) {
 851                 eventDispatcher = new EventDispatcher();
 852                 dispatchers.put(tg, eventDispatcher);
 853                 eventDispatcher.start();
 854             }
 855             return eventDispatcher;
 856         }
 857     }
 858 
 859     /**
 860      * Send midi player events.
 861      * must not be synchronized on "this"
 862      */
 863     void sendMetaEvents(MidiMessage message) {
 864         if (metaEventListeners.size() == 0) return;
 865 
 866         getEventDispatcher().sendAudioEvents(message, metaEventListeners);
< prev index next >