Example #1
0
test('it can deserialize a song', function(assert) {
  let song = Song.fromEncodedBase64(FIFTEEN_STEP_ENCODED_BASE_64_DATA);

  assert.equal(song.get('name'), '15 Step (Radiohead)');
  assert.equal(song.get('tempo'), 95);
  assert.equal(song.get('channels.length'), 4);

  let channel = song.get('channels.firstObject');
  assert.equal(channel.get('sound'), 'kick');
  assert.equal(channel.get('volume'), 1);
  assert.equal(channel.get('steps.length'), 10);

  let step = channel.get('steps.firstObject');
  assert.equal(step.get('velocity'), 1);
});
Example #2
0
test('setTick', function(assert) {
  let song = Song.fromEncodedBase64(FIFTEEN_STEP_ENCODED_BASE_64_DATA);

  song.setTick(1);

  assert.equal(song.get('channels.0.steps.0.isPlaying'), true);
  assert.equal(song.get('channels.0.steps.1.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.0.isPlaying'), true);
  assert.equal(song.get('channels.3.steps.1.isPlaying'), false);

  song.setTick(2);

  assert.equal(song.get('channels.0.steps.0.isPlaying'), false);
  assert.equal(song.get('channels.0.steps.1.isPlaying'), true);
  assert.equal(song.get('channels.3.steps.0.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.1.isPlaying'), true);

  song.setTick(10);

  assert.equal(song.get('channels.0.steps.0.isPlaying'), false);
  assert.equal(song.get('channels.0.steps.1.isPlaying'), false);
  assert.equal(song.get('channels.0.steps.9.isPlaying'), true);
  assert.equal(song.get('channels.3.steps.0.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.1.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.9.isPlaying'), true);

  song.setTick(11);

  assert.equal(song.get('channels.0.steps.0.isPlaying'), true);
  assert.equal(song.get('channels.0.steps.1.isPlaying'), false);
  assert.equal(song.get('channels.0.steps.9.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.0.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.1.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.9.isPlaying'), false);
  assert.equal(song.get('channels.3.steps.10.isPlaying'), true);
});
Example #3
0
test('it can serialize a song', function(assert) {
  let song = Song.fromEncodedBase64(FIFTEEN_STEP_ENCODED_BASE_64_DATA);

  assert.equal(song.toEncodedBase64(), FIFTEEN_STEP_ENCODED_BASE_64_DATA);
});