Add test case for Gxx

This commit is contained in:
Johan Hillerström 2015-11-14 13:04:43 +01:00
commit 88584b9cd0

22
test/effects.js vendored
View file

@ -152,3 +152,25 @@ exports['test 4xy vibrato'] = function(assert) {
assert.equal(p.toFixed(3), "-1.546", 'row 5 tick 1 period -1.546'); assert.equal(p.toFixed(3), "-1.546", 'row 5 tick 1 period -1.546');
}; };
exports['test Gxx global volume'] = function(assert) {
var xm = testdata.resetXMData();
// [pat][row][channel]
// 1 channel, 3 row blank pattern
xm.patterns = [
[
[[48, 1, -1, 16, 0x40]], // C-4 1 -- G40
[[48, 1, -1, 16, 0x2B]], // C-4 1 -- G2B
// test out of bounds volume
[[48, 1, -1, 16, 0x80]] // C-4 1 -- G80
]
];
XMPlayer.xm.tempo = 1;
XMPlayer.nextTick();
// volume gets multiplied by 2 to match
// the initial max global volume of 128
assert.equal(XMPlayer.xm.global_volume, 0x40*2, 'global volume set to 0x40');
XMPlayer.nextTick();
assert.equal(XMPlayer.xm.global_volume, 0x2B*2, 'global volume set to 0x2B');
XMPlayer.nextTick();
assert.equal(XMPlayer.xm.global_volume, 0x40*2, 'global volume set to 0x40');
};