Class AbstractLineOutAmplitudeWriter<S extends SoundAmplitude, B extends LineOutAmplitudeWriter<S,B>>
java.lang.Object
org.refcodes.audio.AbstractLineOutAmplitudeWriter<S,B>
- Type Parameters:
S- TheSoundAmplitude(sub-)type on which theAmplitudeWriterimplementation is to operate on.B- TheAmplitudeWriterimplementing thisAbstractLineOutAmplitudeWriter.
- All Implemented Interfaces:
AutoCloseable, AmplitudeWriter<S,B>, BitsPerAmplitudeAccessor, BitsPerAmplitudeAccessor.BitsPerAmplitudeBuilder<B>, BitsPerAmplitudeAccessor.BitsPerAmplitudeMutator, BitsPerAmplitudeAccessor.BitsPerAmplitudeProperty, LineOutAmplitudeWriter<S, B>, SamplingRateAccessor, SamplingRateAccessor.SamplingRateBuilder<B>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty, org.refcodes.io.RowWriter<S>
- Direct Known Subclasses:
LineOutMonoAmplitudeWriter, LineOutSoundAmplitudeWriter
public abstract class AbstractLineOutAmplitudeWriter<S extends SoundAmplitude, B extends LineOutAmplitudeWriter<S,B>>
extends Object
implements LineOutAmplitudeWriter<S,B>
The
AbstractLineOutAmplitudeWriter provides a foundation means to
write sound samples to a line-out device.-
Nested Class Summary
Nested classes/interfaces inherited from interface BitsPerAmplitudeAccessor
BitsPerAmplitudeAccessor.BitsPerAmplitudeBuilder<B>, BitsPerAmplitudeAccessor.BitsPerAmplitudeMutator, BitsPerAmplitudeAccessor.BitsPerAmplitudePropertyNested classes/interfaces inherited from interface SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BitsPerAmplitudeprotected static final longprotected static final long -
Constructor Summary
ConstructorsConstructorDescriptionConstructs anAbstractLineOutAmplitudeWriter.AbstractLineOutAmplitudeWriter(BitsPerAmplitude aBitsPerAmplitude) Constructs anAbstractLineOutAmplitudeWriterwith the givenBitsPerAmplitudeto use. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the bits/amplitude per channel from the bits/amplitude per channel property.voidsetBitsPerAmplitude(BitsPerAmplitude aBitsPerAmplitude) Sets the bits/amplitude per channel for the bits/amplitude per channel property.protected static SourceDataLinetoLineOut(int aChannelCount, int aSamplingRate, BitsPerAmplitude aBitsPerAmplitude) Produces a line-outSourceDataLineinstance for writing samples to.protected static SourceDataLinetoLineOut(SoundAmplitude aSoundAmplitude, BitsPerAmplitude aBitsPerAmplitude) Produces a line-outSourceDataLineinstance for writing samples to.protected longtoWavSample(double eSampleData) To wav sample.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AmplitudeWriter
close, writeNextMethods inherited from interface BitsPerAmplitudeAccessor.BitsPerAmplitudeBuilder
withBitsPerAmplitudeMethods inherited from interface BitsPerAmplitudeAccessor.BitsPerAmplitudeProperty
letBitsPerAmplitudeMethods inherited from interface SamplingRateAccessor
getSamplingRateMethods inherited from interface SamplingRateAccessor.SamplingRateBuilder
withSamplingRateMethods inherited from interface SamplingRateAccessor.SamplingRateMutator
setSamplingRateMethods inherited from interface 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
-
AbstractLineOutAmplitudeWriter
public AbstractLineOutAmplitudeWriter()Constructs anAbstractLineOutAmplitudeWriter. -
AbstractLineOutAmplitudeWriter
Constructs anAbstractLineOutAmplitudeWriterwith the givenBitsPerAmplitudeto use.- Parameters:
aBitsPerAmplitude- The bits/amplitude to use when doing audio playback.
-
-
Method Details
-
setBitsPerAmplitude
Sets the bits/amplitude per channel for the bits/amplitude per channel property.- Specified by:
setBitsPerAmplitudein interfaceBitsPerAmplitudeAccessor.BitsPerAmplitudeMutator- Parameters:
aBitsPerAmplitude- The bits/amplitude per channel to be stored by the sampling rate property.
-
getBitsPerAmplitude
Retrieves the bits/amplitude per channel from the bits/amplitude per channel property.- Specified by:
getBitsPerAmplitudein interfaceBitsPerAmplitudeAccessor- Returns:
- The bits/amplitude per channel stored by the bits/amplitude per channel property.
-
toWavSample
protected long toWavSample(double eSampleData) To wav sample.- Parameters:
eSampleData- the e sample data- Returns:
- the long
-
toLineOut
protected static SourceDataLine toLineOut(SoundAmplitude aSoundAmplitude, BitsPerAmplitude aBitsPerAmplitude) throws LineUnavailableException Produces a line-outSourceDataLineinstance for writing samples to.- Parameters:
aSoundAmplitude- TheSoundAmplitudefrom which to get the according metrics.aBitsPerAmplitude- The preferred bits/amplitude.- Returns:
- An instance of the
SourceDataLineto which to write data. - Throws:
LineUnavailableException- thrown in case the audio-line cannot be acquired.
-
toLineOut
protected static SourceDataLine toLineOut(int aChannelCount, int aSamplingRate, BitsPerAmplitude aBitsPerAmplitude) throws LineUnavailableException Produces a line-outSourceDataLineinstance for writing samples to.- Parameters:
aChannelCount- The channel count to use (1 = mono, 2 = stereo)aSamplingRate- The sampling rate to useaBitsPerAmplitude- The preferred bits/amplitude.- Returns:
- An instance of the
SourceDataLineto which to write data. - Throws:
LineUnavailableException- thrown in case the audio-line cannot be acquired.
-