/** * @param samples * The samples to use * @param af * The audio format of the samples */ public FloatSampleBuffer(final float[] samples, final AudioFormat af) { this.format = af.clone(); this.format.setNBits(-1); this.samples = samples; }
/** * {@inheritDoc} * * @see org.openimaj.audio.samples.SampleBuffer#setFormat(org.openimaj.audio.AudioFormat) */ @Override public void setFormat(final AudioFormat af) { this.format = af.clone(); this.format.setNBits(-1); }
/** * @param samples * The samples to use * @param af * The audio format of the samples */ public FloatSampleBuffer(final float[] samples, final AudioFormat af) { this.format = af.clone(); this.format.setNBits(-1); this.samples = samples; }
/** * {@inheritDoc} * * @see org.openimaj.audio.samples.SampleBuffer#setFormat(org.openimaj.audio.AudioFormat) */ @Override public void setFormat(final AudioFormat af) { this.format = af.clone(); this.format.setNBits(-1); }
/** * Samples represented as a set of doubles. * @param samples The samples. * @param format The format of the samples */ public void setData( final double[] samples, final AudioFormat format ) { final FloatSampleBuffer fsb = new FloatSampleBuffer( samples, format.clone().setNBits( -1 ) ); super.setData( fsb ); }
/** * Updates the number of bits in the source processor's format to match the output format. * * @param ap The source processor * @param output The output format * @return The fixed source format */ private static AudioFormat getFormatBits( final AudioProcessor ap , final AudioFormat output ) { if( ap == null ) return output; final AudioFormat f = ap.getFormat().clone(); f.setNBits( output.getNBits() ); return f; }
/** * Updates the number of bits in the source processor's format to match the output format. * * @param ap The source processor * @param output The output format * @return The fixed source format */ private static AudioFormat getFormatBits( final AudioProcessor ap , final AudioFormat output ) { if( ap == null ) return output; final AudioFormat f = ap.getFormat().clone(); f.setNBits( output.getNBits() ); return f; }