当前位置: 首页>>代码示例>>Java>>正文


Java LineEvent.getType方法代码示例

本文整理汇总了Java中javax.sound.sampled.LineEvent.getType方法的典型用法代码示例。如果您正苦于以下问题:Java LineEvent.getType方法的具体用法?Java LineEvent.getType怎么用?Java LineEvent.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sound.sampled.LineEvent的用法示例。


在下文中一共展示了LineEvent.getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: play

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
/**
 * playback start method extended by some gui stuff
 */
@Override
public void play() {
    try {
        super.play();
    } catch (LineUnavailableException | IOException e) {
        e.printStackTrace();
    }
    panel[2].setText("\u25A0");
    panel[2].setBackground(new Color(232, 232, 232));

    // listen to the audioClip and when it is finished playing, trigger the stop() method to clean up and reset the button
    LineListener listener = new LineListener() {
        public void update(LineEvent event) {
            if (event.getType() == LineEvent.Type.STOP) {
                stop();
            }
        }
    };
    this.getAudioClip().addLineListener(listener);
}
 
开发者ID:cemfi,项目名称:meico,代码行数:24,代码来源:MeicoApp.java

示例2: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public void update(LineEvent e) {
    if (e.getType() == LineEvent.Type.STOP) {
        stopOccured++;
        out("  Test program: receives STOP event for clip="+clip.toString()+" no."+stopOccured);
        out("  Test program: Calling close() in event dispatcher thread");
        clip.close();
        synchronized (lock) {
            lock.notifyAll();
        }
    }
    else if (e.getType() == LineEvent.Type.CLOSE) {
        out("  Test program: receives CLOSE event for "+clip.toString());
        synchronized (lock) {
            lock.notifyAll();
        }
    }
    else if (e.getType() == LineEvent.Type.START) {
        out("  Test program: receives START event for "+clip.toString());
    }
    else if (e.getType() == LineEvent.Type.OPEN) {
        out("  Test program: receives OPEN event for "+clip.toString());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ClipLinuxCrash2.java

示例3: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public void update(LineEvent event) {
	// ストップか最後まで再生された場合
	if(event.getType() == LineEvent.Type.STOP) {
		Clip clip = (Clip) event.getSource();
		clip.stop();
		clip.setFramePosition(0); // 再生位置を最初に戻す
	}
}
 
开发者ID:PoochyEXE,项目名称:nullpomino,代码行数:9,代码来源:WaveEngine.java

示例4: playAudio

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
private void playAudio(AudioInputStream audio)
	{
		LineListener lineListener = new LineListener() 
		{
            public void update(LineEvent event) 
            {
                if (event.getType() == LineEvent.Type.START) { Log.print(Log.DEBUG,"Audio started playing."); }
                else if (event.getType() == LineEvent.Type.STOP) { Log.print(Log.DEBUG,"Audio stopped playing."); } 
                else if (event.getType() == LineEvent.Type.OPEN) { Log.print(Log.DEBUG,"Audio line opened."); } 
                else if (event.getType() == LineEvent.Type.CLOSE) { Log.print(Log.DEBUG,"Audio line closed."); }
            }
        };

        AudioPlayer ap = new AudioPlayer(audio, lineListener);
        ap.start();
}
 
开发者ID:scbickle,项目名称:maryspeak,代码行数:17,代码来源:Process.java

示例5: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public void update(LineEvent event) {
	if (event.getType() == LineEvent.Type.OPEN) {
		// start the line, init the buffer
		line.start();
		
		int bytes = line.getBufferSize();
		byteBuf = new byte [bytes];
		doubleBuf = new double [bytes / af.getFrameSize()];
		fs = af.getFrameSize();
		
		lineOpened = true;
	} else if (event.getType() == LineEvent.Type.START) {
		// nothing to do here
	} else if (event.getType() == LineEvent.Type.STOP) {
		line.close();
	} else if (event.getType() == LineEvent.Type.CLOSE) {
		// only free the line now
		lineOpened = false;
	} else
		System.err.println("Unknown LineEvent: " + event.getType());
	
}
 
开发者ID:lendlice,项目名称:crowdpp,代码行数:23,代码来源:AudioPlay.java

示例6: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
@Override
public void update(LineEvent le) {		
	if (!le.getLine().equals(line))
		return;
	
	System.err.println(new Date() + ": RawCapturer.update: " + le);
	
	if (le.getType() == LineEvent.Type.START){
		System.err.println("RawCapturer.update: notifyStart()");
		notifyStart();
	}
	else if (le.getType() == LineEvent.Type.STOP){
		System.err.println("RawCapturer.update: notifyStop()");
		stopped = true;
		notifyStop();						
	}
}
 
开发者ID:lendlice,项目名称:crowdpp,代码行数:18,代码来源:RawCapturer.java

示例7: VentanaInternaGrabador

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public VentanaInternaGrabador(final File f) {
    initComponents();

    recorder = new SMSoundPlayerRecorder(f);
    this.setTitle(f.getName());
    LineListener lineListener = new LineListener() {
        @Override
        public void update(LineEvent event) {
            if (event.getType() == Type.START) {
                recorderButton.setEnabled(false);
                stopButton.setEnabled(true);
            }
            if (event.getType() == Type.STOP) {
                recorderButton.setEnabled(true);
                stopButton.setEnabled(false);
                VentanaInternaReproductor vir = new VentanaInternaReproductor(f);
                VentanaPrincipal.getEscritorio().add(vir);
                vir.setVisible(true);
            }

        }
    };
    ((SMSoundPlayerRecorder) recorder).setLineListener(lineListener);
    this.pack();
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:26,代码来源:VentanaInternaGrabador.java

示例8: VentanaInternaReproductor

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public VentanaInternaReproductor(File f) {
    initComponents();

    player = new SMSoundPlayerRecorder(f);
    this.setTitle(f.getName());
    LineListener lineListener = new LineListener() {
        @Override
        public void update(LineEvent event) {
            if (event.getType() == Type.START) {
                play.setEnabled(false);
                stop.setEnabled(true);
            }
            if (event.getType() == Type.STOP) {
                play.setEnabled(true);
                play.setSelected(false);
                stop.setEnabled(false);
            }
        }
    };
    ((SMSoundPlayerRecorder)player).setLineListener(lineListener);
    this.pack();
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:23,代码来源:VentanaInternaReproductor.java

示例9: VentanaInternaGrabador

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public VentanaInternaGrabador() {
    initComponents();
    exist=true;
    recorder = new SMSoundPlayerRecorder(new File("nuevo"));
    LineListener lineListener = new LineListener() {
        @Override
        public void update(LineEvent event) {
            if (event.getType() == Type.START) {
                recorderButton.setEnabled(false);
                stopButton.setEnabled(true);
            }
            if (event.getType() == Type.STOP) {
                recorderButton.setEnabled(true);
                stopButton.setEnabled(false);
            }

        }
    };
    ((SMSoundPlayerRecorder) recorder).setLineListener(lineListener);
    this.pack();
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:22,代码来源:VentanaInternaGrabador.java

示例10: VentanaInternaReproductor

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public VentanaInternaReproductor(File f) {
    initComponents();
    if (f != null) {
        player = new SMSoundPlayer(f);
        this.setTitle(f.getName());
        LineListener lineListener = new LineListener() {
            @Override
            public void update(LineEvent event) {
                if (event.getType() == Type.START) {
                    play.setEnabled(false);
                    stop.setEnabled(true);
                }
                if (event.getType() == Type.STOP) {
                    play.setEnabled(true);
                    play.setSelected(false);
                    stop.setEnabled(false);
                }
            }
        };
        ((SMSoundPlayer) player).setLineListener(lineListener);
        this.pack();
    }
}
 
开发者ID:oskyar,项目名称:Sistemas-Multimedia,代码行数:24,代码来源:VentanaInternaReproductor.java

示例11: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
public void update(LineEvent lineEvent)
/* Called when the clip's line detects open, close, start, or
   stop events. The watcher (if one exists) is notified.
*/
{
  // when clip is stopped / reaches its end
  if (lineEvent.getType() == LineEvent.Type.STOP) {
    // System.out.println("update() STOP for " + name);
    clip.stop();
    clip.setFramePosition(0);  // NEW
    if (!isLooping) {  // it isn't looping
      if (watcher != null)
        watcher.atSequenceEnd(name, SoundsWatcher.STOPPED);
    }
    else {      // else play it again
      clip.start();
      if (watcher != null)
        watcher.atSequenceEnd(name, SoundsWatcher.REPLAYED);
    }
  }
}
 
开发者ID:nhydock,项目名称:revert,代码行数:22,代码来源:ClipInfo.java

示例12: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
@Override
public void update(LineEvent event) {
    LineEvent.Type type = event.getType();
    if (type == LineEvent.Type.STOP) {
        clip.close();
    }
}
 
开发者ID:Vrekt,项目名称:Lunar,代码行数:8,代码来源:Sound.java

示例13: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
/**
 * Monitors the source data line playback state and broadcasts audio events
 * to the registered listener as the state changes
 */
@Override
public void update(LineEvent event)
{
    LineEvent.Type type = event.getType();

    if(type == LineEvent.Type.START)
    {
        mAudioEventBroadcaster.broadcast(mAudioStartEvent);
    }
    else if(type == LineEvent.Type.STOP)
    {
        mAudioEventBroadcaster.broadcast(mAudioStopEvent);
    }
}
 
开发者ID:DSheirer,项目名称:sdrtrunk,代码行数:19,代码来源:AudioOutput.java

示例14: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
@Override
public void update(LineEvent event) {
    if (LineEvent.Type.STOP == event.getType()) {
        dataSource.flush();
        music.flush();
        this.play();
    }
}
 
开发者ID:Bro-Pals,项目名称:TAG_18,代码行数:9,代码来源:MusicPlayer.java

示例15: update

import javax.sound.sampled.LineEvent; //导入方法依赖的package包/类
/**
 * This method allows to be notified for each event while playing a
 * sound
 */
@Override
public synchronized void update(final LineEvent event) {
	final Type eventType = event.getType();
	if (eventType == Type.STOP || eventType == Type.CLOSE) {
		done = true;
		notifyAll();
	}
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:13,代码来源:TelegraphSound.java


注:本文中的javax.sound.sampled.LineEvent.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。