@Override public void run() { // while(true){ try { Thread.sleep( 500 ); SampleChunk s = null; while( (s = this.nextSampleChunk()) != null ) { this.process( s ); } } catch( final InterruptedException e ) { e.printStackTrace(); } catch (final Exception e) { e.printStackTrace(); } // } }
@Override public Component getComponent(final int width, final int height) throws IOException{ final Component comp = super.getComponent(width, height); this.xa = new JavaSoundAudioGrabber(new AudioFormat( 16, 96.1, 1 )); this.xa.setMaxBufferSize( this.sampleChunkSize ); new Thread( this.xa ).start(); this.source = new FrequencyAudioSource(this.xa); this.source.addFrequencyListener(this,new Pair<Integer>(30,3400)); this.spectra = null; return comp; }
@Override public SampleChunk process(final SampleChunk sample) throws Exception { this.fftProc.process(sample); final float[] fft = this.fftProc.getLastFFT()[0]; this.fireFrequencyEvent(fft,sample); return sample; }
@Override public SampleChunk process(final SampleChunk sample) throws Exception { this.fftProc.process(sample); final float[] fft = this.fftProc.getLastFFT()[0]; this.fireFrequencyEvent(fft,sample); return sample; }
@Override public void run() { // while(true){ try { Thread.sleep( 500 ); SampleChunk s = null; while( (s = this.nextSampleChunk()) != null ) { this.process( s ); } } catch( final InterruptedException e ) { e.printStackTrace(); } catch (final Exception e) { e.printStackTrace(); } // } }