Package com.io7m.jnoisetype.api
Class NTSampleDescription
java.lang.Object
com.io7m.jnoisetype.api.NTSampleDescription
- All Implemented Interfaces:
NTNamedType,NTSampleDescriptionType
public final class NTSampleDescription extends java.lang.Object implements NTSampleDescriptionType
Data that describes a sample.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNTSampleDescription.BuilderBuilds instances of typeNTSampleDescription. -
Method Summary
Modifier and Type Method Description static NTSampleDescription.Builderbuilder()Creates a builder forNTSampleDescription.static NTSampleDescriptioncopyOf(NTSampleDescriptionType instance)Creates an immutable copy of aNTSampleDescriptionTypevalue.longend()booleanequals(java.lang.Object another)This instance is equal to all instances ofNTSampleDescriptionthat have equal attribute values.inthashCode()Computes a hash code from attributes:name,kind,start,end,loopStart,loopEnd,sampleRate,originalPitch,pitchCorrection,sampleLink.NTSampleKindkind()longloopEnd()longloopStart()NTSampleNamename()NTPitchoriginalPitch()intpitchCorrection()intsampleLink()intsampleRate()longstart()java.lang.StringtoString()Prints the immutable valueNTSampleDescriptionwith attribute values.NTSampleDescriptionwithEnd(long value)Copy the current immutable object by setting a value for theendattribute.NTSampleDescriptionwithKind(NTSampleKind value)Copy the current immutable object by setting a value for thekindattribute.NTSampleDescriptionwithLoopEnd(long value)Copy the current immutable object by setting a value for theloopEndattribute.NTSampleDescriptionwithLoopStart(long value)Copy the current immutable object by setting a value for theloopStartattribute.NTSampleDescriptionwithName(NTSampleName value)Copy the current immutable object by setting a value for thenameattribute.NTSampleDescriptionwithOriginalPitch(NTPitch value)Copy the current immutable object by setting a value for theoriginalPitchattribute.NTSampleDescriptionwithPitchCorrection(int value)Copy the current immutable object by setting a value for thepitchCorrectionattribute.NTSampleDescriptionwithSampleLink(int value)Copy the current immutable object by setting a value for thesampleLinkattribute.NTSampleDescriptionwithSampleRate(int value)Copy the current immutable object by setting a value for thesampleRateattribute.NTSampleDescriptionwithStart(long value)Copy the current immutable object by setting a value for thestartattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.jnoisetype.api.NTSampleDescriptionType
linked, nameText
-
Method Details
-
name
- Specified by:
namein interfaceNTSampleDescriptionType- Returns:
- The name of the sample
-
kind
- Specified by:
kindin interfaceNTSampleDescriptionType- Returns:
- The kind of the sample
-
start
public long start()- Specified by:
startin interfaceNTSampleDescriptionType- 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:
endin interfaceNTSampleDescriptionType- 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:
loopStartin interfaceNTSampleDescriptionType- 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:
loopEndin interfaceNTSampleDescriptionType- 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:
sampleRatein interfaceNTSampleDescriptionType- Returns:
- The sample rate in hz
-
originalPitch
- Specified by:
originalPitchin interfaceNTSampleDescriptionType- Returns:
- The original pitch of the sample
-
pitchCorrection
public int pitchCorrection()- Specified by:
pitchCorrectionin interfaceNTSampleDescriptionType- Returns:
- The pitch correction value for the sample
-
sampleLink
public int sampleLink()- Specified by:
sampleLinkin interfaceNTSampleDescriptionType- Returns:
- The sample link
-
withName
Copy the current immutable object by setting a value for thenameattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withKind
Copy the current immutable object by setting a value for thekindattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for kind- Returns:
- A modified copy of the
thisobject
-
withStart
Copy the current immutable object by setting a value for thestartattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for start- Returns:
- A modified copy of the
thisobject
-
withEnd
Copy the current immutable object by setting a value for theendattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for end- Returns:
- A modified copy of the
thisobject
-
withLoopStart
Copy the current immutable object by setting a value for theloopStartattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for loopStart- Returns:
- A modified copy of the
thisobject
-
withLoopEnd
Copy the current immutable object by setting a value for theloopEndattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for loopEnd- Returns:
- A modified copy of the
thisobject
-
withSampleRate
Copy the current immutable object by setting a value for thesampleRateattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for sampleRate- Returns:
- A modified copy of the
thisobject
-
withOriginalPitch
Copy the current immutable object by setting a value for theoriginalPitchattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for originalPitch- Returns:
- A modified copy of the
thisobject
-
withPitchCorrection
Copy the current immutable object by setting a value for thepitchCorrectionattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for pitchCorrection- Returns:
- A modified copy of the
thisobject
-
withSampleLink
Copy the current immutable object by setting a value for thesampleLinkattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for sampleLink- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofNTSampleDescriptionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:name,kind,start,end,loopStart,loopEnd,sampleRate,originalPitch,pitchCorrection,sampleLink.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueNTSampleDescriptionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aNTSampleDescriptionTypevalue. 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
Creates a builder forNTSampleDescription.NTSampleDescription.builder() .setName(com.io7m.jnoisetype.api.NTSampleName) // requiredname.setKind(com.io7m.jnoisetype.api.NTSampleKind) // requiredkind.setStart(long) // requiredstart.setEnd(long) // requiredend.setLoopStart(long) // requiredloopStart.setLoopEnd(long) // requiredloopEnd.setSampleRate(int) // requiredsampleRate.setOriginalPitch(com.io7m.jnoisetype.api.NTPitch) // requiredoriginalPitch.setPitchCorrection(int) // requiredpitchCorrection.setSampleLink(int) // optionalsampleLink.build();- Returns:
- A new NTSampleDescription builder
-