Class weasel.Sample
Defined in: Sample.js.
Constructor Attributes | Constructor Name and Description |
---|---|
weasel.Sample(oInstrument, oModule, iSampleNumber, iSampleScannerMode)
The Sample object contains the raw sample data needed by the instrument.
|
Field Attributes | Field Name and Description |
---|---|
The default size of a looped sample's barrel loop (used to increase the
performance [speed] of play a looped sample at the cost of memory).
|
|
Different modes for dealing with scanning for IFF header corruption residue,
display names where '$' is converted to '-' and '_' becomes ' '.
|
Method Attributes | Method Name and Description |
---|---|
Was sample data cleaned of IFF Headers, if any where found and
assuming the Scanner was active in the first place.
|
|
Get the size of the barrel loop attached to the end of the sample or the
end of loop (used to increase performance by avoiding regular checks for
the sample loop end).
|
|
Get the fine tuning value of this sample.
|
|
Get the length of the sample in bytes/samples.
|
|
Has this sample looped yet?
|
|
Get the length of the loop in bytes/samples.
|
|
Get the loop starting position in bytes/samples.
|
|
Noisetracker introduced an odd sample looping mode, when the sample loop start
is set to zero then the ENTIRE sample is played before the sample starts to loop
EVEN when the loop end is not set at the end of the sample (see Mike Clarkes
Last Ninja 2 loading tune and various 4-Mat chiptunes).
|
|
getSample(iOffset)
Get a sample value at a given offset.
|
|
Get an array containing the entire sample.
|
|
Get list of supported Scanner Modes, used for populating a drop down list for user selection.
|
|
invertSample(iOffset)
Invert a sample at a given offset.
|
|
isLooped()
Check to see if this sample is looped.
|
|
setLoopedYet(bLooped)
Set the first play of the sample, if the sample is a Loop Quirk.this flag
is used to indicate that the ENTIRE sample must play first before looping.
|
Class Detail
weasel.Sample(oInstrument, oModule, iSampleNumber, iSampleScannerMode)
The Sample object contains the raw sample data needed by the instrument.
Author: Warren Willmey 2011..
Author: Warren Willmey 2011..
- Parameters:
- {weasel.Instrument} oInstrument
- = The Instrument object this sample will be associated with,
- {weasel.UltimateSoundTracker121|weasel.UltimateSoundTracker18|weasel.DOCSoundTracker9|weasel.DOCSoundTracker22|weasel.TJCSoundTracker2|weasel.DefJamSoundTracker3|weasel.SpreadpointSoundTracker23|weasel.SpreadpointSoundTracker25|weasel.NoiseTracker11|weasel.NoiseTracker20|weasel.ProTrackerMK|weasel.FSTModule} oModule
- = The module containing the sample data.
- {int} iSampleNumber
- = The number of the sample that will be used/extracted.
- {weasel.Sample.prototype.SampleScannerMode} iSampleScannerMode
- = Scan for IFF Header corruption residue?.
Field Detail
BarrelLoopSize
The default size of a looped sample's barrel loop (used to increase the
performance [speed] of play a looped sample at the cost of memory). Does not
apply to non-looped samples.
SampleScannerMode
Different modes for dealing with scanning for IFF header corruption residue,
display names where '$' is converted to '-' and '_' becomes ' '.
Method Detail
{boolean}
corruptionCleaned()
Was sample data cleaned of IFF Headers, if any where found and
assuming the Scanner was active in the first place.
- Returns:
- {boolean} True if sample has been cleaned.
{int}
getBarrelLoopSize()
Get the size of the barrel loop attached to the end of the sample or the
end of loop (used to increase performance by avoiding regular checks for
the sample loop end).
- Returns:
- {int} The size of the barrel loop in samples.
{int}
getFineTuning()
Get the fine tuning value of this sample.
- Returns:
- {int} The fine tuning value [ 0-15 in two complement form e.g. 8-15 are the NEGATIVE VALUES!].
{int}
getLength()
Get the length of the sample in bytes/samples.
- Returns:
- {int} The length of the sample in bytes.
getLoopedYet()
Has this sample looped yet?
{int}
getLoopLength()
Get the length of the loop in bytes/samples.
- Returns:
- {int} Get the loop length in bytes/samples.
{int}
getLoopStart()
Get the loop starting position in bytes/samples.
- Returns:
- {int} The starting loop position offset in bytes.
{boolean}
getNoisetrackerLoopQuirkMode()
Noisetracker introduced an odd sample looping mode, when the sample loop start
is set to zero then the ENTIRE sample is played before the sample starts to loop
EVEN when the loop end is not set at the end of the sample (see Mike Clarkes
Last Ninja 2 loading tune and various 4-Mat chiptunes).
- Returns:
- {boolean} TRUE: this sample is affected by the Noisetracker Loop Quirk, FALSE : sample not affected.
{float}
getSample(iOffset)
Get a sample value at a given offset.
- Parameters:
- {int} iOffset
- = The offset into the sample to fetch, this value is currently not bound checked.
- Returns:
- {float} The sample at the requested offset, in the range of -1.0 to 1.0.
{Array|Float32Array}
getSampleArray()
Get an array containing the entire sample.
- Returns:
- {Array|Float32Array} The array containing the sample in floating point format ( -1.0 to 1.0 range).
{weasel.Sample.prototype.SampleScannerMode}
getSampleScannerModes()
Get list of supported Scanner Modes, used for populating a drop down list for user selection.
- Returns:
- {weasel.Sample.prototype.SampleScannerMode} = The list of supported Scanner Modes.
invertSample(iOffset)
Invert a sample at a given offset.
- Parameters:
- {int} iOffset
- = The offset into the sample to invert.
{boolean}
isLooped()
Check to see if this sample is looped.
- Returns:
- {boolean} True if sample is looped.
setLoopedYet(bLooped)
Set the first play of the sample, if the sample is a Loop Quirk.this flag
is used to indicate that the ENTIRE sample must play first before looping.
- Parameters:
- {boolean} bLooped
- = FALSE : sample has not looped yet, TRUE : sample has looped (played until the end of th sample in NT Loop Quirk mode).