Skip to content

Commit

Permalink
Merge pull request toyoshim#6 from aike/ml-command-support
Browse files Browse the repository at this point in the history
'ml' command support
  • Loading branch information
toyoshim committed Aug 31, 2016
2 parents 6022c78 + 9115a3c commit d630ddc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
14 changes: 11 additions & 3 deletions js/tss/TsdPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,8 @@ TsdPlayer.prototype._performSequencer = function () {
Log.getLog().info('TSD: key on phase');
// TODO
} else if (cmd == TsdPlayer.CMD_MULTIPLE) {
ch.offset++;
Log.getLog().info('TSD: multiple');
// TODO
dt = this.input[ch.baseOffset + ch.offset++];
this._setMultiple(ch, dt);
} else if (cmd == TsdPlayer.CMD_PITCH_MODULATION_DELAY) {
dt = this._readU16(ch.baseOffset + ch.offset);
ch.offset += 2;
Expand Down Expand Up @@ -941,6 +940,15 @@ TsdPlayer.prototype._setFmOutPipe = function (ch, mode, pipe) {
this.device.setModuleFmOutPipe(ch.id, mode, pipe);
};

/**
* Set frequency multiple
* @param ch channel object to control
* @param multiple frequency multiple
*/
TsdPlayer.prototype._setMultiple = function (ch, multiple) {
this.device.setModuleMultiple(ch.id, multiple);
};

/**
* Set MIDI device ID and channel.
* @param ch channel object to control
Expand Down
11 changes: 11 additions & 0 deletions js/tss/TssChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,17 @@ TssChannel.prototype.setModuleFrequency = function (id, frequency) {
this.module[id].frequency = frequency;
};

/**
* Set module multiple.
* @param id module id
* @param frequency multiple
* @throws RangeError module channel id is out of range of maxChannel
*/
TssChannel.prototype.setModuleMultiple = function (id, multiple) {
this._CheckId(id);
this.module[id].multiple = multiple;
};

/**
* Set module volume.
* @param id module id
Expand Down
15 changes: 11 additions & 4 deletions js/tss/TssCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,10 +1041,17 @@ TssCompiler.prototype._parseChannels = function () {
}
}
},
'm': { // multiple
sequence: "p",
args: [], // TODO
callback: notImplemented
'm': {
sequence: "lp",
},
'ml': { // multiple
args: [
{ def: 1, min: 1, max: 255 }
],
callback: function (self, work, command, args) {
work.data.push(TsdPlayer.CMD_MULTIPLE);
work.data.push(args[0]);
}
},
'mp': { // pitch modulation
args: [
Expand Down

0 comments on commit d630ddc

Please sign in to comment.