Class MonoSampleBuilderImpl

java.lang.Object
org.refcodes.audio.MonoSampleBuilderImpl
All Implemented Interfaces:
MonoSample, MonoSampleBuilder, SampleBuilder<MonoSample,MonoSampleBuilder>, SamplingRateAccessor, SamplingRateAccessor.SamplingRateBuilder<MonoSampleBuilder>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty, SoundSample, org.refcodes.mixin.IndexAccessor, org.refcodes.mixin.IndexAccessor.IndexBuilder<MonoSampleBuilder>, org.refcodes.mixin.IndexAccessor.IndexMutator, org.refcodes.mixin.IndexAccessor.IndexProperty, org.refcodes.mixin.TimeStampAccessor, org.refcodes.mixin.TimeStampAccessor.TimeStampBuilder<MonoSampleBuilder>, org.refcodes.mixin.TimeStampAccessor.TimeStampMutator, org.refcodes.mixin.TimeStampAccessor.TimeStampProperty

public class MonoSampleBuilderImpl extends Object implements MonoSampleBuilder
A MonoSampleBuilderImpl represents a single amplitude (one for the mono channel) assigned to an according time positioning.
  • Constructor Details

    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(MonoSample aSample)
      Constructs a MonoSample instance with the according sound sample's settings
      Parameters:
      aSample - The sample (set of values representing the channels, one channel per value) for the related time positioning.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(double aSample)
      Constructs a MonoSample instance with the according time and sample settings.
      Parameters:
      aSample - The sample (set of values representing the channels, one channel per value) for the related time positioning.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(double aTimeMillis, double aSample)
      Constructs a MonoSample instance with the according time and sample settings.
      Parameters:
      aTimeMillis - The time positioning of this sound sample.
      aSample - The sample (set of values representing the channels, one channel per value) for the related time positioning.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(double aTimeMillis, double aSample, int aSamplingRate)
      Constructs a MonoSample instance with the according time and sample settings.
      Parameters:
      aTimeMillis - The time positioning of this sound sample.
      aSample - 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.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(double aSample, int aSamplingRate)
      Constructs a MonoSample instance with the according time and sample settings.
      Parameters:
      aSample - 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.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(long aIndex, double aSample)
      Constructs a MonoSample 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).
      aSample - The sample (set of values representing the channels, one channel per value) for the related time positioning.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(long aIndex, double aSample, int aSamplingRate)
      Constructs a MonoSample 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).
      aSample - 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.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(long aIndex, double aTimeMillis, double aSample)
      Constructs a MonoSample 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.
      aSample - The sample (set of values representing the channels, one channel per value) for the related time positioning.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(long aIndex, double aTimeMillis, double aSample, int aSamplingRate)
      Constructs a MonoSample 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.
      aSample - 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.
    • MonoSampleBuilderImpl

      public MonoSampleBuilderImpl(long aIndex, int aSamplingRate)
      Constructs a SoundSampleBuilder 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 Details

    • setMonoData

      public void setMonoData(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:
      setMonoData in interface MonoSampleBuilder
      Parameters:
      aSampleData - The sample's data for the according time positioning.
    • 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 interface SoundSample
      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 interface SoundSample
      Specified by:
      getTimeStamp in interface org.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 interface SamplingRateAccessor
      Returns:
      The sampling rate stored by the sampling rate property.
    • getIndex

      public long getIndex()
      Specified by:
      getIndex in interface org.refcodes.mixin.IndexAccessor
    • setIndex

      public void setIndex(long aIndex)
      Specified by:
      setIndex in interface org.refcodes.mixin.IndexAccessor.IndexMutator
    • increaseIndex

      public void increaseIndex()
      Specified by:
      increaseIndex in interface org.refcodes.mixin.IndexAccessor.IndexMutator
    • decreaseIndex

      public void decreaseIndex()
      Specified by:
      decreaseIndex in interface org.refcodes.mixin.IndexAccessor.IndexMutator
    • setTimeStamp

      public void setTimeStamp(double aTimeMillis)
      Sets the position in time of this sound sample in ms.
      Specified by:
      setTimeStamp in interface MonoSampleBuilder
      Specified by:
      setTimeStamp in interface org.refcodes.mixin.TimeStampAccessor.TimeStampMutator
      Parameters:
      aTimeMillis - 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 interface SamplingRateAccessor.SamplingRateMutator
      Parameters:
      aSamplingRate - The sampling rate to be stored by the sampling rate property.
    • toString

      public String toString()
      Overrides:
      toString in class Object