Package com.io7m.jnoisetype.api
Class NTSampleDescription
java.lang.Object
com.io7m.jnoisetype.api.NTSampleDescription
- All Implemented Interfaces:
NTNamedType
,NTSampleDescriptionType
Data that describes a sample.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builds instances of typeNTSampleDescription
. -
Method Summary
Modifier and TypeMethodDescriptionstatic NTSampleDescription.Builder
builder()
Creates a builder forNTSampleDescription
.static NTSampleDescription
copyOf
(NTSampleDescriptionType instance) Creates an immutable copy of aNTSampleDescriptionType
value.long
end()
boolean
This instance is equal to all instances ofNTSampleDescription
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:name
,kind
,start
,end
,loopStart
,loopEnd
,sampleRate
,originalPitch
,pitchCorrection
,sampleLink
.kind()
long
loopEnd()
long
name()
int
int
int
long
start()
toString()
Prints the immutable valueNTSampleDescription
with attribute values.final NTSampleDescription
withEnd
(long value) Copy the current immutable object by setting a value for theend
attribute.final NTSampleDescription
withKind
(NTSampleKind value) Copy the current immutable object by setting a value for thekind
attribute.final NTSampleDescription
withLoopEnd
(long value) Copy the current immutable object by setting a value for theloopEnd
attribute.final NTSampleDescription
withLoopStart
(long value) Copy the current immutable object by setting a value for theloopStart
attribute.final NTSampleDescription
withName
(NTSampleName value) Copy the current immutable object by setting a value for thename
attribute.final NTSampleDescription
withOriginalPitch
(NTPitch value) Copy the current immutable object by setting a value for theoriginalPitch
attribute.final NTSampleDescription
withPitchCorrection
(int value) Copy the current immutable object by setting a value for thepitchCorrection
attribute.final NTSampleDescription
withSampleLink
(int value) Copy the current immutable object by setting a value for thesampleLink
attribute.final NTSampleDescription
withSampleRate
(int value) Copy the current immutable object by setting a value for thesampleRate
attribute.final NTSampleDescription
withStart
(long value) Copy the current immutable object by setting a value for thestart
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.io7m.jnoisetype.api.NTSampleDescriptionType
linked, nameText
-
Method Details
-
name
- Specified by:
name
in interfaceNTSampleDescriptionType
- Returns:
- The name of the sample
-
kind
- Specified by:
kind
in interfaceNTSampleDescriptionType
- Returns:
- The kind of the sample
-
start
public long start()- Specified by:
start
in 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:
end
in 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:
loopStart
in 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:
loopEnd
in 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:
sampleRate
in interfaceNTSampleDescriptionType
- Returns:
- The sample rate in hz
-
originalPitch
- Specified by:
originalPitch
in interfaceNTSampleDescriptionType
- Returns:
- The original pitch of the sample
-
pitchCorrection
public int pitchCorrection()- Specified by:
pitchCorrection
in interfaceNTSampleDescriptionType
- Returns:
- The pitch correction value for the sample
-
sampleLink
public int sampleLink()- Specified by:
sampleLink
in interfaceNTSampleDescriptionType
- Returns:
- The sample link
-
withName
Copy the current immutable object by setting a value for thename
attribute. 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
this
object
-
withKind
Copy the current immutable object by setting a value for thekind
attribute. 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
this
object
-
withStart
Copy the current immutable object by setting a value for thestart
attribute. 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
this
object
-
withEnd
Copy the current immutable object by setting a value for theend
attribute. 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
this
object
-
withLoopStart
Copy the current immutable object by setting a value for theloopStart
attribute. 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
this
object
-
withLoopEnd
Copy the current immutable object by setting a value for theloopEnd
attribute. 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
this
object
-
withSampleRate
Copy the current immutable object by setting a value for thesampleRate
attribute. 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
this
object
-
withOriginalPitch
Copy the current immutable object by setting a value for theoriginalPitch
attribute. 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
this
object
-
withPitchCorrection
Copy the current immutable object by setting a value for thepitchCorrection
attribute. 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
this
object
-
withSampleLink
Copy the current immutable object by setting a value for thesampleLink
attribute. 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
this
object
-
equals
This instance is equal to all instances ofNTSampleDescription
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:name
,kind
,start
,end
,loopStart
,loopEnd
,sampleRate
,originalPitch
,pitchCorrection
,sampleLink
. -
toString
Prints the immutable valueNTSampleDescription
with attribute values. -
copyOf
Creates an immutable copy of aNTSampleDescriptionType
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
Creates a builder forNTSampleDescription
.NTSampleDescription.builder() .setName(com.io7m.jnoisetype.api.NTSampleName) // required
name
.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
-