Module org.refcodes.audio
Package org.refcodes.audio
Class AbstractLineOutSampleWriter<S extends SoundSample,B extends LineOutSampleWriter<S,B>>
java.lang.Object
org.refcodes.audio.AbstractLineOutSampleWriter<S,B>
- Type Parameters:
S- TheSoundSample(sub-)type on which theSampleWriterimplementation is to operate on.B- TheSampleWriterimplementing thisAbstractLineOutSampleWriter.
- All Implemented Interfaces:
AutoCloseable,BitsPerSampleAccessor,BitsPerSampleAccessor.BitsPerSampleBuilder<B>,BitsPerSampleAccessor.BitsPerSampleMutator,BitsPerSampleAccessor.BitsPerSampleProperty,LineOutSampleWriter<S,,B> SampleWriter<S,,B> SamplingRateAccessor,SamplingRateAccessor.SamplingRateBuilder<B>,SamplingRateAccessor.SamplingRateMutator,SamplingRateAccessor.SamplingRateProperty,org.refcodes.io.RowWriter<S>
- Direct Known Subclasses:
LineOutMonoSampleWriter,LineOutSoundSampleWriter
public abstract class AbstractLineOutSampleWriter<S extends SoundSample,B extends LineOutSampleWriter<S,B>>
extends Object
implements LineOutSampleWriter<S,B>
The
AbstractLineOutSampleWriter provides a foundation means to write
sound samples to a line-out device.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.audio.BitsPerSampleAccessor
BitsPerSampleAccessor.BitsPerSampleBuilder<B extends BitsPerSampleAccessor.BitsPerSampleBuilder<B>>, BitsPerSampleAccessor.BitsPerSampleMutator, BitsPerSampleAccessor.BitsPerSamplePropertyNested classes/interfaces inherited from interface org.refcodes.audio.SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BitsPerSampleprotected static final longprotected static final long -
Constructor Summary
ConstructorsConstructorDescriptionConstructs anAbstractLineOutSampleWriter.AbstractLineOutSampleWriter(BitsPerSample aBitsPerSample) Constructs anAbstractLineOutSampleWriterwith the givenBitsPerSampleto use. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the bits/sample per channel from the bits/sample per channel property.voidsetBitsPerSample(BitsPerSample aBitsPerSample) Sets the bits/sample per channel for the bits/sample per channel property.protected static SourceDataLinetoLineOut(SoundSample aSoundSample, BitsPerSample aBitsPerSample) Produces a line-outSourceDataLineinstance for writing samples to.protected longtoWavSample(double eSampleData) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.audio.BitsPerSampleAccessor.BitsPerSampleBuilder
withBitsPerSampleMethods inherited from interface org.refcodes.audio.BitsPerSampleAccessor.BitsPerSampleProperty
letBitsPerSampleMethods inherited from interface org.refcodes.audio.SampleWriter
close, writeNextMethods inherited from interface org.refcodes.audio.SamplingRateAccessor
getSamplingRateMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateBuilder
withSamplingRateMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateMutator
setSamplingRateMethods inherited from interface org.refcodes.audio.SamplingRateAccessor.SamplingRateProperty
letSamplingRate
-
Field Details
-
MAX_16_BIT
protected static final long MAX_16_BIT- See Also:
-
MAX_8_BIT
protected static final long MAX_8_BIT- See Also:
-
_bitsPerSample
-
-
Constructor Details
-
AbstractLineOutSampleWriter
public AbstractLineOutSampleWriter()Constructs anAbstractLineOutSampleWriter. -
AbstractLineOutSampleWriter
Constructs anAbstractLineOutSampleWriterwith the givenBitsPerSampleto use.- Parameters:
aBitsPerSample- The bits/sample to use when doing audio playback.
-
-
Method Details
-
setBitsPerSample
Sets the bits/sample per channel for the bits/sample per channel property.- Specified by:
setBitsPerSamplein interfaceBitsPerSampleAccessor.BitsPerSampleMutator- Parameters:
aBitsPerSample- The bits/sample per channel to be stored by the sampling rate property.
-
getBitsPerSample
Retrieves the bits/sample per channel from the bits/sample per channel property.- Specified by:
getBitsPerSamplein interfaceBitsPerSampleAccessor- Returns:
- The bits/sample per channel stored by the bits/sample per channel property.
-
toWavSample
protected long toWavSample(double eSampleData) -
toLineOut
protected static SourceDataLine toLineOut(SoundSample aSoundSample, BitsPerSample aBitsPerSample) throws LineUnavailableException Produces a line-outSourceDataLineinstance for writing samples to.- Parameters:
aSoundSample- TheSoundSamplefrom which to get the according metrics.aBitsPerSample- The preferred bits/sample.- Returns:
- An instance of the
SourceDataLineto which to write data. - Throws:
LineUnavailableException- thrown in case the audio-line cannot be acquired.
-