Search in sources :

Example 6 with LineEvent

use of javax.sound.sampled.LineEvent in project jdk8u_jdk by JetBrains.

the class SoftMixingClip method stop.

public void stop() {
    LineEvent event = null;
    synchronized (control_mutex) {
        if (isOpen()) {
            if (!active)
                return;
            active = false;
            active_sg = true;
            event = new LineEvent(this, LineEvent.Type.STOP, getLongFramePosition());
        }
    }
    if (event != null)
        sendEvent(event);
}
Also used : LineEvent(javax.sound.sampled.LineEvent)

Example 7 with LineEvent

use of javax.sound.sampled.LineEvent in project jdk8u_jdk by JetBrains.

the class SoftMixingMixer method openStream.

public AudioInputStream openStream(AudioFormat targetFormat) throws LineUnavailableException {
    if (isOpen())
        throw new LineUnavailableException("Mixer is already open");
    synchronized (control_mutex) {
        open = true;
        implicitOpen = false;
        if (targetFormat != null)
            format = targetFormat;
        mainmixer = new SoftMixingMainMixer(this);
        sendEvent(new LineEvent(this, LineEvent.Type.OPEN, AudioSystem.NOT_SPECIFIED));
        return mainmixer.getInputStream();
    }
}
Also used : LineEvent(javax.sound.sampled.LineEvent) LineUnavailableException(javax.sound.sampled.LineUnavailableException)

Example 8 with LineEvent

use of javax.sound.sampled.LineEvent in project jdk8u_jdk by JetBrains.

the class SoftMixingSourceDataLine method close.

public void close() {
    LineEvent event = null;
    synchronized (control_mutex) {
        if (!isOpen())
            return;
        stop();
        event = new LineEvent(this, LineEvent.Type.CLOSE, getLongFramePosition());
        open = false;
        mixer.getMainMixer().closeLine(this);
    }
    if (event != null)
        sendEvent(event);
}
Also used : LineEvent(javax.sound.sampled.LineEvent)

Example 9 with LineEvent

use of javax.sound.sampled.LineEvent in project jdk8u_jdk by JetBrains.

the class SoftMixingSourceDataLine method stop.

public void stop() {
    LineEvent event = null;
    synchronized (control_mutex) {
        if (isOpen()) {
            if (!active)
                return;
            active = false;
            event = new LineEvent(this, LineEvent.Type.STOP, getLongFramePosition());
        }
    }
    if (event != null)
        sendEvent(event);
}
Also used : LineEvent(javax.sound.sampled.LineEvent)

Example 10 with LineEvent

use of javax.sound.sampled.LineEvent in project jdk8u_jdk by JetBrains.

the class SoftMixingSourceDataLine method start.

public void start() {
    LineEvent event = null;
    synchronized (control_mutex) {
        if (isOpen()) {
            if (active)
                return;
            active = true;
            event = new LineEvent(this, LineEvent.Type.START, getLongFramePosition());
        }
    }
    if (event != null)
        sendEvent(event);
}
Also used : LineEvent(javax.sound.sampled.LineEvent)

Aggregations

LineEvent (javax.sound.sampled.LineEvent)13 AudioInputStream (javax.sound.sampled.AudioInputStream)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ControllerEventListener (javax.sound.midi.ControllerEventListener)1 MetaEventListener (javax.sound.midi.MetaEventListener)1 MetaMessage (javax.sound.midi.MetaMessage)1 ShortMessage (javax.sound.midi.ShortMessage)1 LineListener (javax.sound.sampled.LineListener)1 LineUnavailableException (javax.sound.sampled.LineUnavailableException)1