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


Java AdvancedPlayer类代码示例

本文整理汇总了Java中javazoom.jl.player.advanced.AdvancedPlayer的典型用法代码示例。如果您正苦于以下问题:Java AdvancedPlayer类的具体用法?Java AdvancedPlayer怎么用?Java AdvancedPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setUpMusicPlayer

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
/**
 * Helper function to setup a new instance of a music player based on the song that is passed in.
 *
 * @param songToPlay The song that you want to set up the music player for.
 */
private void setUpMusicPlayer(Song songToPlay) throws Exception{
    try {
        m_isUserInterrupted = false;
        m_fs = new FileInputStream(songToPlay.getFile());
        m_bufferedStream = new BufferedInputStream(m_fs);
        m_audioDevice = FactoryRegistry.systemRegistry().createAudioDevice();

        m_player = new AdvancedPlayer(m_bufferedStream, m_audioDevice);
        m_player.setPlayBackListener(createPlaybackListeners());

        m_isReady = true;
    } catch (Exception e) {
        e.printStackTrace();
        m_manager.setError(e);
        m_manager.notifyError();
        throw e;
    }
}
 
开发者ID:ijh165,项目名称:Gamma-Music-Manager,代码行数:24,代码来源:JlayerMP3Player.java

示例2: speak

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的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

示例3: play

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的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

示例4: play

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
public void play() {
    final RoomConnection c = this;
    new Thread() {
        @Override
        public void run() {
            try {
                c.player = new AdvancedPlayer(c.streamIn);
                c.player.play();
            }
            catch (JavaLayerException e) {
                e.printStackTrace();
            }
        }
    }.start();
}
 
开发者ID:dimamo5,项目名称:SDIS-SoundShare,代码行数:16,代码来源:RoomConnection.java

示例5: AdvancedPlayerThread

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
public AdvancedPlayerThread(String filename, BufferedInputStream bis) {
	super(filename);

	try {
		this.filename = filename;			
		resetAudioDevice();
		this.player = new AdvancedPlayer(bis, audioDevice);
		player.setPlayBackListener(playbackListener);
		
	} catch (Exception e) {
		Logging.logError(e);
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:14,代码来源:AudioFile.java

示例6: playClip

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
private void playClip(final String clipName, final PlayerID playerId) {
  if (beSilent || isMuted(clipName)) {
    return;
  }
  // run in a new thread, so that we do not delay the game
  String folder = clipName;
  if (playerId != null) {
    folder += "_" + playerId.getName();
  }

  final URI clip = loadClip(folder).orElse(loadClip(clipName).orElse(null));
  // clip may still be null, we try to load all phases/all sound, for example: clipName = "phase_technology", folder =
  // "phase_technology_Japanese"

  if (clip != null) {
    new Thread(() -> {
      try {
        final Optional<InputStream> inputStream = UrlStreams.openStream(clip.toURL());
        if (inputStream.isPresent()) {
          final AudioDevice audioDevice = FactoryRegistry.systemRegistry().createAudioDevice();
          new AdvancedPlayer(inputStream.get(), audioDevice).play();
        }
      } catch (final Exception e) {
        ClientLogger.logError("Failed to play: " + clip, e);
      }
    }).start();
  }
}
 
开发者ID:triplea-game,项目名称:triplea,代码行数:29,代码来源:ClipPlayer.java

示例7: createPlayer

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
/**
 * creates the new player
 * 
 * @throws AudioPlayerException
 *             thrown if advanced player couldn't read inputstream
 */
private void createPlayer() throws AudioPlayerException {
	try {
		BufferedInputStream bis = new BufferedInputStream(new FileInputStream(path));
		this.player = new AdvancedPlayer(bis);
	} catch (IOException | JavaLayerException e) {
		logger.log(Level.SEVERE, "Error while init audio player:\n" + LogUtil.getStackTrace(e), e);
		throw new AudioPlayerException("Error while init file: " + this.path);
	}
}
 
开发者ID:cf86,项目名称:MP3ToolKit,代码行数:16,代码来源:MP3Player.java

示例8: getPlayer

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
public AdvancedPlayer getPlayer() {
	return player;
}
 
开发者ID:kuhnmi,项目名称:jukefox,代码行数:4,代码来源:PreparePlayerThread.java

示例9: PlayThread

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
public PlayThread(AdvancedPlayer player, int startPosition) {
	this.player = player;
	this.startPosition = startPosition;
}
 
开发者ID:kuhnmi,项目名称:jukefox,代码行数:5,代码来源:PlayThread.java

示例10: setStream

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
@Override
public void setStream(InputStream soundStream) throws Exception {
    this.mp3player = new AdvancedPlayer(soundStream);
}
 
开发者ID:paissad,项目名称:waqtsalat-eclipse-plugin,代码行数:5,代码来源:MP3SoundPlayer.java

示例11: speak

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
/**
 * Calls the MaryTTS to say the given text
 * 
 * @param text
 */
public void speak(String text) {
	System.out.println(text);
	
	//Create a new Thread because JLayer is running on the current Thread and will make the application to lag
	Thread thread = new Thread(() -> {
		try {
			
			//Create a JLayer instance
			AdvancedPlayer player = new AdvancedPlayer(synthesizer.getMP3Data(text));
			player.play();
			
			System.out.println("Successfully got back synthesizer data");
			
		} catch (IOException | JavaLayerException e) {
			
			e.printStackTrace(); //Print the exception ( we want to know , not hide below our finger , like many developers do...)
			
		}
	});
	
	//We don't want the application to terminate before this Thread terminates
	thread.setDaemon(false);
	
	//Start the Thread
	thread.start();
	
}
 
开发者ID:goxr3plus,项目名称:Java-Google-Text-To-Speech,代码行数:33,代码来源:Trying_Different_Languages.java

示例12: Play2Thread

import javazoom.jl.player.advanced.AdvancedPlayer; //导入依赖的package包/类
/**
 * Constructor for the Play2Thread object
 *
 * @param ap    Description of the Parameter
 * @param skip1 Description of the Parameter
 * @param skip2 Description of the Parameter
 */
public Play2Thread(AdvancedPlayer ap, int skip1, int skip2) {
    this.ap = ap;
    this.skip1 = skip1;
    this.skip2 = skip2;
}
 
开发者ID:SarutaSan72,项目名称:Yass,代码行数:13,代码来源:YassPlayer.java


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