1 /**
  2  * This file is part of the Web Enabled Audio and Sound Enhancement Library (aka the Weasel audio library) Copyright 2011 - 2013 Warren Willmey. It is covered by the GNU General Public License version 3 as published by the Free Software Foundation, you should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
  3  */
  4 
  5 if( undefined == window.weasel ) window.weasel = {};
  6 
  7 // ---------------------------------------------------------------------------
  8 /** Create a Mnemotron, Mahoney & Kaktus Spreadpoint Soundtracker 2.5 module out of the provided data (which has already passed the module sniffer test).
  9  * Spreadpoint Soundtracker 2.5 is basically Mahoney & Kaktus rolling in all their changes
 10  * from Noisetracker 1.1 into Soundtracker along with extending the max sample size to 64K.
 11  * 
 12  * @constructor
 13  * @extends weasel.NoiseTracker11
 14  * 
 15  * @param {Array|Uint8Array} aModuleData = The Spreadpoint Soundtracker 2.5 module as a byte array that MUST have passed the module sniffer test.
 16  * @param {int} iPlaybackFrequency = The playback frequency in hertz to use (e.g. 44100 ).
 17  * @param {weasel.Sample.prototype.SampleScannerMode} iSampleScannerMode = Scan for IFF Header corruption residue?.
 18  * 
 19  * @author Warren Willmey 2013
 20  */
 21 weasel.SpreadpointSoundTracker25 = function( aModuleData, iPlaybackFrequency, iSampleScannerMode )
 22 {
 23 	this.parent = weasel.NoiseTracker11;
 24 
 25 	// Needed for prototype Inheritance.
 26 	//
 27 	if( aModuleData === undefined || !(( aModuleData instanceof Array ) || ( window.Uint8Array && aModuleData instanceof Uint8Array )) )
 28 		return;
 29 
 30 	this.parent( aModuleData, iPlaybackFrequency, iSampleScannerMode );
 31 
 32 
 33 	// Spreadpoint Soundtracker 2.5 did not include the Song Restart Position from Noisetracker 1.1.
 34 	//
 35 	this.iSongRestartSequence = 0;
 36 
 37 	// The BPM Speed technically exists, but is ignored.
 38 	//
 39 	this._extractSongSpeed();
 40 	// Spreadpoint Soundtracker 2.5 does not honour the BPM Speed setting and
 41 	// only plays back at 50Hz PAL.
 42 	//
 43 	this.timingOverride( this.TimingOverrides.PAL );
 44 
 45 	this.sModuleType = weasel.ModuleSniffer.prototype.SupportedModules.SpreadpointSoundTracker25;
 46 
 47 };
 48 
 49 weasel.SpreadpointSoundTracker25.prototype = new weasel.NoiseTracker11;
 50 
 51 
 52 // ---------------------------------------------------------------------------
 53 /** Sequence table tick speed reader, reads tick speed from pattern during .
 54  * 
 55  * @param {int} iEffectData = The effect data of the pattern cell.
 56  * 
 57  * @return {int} The Tick Speed.
 58  * 
 59  * @protected
 60  * @override
 61  */
 62 weasel.SpreadpointSoundTracker25.prototype._sequenceTableTickSpeedReader = function( iEffectData )
 63 {
 64 	return iEffectData & 0x1f;
 65 };
 66 
 67 
 68 // ---------------------------------------------------------------------------
 69 /** Set the row tick speed.
 70  * 
 71  * @param {int} iTickSpeed = The new row tick speed to use (0-31), a value of 0 is ignored.
 72  * 
 73  * @override
 74  */
 75 weasel.SpreadpointSoundTracker25.prototype.setTickSpeed = function( iTickSpeed )
 76 {
 77 	iTickSpeed &= 0x1f;
 78 
 79 	if( iTickSpeed <= 0 )
 80 		return;
 81 
 82 	this.iTickSpeed = iTickSpeed;
 83 };
 84