當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaLayerException類代碼示例

本文整理匯總了Java中javazoom.jl.decoder.JavaLayerException的典型用法代碼示例。如果您正苦於以下問題:Java JavaLayerException類的具體用法?Java JavaLayerException怎麽用?Java JavaLayerException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JavaLayerException類屬於javazoom.jl.decoder包,在下文中一共展示了JavaLayerException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: play

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
private static void play(final Player player) {
	playerCount.incrementAndGet();

	//Not sure how to use Future here?
	Future<?> f = playerThreadPool.submit(new Runnable() {
		public void run() {
			try {
				player.play();
				playerCount.decrementAndGet();
				synchronized (playerCount) {
					playerCount.notify();
				}
			} catch (JavaLayerException jle) {
				jle.printStackTrace();
			}
		}
	});
}
 
開發者ID:RPTools,項目名稱:rplib,代碼行數:19,代碼來源:SoundPlayer.java

示例2: testPlay

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public void testPlay()
{
	String[] args = new String[1];
	args[0] = filename;
	jlp player = jlp.createInstance(args);
	try
	{
		player.play();
		assertTrue("Play",true);	
	}
	catch (JavaLayerException e)
	{
		e.printStackTrace();
		assertTrue("JavaLayerException : "+e.getMessage(),false);			
	}
}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:17,代碼來源:jlpTest.java

示例3: Player

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public Player(InputStream stream, AudioDevice device) throws JavaLayerException
{
	bitstream = new Bitstream(stream);		
	decoder = new Decoder();
			
	if (device!=null)
	{		
		audio = device;
	}
	else
	{			
		FactoryRegistry r = FactoryRegistry.systemRegistry();
		audio = r.createAudioDevice();
	}
	audio.open(decoder);
}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:17,代碼來源:Player.java

示例4: play

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
/**
 * Plays a number of MPEG audio frames. 
 * 
 * @param frames	The number of frames to play. 
 * @return	true if the last frame was played, or false if there are
 *			more frames. 
 */
public boolean play(int frames) throws JavaLayerException
{
	boolean ret = true;
		
	while (frames-- > 0 && ret)
	{
		ret = decodeFrame();			
	}
	
	if (!ret)
	{
		// last frame, ensure all data flushed to the audio device. 
		AudioDevice out = audio;
		if (out!=null)
		{				
			out.flush();
			synchronized (this)
			{
				complete = (!closed);
				close();
			}				
		}
	}
	return ret;
}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:33,代碼來源:Player.java

示例5: test

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
/**
 * Runs a short test by playing a short silent sound.
 */
public void test()
	throws JavaLayerException
{
	try
	{
		open(new AudioFormat(22050, 16, 1, true, false));
		short[] data = new short[22050/10];
		write(data, 0, data.length);
		flush();
		close();
	}
	catch (RuntimeException ex)
	{
		throw new JavaLayerException("Device test failed: "+ex);
	}

}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:21,代碼來源:JavaSoundAudioDevice.java

示例6: playMp3

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public static AdvancedPlayer playMp3(final InputStream is, final int start, final int end, PlaybackListener listener) throws JavaLayerException
{
  final AdvancedPlayer player = new AdvancedPlayer(is);
  player.setPlayBackListener(listener);
  // run in new thread
  new Thread()
  {
    public void run()
    {
      try
      {
        player.play(start, end);
      }
      catch (Exception e)
      {
        throw new RuntimeException(e.getMessage());
      }
    }
  }.start();
  return player;
}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:22,代碼來源:jlap.java

示例7: start

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
/**
 * Starts this applet. An input stream and audio device 
 * are created and passed to the play() method.
 */
public void start()
{
	String name = getAudioFileName();
	try
	{			
		InputStream in = getAudioStream();
		AudioDevice dev = getAudioDevice();
		play(in, dev);
	}
	catch (JavaLayerException ex)
	{
		synchronized (System.err)
		{
			System.err.println("Unable to play "+name);
			ex.printStackTrace(System.err);
		}
	}
}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:23,代碼來源:PlayerApplet.java

示例8: speak

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public static synchronized void speak(String text) {
    /*
    Thread safe method for Text to Speech.
     */

    new Thread(
            () -> {

                try {

                    synthesiserV2.setSpeed(0.955f);
                    System.out.println("{->} Speaking : " + text);

                    AdvancedPlayer advancedPlayer = new AdvancedPlayer(synthesiserV2.getMP3Data(text));
                    advancedPlayer.play();

                } catch (IOException | JavaLayerException exception) {

                    System.out.println("{X} Exception in TTS. ");
                    System.out.println(exception.getMessage());
                }

            }
    ).start();
}
 
開發者ID:karanpratapsingh,項目名稱:KenzieTheBot,代碼行數:26,代碼來源:TTS.java

示例9: play

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
@Override
public void play(Song song, SongAudio songAudio) {
    this.currentSong = song;
    RenderedSong renderedSong = songPersistenceService.getRenderedSongById(song.getId()).orElse(new RenderedSong());
    this.renderedChannelMap = new Gson().fromJson(renderedSong.getRenderData(), RenderedChannelMap.class);

    try {
        FactoryRegistry r = FactoryRegistry.systemRegistry();
        audioDevice = r.createAudioDevice();

        ByteArrayInputStream inputStream = new ByteArrayInputStream(songAudio.getAudioData());
        AdvancedPlayer player = new AdvancedPlayer(inputStream, audioDevice);
        player.setPlayBackListener(playbackListener);
        player.play();
    } catch (JavaLayerException e) {
        e.printStackTrace();
    }
}
 
