/** * {@inheritDoc} * * @see org.openimaj.time.TimeKeeper#getTime() */ @Override public AudioTimecode getTime() { // If we've not yet read any samples, just return the timecode // object as it was first given to us. if (this.timecodeReadAt == 0) return this.currentTimecode; // Update the timecode if we're playing (otherwise we'll return the // latest timecode) if (this.mode == Mode.PLAY) this.currentTimecode.setTimecodeInMilliseconds(this.currentTimestamp + (System.currentTimeMillis() - this.timecodeReadAt)); return this.currentTimecode; }
/** * {@inheritDoc} * * @see org.openimaj.time.TimeKeeper#getTime() */ @Override public AudioTimecode getTime() { // If we've not yet read any samples, just return the timecode // object as it was first given to us. if (this.timecodeReadAt == 0) return this.currentTimecode; // Update the timecode if we're playing (otherwise we'll return the // latest timecode) if (this.mode == Mode.PLAY) this.currentTimecode.setTimecodeInMilliseconds(this.currentTimestamp + (System.currentTimeMillis() - this.timecodeReadAt)); return this.currentTimecode; }
/** * {@inheritDoc} * * @see org.openimaj.time.TimeKeeper#reset() */ @Override public void reset() { this.timecodeReadAt = 0; this.currentTimestamp = 0; this.started = false; this.currentTimecode.setTimecodeInMilliseconds(0); this.stream.reset(); }
/** * {@inheritDoc} * * @see org.openimaj.time.TimeKeeper#pause() */ @Override public void pause() { this.setMode(Mode.PAUSE); // Set the current timecode to the time at which we paused. this.currentTimecode.setTimecodeInMilliseconds(this.currentTimestamp + (System.currentTimeMillis() - this.timecodeReadAt)); } }
/** * {@inheritDoc} * * @see org.openimaj.time.TimeKeeper#reset() */ @Override public void reset() { this.timecodeReadAt = 0; this.currentTimestamp = 0; this.started = false; this.currentTimecode.setTimecodeInMilliseconds(0); this.stream.reset(); }
/** * {@inheritDoc} * * @see org.openimaj.time.TimeKeeper#pause() */ @Override public void pause() { this.setMode(Mode.PAUSE); // Set the current timecode to the time at which we paused. this.currentTimecode.setTimecodeInMilliseconds(this.currentTimestamp + (System.currentTimeMillis() - this.timecodeReadAt)); } }
this.timecode.setTimecodeInMilliseconds(System.currentTimeMillis() - this.startMillis); sc.setStartTimecode(this.timecode);
this.timecode.setTimecodeInMilliseconds(System.currentTimeMillis() - this.startMillis); sc.setStartTimecode(this.timecode);
@Override public SampleChunk nextSampleChunk() { if( this.listIndex >= samples.size() ) return null; if( this.l == null || this.index >= this.l.size() ) { this.l = samples.get(this.listIndex); this.index = 0; this.listIndex++; this.timecodeOffset += this.currentTimecode; } // Get the current sample chunk final SampleChunk sc = this.l.get(this.index).getSampleChunk(); // Work out the timecode at the end of the sample chunk this.currentTimecode = (long)(sc.getStartTimecode().getTimecodeInMilliseconds() + sc.getNumberOfSamples() / sc.getFormat().getSampleRateKHz()); // Add the offset into the current timecode. sc.getStartTimecode().setTimecodeInMilliseconds( sc.getStartTimecode().getTimecodeInMilliseconds() + this.timecodeOffset ); this.index++; return sc; }
@Override public SampleChunk nextSampleChunk() { if( this.listIndex >= samples.size() ) return null; if( this.l == null || this.index >= this.l.size() ) { this.l = samples.get(this.listIndex); this.index = 0; this.listIndex++; this.timecodeOffset += this.currentTimecode; } // Get the current sample chunk final SampleChunk sc = this.l.get(this.index).getSampleChunk(); // Work out the timecode at the end of the sample chunk this.currentTimecode = (long)(sc.getStartTimecode().getTimecodeInMilliseconds() + sc.getNumberOfSamples() / sc.getFormat().getSampleRateKHz()); // Add the offset into the current timecode. sc.getStartTimecode().setTimecodeInMilliseconds( sc.getStartTimecode().getTimecodeInMilliseconds() + this.timecodeOffset ); this.index++; return sc; }
/** * {@inheritDoc} * @see org.openimaj.audio.processor.AudioProcessor#process(org.openimaj.audio.SampleChunk) */ @Override public SampleChunk process( final SampleChunk samples ) { // Detect beats. Note that we stop as soon as we detect a beat. this.beatDetected = false; final SampleBuffer sb = samples.getSampleBuffer(); int i = 0; for(; i < sb.size(); i++ ) { if( this.beatDetected = this.processSample( sb.get(i) ) ) break; } if( this.beatDetected() ) this.beatTimecode.setTimecodeInMilliseconds( (long)( samples.getStartTimecode().getTimecodeInMilliseconds() + i * this.format.getSampleRateKHz() ) ); // System.out.println( beatDetected ); // We return the samples unaltered return samples; }
/** * {@inheritDoc} * @see org.openimaj.audio.processor.AudioProcessor#process(org.openimaj.audio.SampleChunk) */ @Override public SampleChunk process( final SampleChunk samples ) { // Detect beats. Note that we stop as soon as we detect a beat. this.beatDetected = false; final SampleBuffer sb = samples.getSampleBuffer(); int i = 0; for(; i < sb.size(); i++ ) { if( this.beatDetected = this.processSample( sb.get(i) ) ) break; } if( this.beatDetected() ) this.beatTimecode.setTimecodeInMilliseconds( (long)( samples.getStartTimecode().getTimecodeInMilliseconds() + i * this.format.getSampleRateKHz() ) ); // System.out.println( beatDetected ); // We return the samples unaltered return samples; }
getTimecodeInMilliseconds(); this.timecodeReadAt = System.currentTimeMillis(); this.currentTimecode.setTimecodeInMilliseconds(this.currentTimestamp);
getTimecodeInMilliseconds(); this.timecodeReadAt = System.currentTimeMillis(); this.currentTimecode.setTimecodeInMilliseconds(this.currentTimestamp);
event.getTimeStamp().longValue(), event.getTimeUnit()); XuggleAudio.this.currentTimecode.setTimecodeInMilliseconds( timestampMillisecs);
event.getTimeStamp().longValue(), event.getTimeUnit()); XuggleAudio.this.currentTimecode.setTimecodeInMilliseconds( timestampMillisecs);