Package org.refcodes.audio
Class SoundSampleBuilderImpl
- java.lang.Object
-
- org.refcodes.audio.SoundSampleBuilderImpl
-
- All Implemented Interfaces:
SampleBuilder<SoundSample,SoundSampleBuilder>
,SamplingRateAccessor
,SamplingRateAccessor.SamplingRateBuilder<SoundSample>
,SamplingRateAccessor.SamplingRateMutator
,SamplingRateAccessor.SamplingRateProperty
,SoundSample
,SoundSampleBuilder
,org.refcodes.mixin.IndexAccessor
,org.refcodes.mixin.IndexAccessor.IndexBuilder<SoundSample>
,org.refcodes.mixin.IndexAccessor.IndexMutator
,org.refcodes.mixin.IndexAccessor.IndexProperty
,org.refcodes.mixin.TimeStampAccessor
,org.refcodes.mixin.TimeStampAccessor.TimeStampBuilder<SoundSample>
,org.refcodes.mixin.TimeStampAccessor.TimeStampMutator
,org.refcodes.mixin.TimeStampAccessor.TimeStampProperty
public class SoundSampleBuilderImpl extends Object implements SoundSampleBuilder
ASoundSampleBuilder
represents multiple amplitudes (one for each channel,e.g. two in case we have classical stereo sound) assigned to an according time positioning.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.IndexAccessor
org.refcodes.mixin.IndexAccessor.IndexBuilder<B extends org.refcodes.mixin.IndexAccessor.IndexBuilder<B>>, org.refcodes.mixin.IndexAccessor.IndexMutator, org.refcodes.mixin.IndexAccessor.IndexProperty
-
Nested classes/interfaces inherited from interface org.refcodes.audio.SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.TimeStampAccessor
org.refcodes.mixin.TimeStampAccessor.TimeStampBuilder<B extends org.refcodes.mixin.TimeStampAccessor.TimeStampBuilder<B>>, org.refcodes.mixin.TimeStampAccessor.TimeStampMutator, org.refcodes.mixin.TimeStampAccessor.TimeStampProperty
-
-
Constructor Summary
Constructors Constructor Description SoundSampleBuilderImpl(double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(double aTimeMillis, double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(double aTimeMillis, double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(long aIndex, double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(long aIndex, double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(long aIndex, double aTimeMillis, double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(long aIndex, double aTimeMillis, double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(long aIndex, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.SoundSampleBuilderImpl(SoundSample aSoundSample)
Constructs aSoundSampleImpl
instance with the according sound sample's settings
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decreaseIndex()
long
getIndex()
double[]
getSampleData()
Returns the sample's data for the according time positioning.int
getSamplingRate()
Retrieves the sampling rate from the sampling rate property.double
getTimeStamp()
Returns the position in time of this sound sample in ms.void
increaseIndex()
void
setIndex(long aIndex)
void
setSampleData(double[] aSampleData)
Sets the sample's data for the according time positioning.void
setSamplingRate(int aSamplingRate)
Sets the sampling rate for the sampling rate property.void
setTimeStamp(double aTimeInMillis)
Sets the position in time of this sound sample in ms.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.audio.SampleBuilder
updateTimeStamp
-
Methods inherited from interface org.refcodes.audio.SoundSample
getChannelCount
-
Methods inherited from interface org.refcodes.audio.SoundSampleBuilder
build, withDecreaseIndex, withIncreaseIndex, withIndex, withSampleData, withSamplingRate, withTimeStamp
-
-
-
-
Constructor Detail
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(SoundSample aSoundSample)
Constructs aSoundSampleImpl
instance with the according sound sample's settings- Parameters:
aSoundSample
- The sound sample from which to create a new instance.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(double aTimeMillis, double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aTimeMillis
- The time positioning of this sound sample.aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(double aTimeMillis, double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aTimeMillis
- The time positioning of this sound sample.aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.aSamplingRate
- The sampling rate for the given sample.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.aSamplingRate
- The sampling rate for the given sample.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(long aIndex, double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aIndex
- The index of the sample according to its position in the sample sequence (e.g. sound file).aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(long aIndex, double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aIndex
- The index of the sample according to its position in the sample sequence (e.g. sound file).aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.aSamplingRate
- The sampling rate for the given sample.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(long aIndex, double aTimeMillis, double[] aSampleData)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aIndex
- The index of the sample according to its position in the sample sequence (e.g. sound file).aTimeMillis
- The time positioning of this sound sample.aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(long aIndex, double aTimeMillis, double[] aSampleData, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aIndex
- The index of the sample according to its position in the sample sequence (e.g. sound file).aTimeMillis
- The time positioning of this sound sample.aSampleData
- The sample (set of values representing the channels, one channel per value) for the related time positioning.aSamplingRate
- The sampling rate for the given sample.
-
SoundSampleBuilderImpl
public SoundSampleBuilderImpl(long aIndex, int aSamplingRate)
Constructs aSoundSampleBuilder
instance with the according time and sample settings.- Parameters:
aIndex
- The index of the sample according to its position in the sample sequence (e.g. sound file).aSamplingRate
- The sampling rate for the given sample.
-
-
Method Detail
-
getSampleData
public double[] getSampleData()
Returns the sample's data for the according time positioning. A sample is a value or set of values at a point in time. In case of mono audio, a sample represents a single value, in case of stereo audio, a sample represents a set of values, one value represents one channel (e.g. two channels when we have a left and a right speaker).- Specified by:
getSampleData
in interfaceSoundSample
- Returns:
- The sample's data for the according time positioning.
-
getTimeStamp
public double getTimeStamp()
Returns the position in time of this sound sample in ms.- Specified by:
getTimeStamp
in interfaceSoundSample
- Specified by:
getTimeStamp
in interfaceorg.refcodes.mixin.TimeStampAccessor
- Returns:
- The sound sample's time positioning.
-
getSamplingRate
public int getSamplingRate()
Retrieves the sampling rate from the sampling rate property.- Specified by:
getSamplingRate
in interfaceSamplingRateAccessor
- Returns:
- The sampling rate stored by the sampling rate property.
-
getIndex
public long getIndex()
- Specified by:
getIndex
in interfaceorg.refcodes.mixin.IndexAccessor
-
setIndex
public void setIndex(long aIndex)
- Specified by:
setIndex
in interfaceorg.refcodes.mixin.IndexAccessor.IndexMutator
-
increaseIndex
public void increaseIndex()
- Specified by:
increaseIndex
in interfaceorg.refcodes.mixin.IndexAccessor.IndexMutator
-
decreaseIndex
public void decreaseIndex()
- Specified by:
decreaseIndex
in interfaceorg.refcodes.mixin.IndexAccessor.IndexMutator
-
setSampleData
public void setSampleData(double[] aSampleData)
Sets the sample's data for the according time positioning. A sample is a value or set of values at a point in time. In case of mono audio, a sample represents a single value, in case of stereo audio, a sample represents a set of values, one value represents one channel (e.g. two channels when we have a left and a right speaker).- Specified by:
setSampleData
in interfaceSoundSampleBuilder
- Parameters:
aSampleData
- The sample's data for the according time positioning.
-
setTimeStamp
public void setTimeStamp(double aTimeInMillis)
Sets the position in time of this sound sample in ms.- Specified by:
setTimeStamp
in interfaceSoundSampleBuilder
- Specified by:
setTimeStamp
in interfaceorg.refcodes.mixin.TimeStampAccessor.TimeStampMutator
- Parameters:
aTimeInMillis
- The sound sample's time positioning in ms.
-
setSamplingRate
public void setSamplingRate(int aSamplingRate)
Sets the sampling rate for the sampling rate property.- Specified by:
setSamplingRate
in interfaceSamplingRateAccessor.SamplingRateMutator
- Parameters:
aSamplingRate
- The sampling rate to be stored by the sampling rate property.
-
-