開發者ID:sparkled,項目名稱:sparkled,代碼行數:19,代碼來源:SongPlayerServiceImpl.java

示例10: setPlaylistAndMusic

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public void setPlaylistAndMusic(Playlist playlist, String music_name)
{
    model.getDataModel().getPlaylists().forEach((playlist_) ->
    {
        playlist_.getNames().forEach((name_) ->
        {
            if(name_.equals(music_name))
            {
                model.stopMusic();
                model.changeToPlaylist(playlist_.getPlaylistName());
                model.getDataModel().getCurrentPlaylist().setOnMusic(music_name);
                try
                {
                    model.playMusic();
                }
                catch (JavaLayerException | IOException ex)
                { }
            }
        }); 
    });
}
 
開發者ID:obernardovieira,項目名稱:vucor,代碼行數:22,代碼來源:FrameControls.java

示例11: write

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
@Override
public void write(short[] paramArrayOfShort, int paramInt1, int paramInt2) throws JavaLayerException {
	
	if (gain == 1.0) {
		// default behavior
		super.write(paramArrayOfShort, paramInt1, paramInt2);
	} else {
		// so some digital signal processing!!! woot!
		//System.out.print(".");
		short[] volumeAdjusted = new short[paramArrayOfShort.length];
		for (int i = 0 ; i < paramArrayOfShort.length ; i++) {
			// Multiplication is volume control! amplify the signal by the gain
			// EEK that's a lot of type casting!
			volumeAdjusted[i] = (short)(((float)paramArrayOfShort[i])*gain);
		}
		// pass the volume adjusted array to the underlying audio device
		super.write(volumeAdjusted, paramInt1, paramInt2);
	
	}
}
 
開發者ID:glaudiston,項目名稱:project-bianca,代碼行數:21,代碼來源:MRLSoundAudioDevice.java

示例12: play

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
/**
 * Starts playback (resumes if paused)
 */
public void play() throws JavaLayerException {
    synchronized (playerLock) {
        switch (playerStatus) {
            case NOT_STARTED:
                final Runnable r = new Runnable() {
                    public void run() {
                        playInternal();
                    }
                };
                final Thread t = new Thread(r);
                t.setDaemon(true);
                t.setPriority(Thread.MAX_PRIORITY);
                playerStatus = PLAYING;
                t.start();
                break;
            case PAUSED:
                resume();
                break;
            default:
                break;
        }
    }
}
 
開發者ID:gravitylow,項目名稱:YRadio,代碼行數:27,代碼來源:PausablePlayer.java

示例13: convertMP3toWAV

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public static File convertMP3toWAV(File mp3){
	File temp=null;
	try {
		temp = File.createTempFile(mp3.getName().split("\\.")[0],".wav");
		temp.deleteOnExit();
	} catch (IOException e1) {
		e1.printStackTrace();
	}
	Converter converter = new Converter();
	try {
		converter.convert(mp3.getAbsolutePath(), temp.getAbsolutePath());
	} catch (JavaLayerException e) {
		e.printStackTrace();
	}
	return temp;
}
 
開發者ID:miracatici,項目名稱:MakamBox,代碼行數:17,代碼來源:AudioUtilities.java

示例14: play

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
/**
 * Plays the loaded song or does nothing if song is not loaded.
 * 
 * @param flag Modifier to loop or not (use BackgroundMusic.LOOP_CONTINUOUSLY to loop or anything else to play once)
 * @throws JavaLayerException
 */
public static void play(int flag) throws JavaLayerException{
	synchronized(playerLock){
		switch(playerStatus){
			case LOADED:
				stopPlaying = false;
				final Runnable r = new Runnable(){
					public void run(){
						playInternal(flag);
					}
				};
				final Thread t = new Thread(r);
				t.setDaemon(true);
				t.setPriority(Thread.MAX_PRIORITY);
				playerStatus = PLAYING;
				t.start();
				break;
			case PAUSED:
				resume();
				break;
			default:
				break;
		}
	}
}
 
開發者ID:dstumpff,項目名稱:VortexGameLibrary,代碼行數:31,代碼來源:BackgroundMusic.java

示例15: convert

import javazoom.jl.decoder.JavaLayerException; //導入依賴的package包/類
public void convert(String sourceName, String destName,
	ProgressListener progressListener, Decoder.Params decoderParams)
	throws JavaLayerException
{
	if (destName.length()==0)
		destName = null;
	try {
		InputStream in = openInput(sourceName);
		convert(in, destName, progressListener, decoderParams);
		in.close();
	} catch(IOException ioe) {
		throw new JavaLayerException(ioe.getLocalizedMessage(), ioe);
	}
}
 
開發者ID:EndlessBot,項目名稱:jLib,代碼行數:15,代碼來源:Converter.java


注:本文中的javazoom.jl.decoder.JavaLayerException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。