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 Pattern Column, (4 columns per Pattern, one for each sound channel). 9 * @constructor 10 * 11 * @param {bool} bSoundtrackerCellType = Choose which Pattern Cell object to use: true = Ultimate Soundtracker 15 sample cell type, false = M.K. Spreadpoint Soundtracker 2.3+ 31 sample type. 12 * 13 * @author Warren Willmey 2011 14 */ 15 weasel.PatternColumn = function( bSoundtrackerCellType ) 16 { 17 this.aPatternRow = new Array( weasel.FormatUltimateSoundTracker121.NumberOfRowsPerPattern ); 18 19 if( true === bSoundtrackerCellType ) 20 { 21 for( var iRows = weasel.FormatUltimateSoundTracker121.NumberOfRowsPerPattern; --iRows >= 0; ) 22 this.aPatternRow[ iRows ] = new weasel.PatternCell( 0 ); 23 } 24 else 25 { 26 for( var iRows = weasel.FormatUltimateSoundTracker121.NumberOfRowsPerPattern; --iRows >= 0; ) 27 this.aPatternRow[ iRows ] = new weasel.MKPatternCell( 0 ); 28 } 29 }; 30 31 // --------------------------------------------------------------------------- 32 /** 33 * Get the PatternCell object from the Pattern Column. 34 * 35 * @param {int} iRowNumber = The row cell to fetch (0-63 range). 36 * 37 * @return {weasel.PatternCell} = The PatternCell object at the give row, or null if out of range. 38 * 39 */ 40 weasel.PatternColumn.prototype.getCell = function( iRowNumber ) 41 { 42 if( iRowNumber < 0 || iRowNumber >= weasel.FormatUltimateSoundTracker121.NumberOfRowsPerPattern ) 43 return null; 44 45 return this.aPatternRow[ iRowNumber ]; 46 };