Class NTSampleDescription

java.lang.Object
com.io7m.jnoisetype.api.NTSampleDescription
All Implemented Interfaces:
NTNamedType, NTSampleDescriptionType

public final class NTSampleDescription extends Object implements NTSampleDescriptionType
Data that describes a sample.
  • Method Details

    • name

      public NTSampleName name()
      Specified by:
      name in interface NTSampleDescriptionType
      Returns:
      The name of the sample
    • kind

      public NTSampleKind kind()
      Specified by:
      kind in interface NTSampleDescriptionType
      Returns:
      The kind of the sample
    • start

      public long start()
      Specified by:
      start in interface NTSampleDescriptionType
      Returns:
      The index, in sample data points, from the beginning of the sample data field to the first data point of this sample
    • end

      public long end()
      Specified by:
      end in interface NTSampleDescriptionType
      Returns:
      The index, in sample data points, from the beginning of the sample data field to the first of the set of 46 zero valued data points following this sample
    • loopStart

      public long loopStart()
      Specified by:
      loopStart in interface NTSampleDescriptionType
      Returns:
      The index, in sample data points, from the beginning of the sample data field to the first data point in the loop of this sample
    • loopEnd

      public long loopEnd()
      Specified by:
      loopEnd in interface NTSampleDescriptionType
      Returns:
      The index, in sample data points, from the beginning of the sample data field to the first data point following the loop of this sample. Note that this is the data point “equivalent to” the first loop data point, and that to produce portable artifact free loops, the eight proximal data points surrounding both the Startloop and Endloop points should be identical.
    • sampleRate

      public int sampleRate()
      Specified by:
      sampleRate in interface NTSampleDescriptionType
      Returns:
      The sample rate in hz
    • originalPitch

      public NTPitch originalPitch()
      Specified by:
      originalPitch in interface NTSampleDescriptionType
      Returns:
      The original pitch of the sample
    • pitchCorrection

      public int pitchCorrection()
      Specified by:
      pitchCorrection in interface NTSampleDescriptionType
      Returns:
      The pitch correction value for the sample
    • sampleLink

      public int sampleLink()
      Specified by:
      sampleLink in interface NTSampleDescriptionType
      Returns:
      The sample link
    • withName

      public final NTSampleDescription withName(NTSampleName value)
      Copy the current immutable object by setting a value for the name attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy of the this object
    • withKind

      public final NTSampleDescription withKind(NTSampleKind value)
      Copy the current immutable object by setting a value for the kind attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for kind
      Returns:
      A modified copy of the this object
    • withStart

      public final NTSampleDescription withStart(long value)
      Copy the current immutable object by setting a value for the start attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for start
      Returns:
      A modified copy of the this object
    • withEnd

      public final NTSampleDescription withEnd(long value)
      Copy the current immutable object by setting a value for the end attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for end
      Returns:
      A modified copy of the this object
    • withLoopStart

      public final NTSampleDescription withLoopStart(long value)
      Copy the current immutable object by setting a value for the loopStart attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for loopStart
      Returns:
      A modified copy of the this object
    • withLoopEnd

      public final NTSampleDescription withLoopEnd(long value)
      Copy the current immutable object by setting a value for the loopEnd attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for loopEnd
      Returns:
      A modified copy of the this object
    • withSampleRate

      public final NTSampleDescription withSampleRate(int value)
      Copy the current immutable object by setting a value for the sampleRate attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for sampleRate
      Returns:
      A modified copy of the this object
    • withOriginalPitch

      public final NTSampleDescription withOriginalPitch(NTPitch value)
      Copy the current immutable object by setting a value for the originalPitch attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for originalPitch
      Returns:
      A modified copy of the this object
    • withPitchCorrection

      public final NTSampleDescription withPitchCorrection(int value)
      Copy the current immutable object by setting a value for the pitchCorrection attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for pitchCorrection
      Returns:
      A modified copy of the this object
    • withSampleLink

      public final NTSampleDescription withSampleLink(int value)
      Copy the current immutable object by setting a value for the sampleLink attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for sampleLink
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of NTSampleDescription that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: name, kind, start, end, loopStart, loopEnd, sampleRate, originalPitch, pitchCorrection, sampleLink.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value NTSampleDescription with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static NTSampleDescription copyOf(NTSampleDescriptionType instance)
      Creates an immutable copy of a NTSampleDescriptionType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable NTSampleDescription instance
    • builder

      public static NTSampleDescription.Builder builder()
      Creates a builder for NTSampleDescription.
       NTSampleDescription.builder()
          .setName(com.io7m.jnoisetype.api.NTSampleName) // required name
          .setKind(com.io7m.jnoisetype.api.NTSampleKind) // required kind
          .setStart(long) // required start
          .setEnd(long) // required end
          .setLoopStart(long) // required loopStart
          .setLoopEnd(long) // required loopEnd
          .setSampleRate(int) // required sampleRate
          .setOriginalPitch(com.io7m.jnoisetype.api.NTPitch) // required originalPitch
          .setPitchCorrection(int) // required pitchCorrection
          .setSampleLink(int) // optional sampleLink
          .build();
       
      Returns:
      A new NTSampleDescription builder