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 /** Object to contain a single cell of M.K. 31 instrument Soundtracker pattern 9 * data (4 cells per pattern row). Differs from a Ultimate Soundtracker pattern cell 10 * in that the note period is limited to 12 bits and the instrument number is 8 bits in size 11 * 12 * @constructor 13 * @param {int} iPatternCellData = The pattern cell data as a 32bit integer which takes the form innniedd, n = note, i = instrument number, e = effect number, d = effect data. 14 * 15 * @author Warren Willmey 2012 16 */ 17 weasel.MKPatternCell = function( iPatternCellData ){ 18 19 this.parent = weasel.PatternCell; 20 21 // Needed for prototype Inheritance. 22 // 23 if( undefined === iPatternCellData ) 24 return; 25 26 this.parent( iPatternCellData ); 27 28 }; 29 30 weasel.MKPatternCell.prototype = new weasel.PatternCell; 31 32 // --------------------------------------------------------------------------- 33 /** 34 * Set the pattern cell data for this M.K. 31 instrument Soundtracker cell. 35 * 36 * @param {int} iPatternCellData = In format of 0x12345678 where: 37 * , 0x1 = upper nibble of the instrument number, actually just uses bit 4 as max of 31 instruments 38 * 0x234 = note period value 39 * , 0x5 = lower nibble of the instrument number 40 * , 0x6 = effect number 41 * , 0x78 = effect parameter. 42 * 43 * @override 44 */ 45 weasel.MKPatternCell.prototype.setCell = function( iPatternCellData ) 46 { 47 this.iNotePeriod = (iPatternCellData >>> 16) & 0xfff; 48 this.iInstrumentNumber = ((iPatternCellData >>> 12) & 0xf) | ((iPatternCellData >>> 24) & 0x10); 49 this.iEffectNumber = (iPatternCellData >>> 8) & 0xf; 50 this.iEffectParameterValue = iPatternCellData & 0xff; 51 }; 52