/** * Plays a sound through the audio API. */ protected void playNormalSound( AudioStream s ) { AudioPlayer ap = new AudioPlayer( s ); ap.run(); }
final AudioPlayer ap = new AudioPlayer( audio ); ap.pause(); System.out.println( ap.getTime() ); Thread.sleep( 2000 ); ap.run(); System.out.println( ap.getTime() ); Thread.sleep( 1500 ); System.out.println( ap.getTime() ); Thread.sleep( 1500 ); ap.reset(); System.out.println( ap.getTime() ); Thread.sleep( 10000 );
/** * Play the given stream to a specific device. * * @param a * The audio stream to play. * @param deviceName * The device to play the audio to. */ public AudioPlayer(final AudioStream a, final String deviceName) { this.stream = a; this.deviceName = deviceName; this.setTimecodeObject(new AudioTimecode(0)); }
/** * Main method. * @param args */ public static void main( final String[] args ) { final InputStream is = AudioFromStream.class.getResourceAsStream( "/org/openimaj/demos/sandbox/audio/WelcomeToTheNews.wav" ); if( is != null ) { final XuggleAudio xa = new XuggleAudio( is ); final AudioPlayer ap = AudioPlayer.createAudioPlayer( xa ); ap.run(); } else System.out.println( "Stream not found." ); } }
final JFrame f = aw.showWindow( "Audio" ); final AudioPlayer ap = new AudioPlayer( xa ); ap.addAudioEventListener( new AudioEventListener() ap.run();
public void run() this.setMode(Mode.PLAY); this.timecodeReadAt = 0; if (!this.started) this.openJavaSound(); this.fireBeforePlay(samples); this.playJavaSound(samples); this.fireAfterPlay(samples); this.fireAudioEnded(this.stream); this.setMode(Mode.STOP); this.reset(); } catch (final Exception e) this.closeJavaSound(); this.setMode(Mode.PLAY);
/** * Create a new audio player in a separate thread for playing audio. * * @param as * The audio stream to play. * @return The audio player created. */ public static AudioPlayer createAudioPlayer(final AudioStream as) { final AudioPlayer ap = new AudioPlayer(as); new Thread(ap).start(); return ap; }
final AudioPlayer ap = new AudioPlayer( am /*, "M44 [plughw:0,0]" */ ); ap.setTimecodeObject( new MeasuresBeatsTicksTimecode( 140 ) );
this.video.reset(); if (this.audioPlayer != null) this.audioPlayer.reset(); this.timeKeeper.reset(); this.currentFrameTimestamp = 0;
final AudioPlayer ap = AudioPlayer.createAudioPlayer( synth ); new Thread( ap ).start();
final JFrame f = aw.showWindow( "Audio" ); final AudioPlayer ap = new AudioPlayer( xa ); ap.addAudioEventListener( new AudioEventListener() ap.run();
public void run() this.setMode(Mode.PLAY); this.timecodeReadAt = 0; if (!this.started) this.openJavaSound(); this.fireBeforePlay(samples); this.playJavaSound(samples); this.fireAfterPlay(samples); this.fireAudioEnded(this.stream); this.setMode(Mode.STOP); this.reset(); } catch (final Exception e) this.closeJavaSound(); this.setMode(Mode.PLAY);
/** * Create a new audio player in a separate thread for playing audio. * * @param as * The audio stream to play. * @return The audio player created. */ public static AudioPlayer createAudioPlayer(final AudioStream as) { final AudioPlayer ap = new AudioPlayer(as); new Thread(ap).start(); return ap; }
final AudioPlayer ap = new AudioPlayer( am /*, "M44 [plughw:0,0]" */ ); ap.setTimecodeObject( new MeasuresBeatsTicksTimecode( 140 ) );
/** * Main method. * @param args */ public static void main( final String[] args ) { final InputStream is = AudioFromStream.class.getResourceAsStream( "/org/openimaj/demos/sandbox/audio/WelcomeToTheNews.wav" ); if( is != null ) { final XuggleAudio xa = new XuggleAudio( is ); final AudioPlayer ap = AudioPlayer.createAudioPlayer( xa ); ap.run(); } else System.out.println( "Stream not found." ); } }
this.video.reset(); if (this.audioPlayer != null) this.audioPlayer.reset(); this.timeKeeper.reset(); this.currentFrameTimestamp = 0;
final AudioPlayer ap = AudioPlayer.createAudioPlayer( synth ); new Thread( ap ).start();
AudioPlayer ap = new AudioPlayer( x1 ); ap.addAudioEventListener( new AudioEventAdapter() x2.getFormat().getNumChannels() ) ); System.out.println( "Playing audio "+src.getFormat() ); AudioPlayer ap2 = new AudioPlayer( src ); ap2.addAudioEventListener( new AudioEventAdapter() src2.getFormat().getNumChannels() ) ); System.out.println( "Playing audio "+src2.getFormat() ); AudioPlayer ap3 = new AudioPlayer( bd1 ); ap3.addAudioEventListener( new AudioEventAdapter() MultichannelToMonoProcessor mc = new MultichannelToMonoProcessor( bd2 ); System.out.println( "Playing audio "+src3.getFormat() ); AudioPlayer ap4 = new AudioPlayer( mc ); ap4.run(); System.out.println( "4----------------------------------------- "); ap.run(); System.out.println( "1----------------------------------------- ");