Sha256: 27d01a09a01c1a4da5883584b2d3f5213654377d5643df657ff535c0c4389354

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe Synthdef do
  let(:synthdef_binary) { IO.read(File.expand_path("../data/recorder.scsyndef", __FILE__)) }
  let(:complex_synthdef_binary) { IO.read(File.expand_path("../data/hoover.scsyndef", __FILE__)) }

  it 'reads a basic version 1 synthdef' do
    parsed_synthdef = Synthdef.read(synthdef_binary).snapshot

    expect(parsed_synthdef).to be_a(Hash)
    expect(parsed_synthdef).not_to be_empty
    expect(parsed_synthdef[:synthdefs].first[:no_of_constants]).to eq(0)
    expect(parsed_synthdef[:synthdefs].first[:no_of_params]).to eq(2)
  end

  it 'reads a complex version 2 synthdef' do
    parsed_synthdef = Synthdef.read(complex_synthdef_binary).snapshot

    expect(parsed_synthdef).to be_a(Hash)
    expect(parsed_synthdef[:file_version]).to eq(2)
    expect(parsed_synthdef[:no_of_synthdefs]).to eq(1)
    expect(parsed_synthdef[:synthdefs].first[:no_of_constants]).to eq(32)
    expect(parsed_synthdef[:synthdefs].first[:constants].last).to eq(-4.0)
    expect(parsed_synthdef[:synthdefs].first[:no_of_params]).to eq(5)
    expect(parsed_synthdef[:synthdefs].first[:param_names].last).to eq({param_name: "gate", param_index: 4})
    expect(parsed_synthdef[:synthdefs].first[:no_of_ugens]).to eq(104)
    expect(parsed_synthdef[:synthdefs].first[:ugens].last[:ugen_name]).to eq("Out")
    expect(parsed_synthdef[:synthdefs].first[:no_of_variants]).to eq(0)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
synthdef-0.0.4 spec/synthdef_spec.rb
synthdef-0.0.3 spec/synthdef_spec.rb