adds tests for multiplying signals together

This commit is contained in:
Spencer Russell 2014-07-01 02:06:30 -04:00
parent 9c5c01aa7b
commit 6e6ca7d1fe

View file

@ -35,7 +35,7 @@ facts("Validating TestNode allocation") do
test = TestNode(test_info.buf_size)
# JIT
render(test, dev_input, test_info)
@fact (@allocated render(test, dev_input, test_info)) => lessthan(20)
@fact (@allocated render(test, dev_input, test_info)) => 16
end
#### AudioMixer Tests ####
@ -48,7 +48,7 @@ facts("AudioMixer") do
mix = AudioMixer()
render_output = render(mix, dev_input, test_info)
@fact render_output => AudioSample[]
@fact (@allocated render(mix, dev_input, test_info)) => lessthan(49)
@fact (@allocated render(mix, dev_input, test_info)) => 48
end
context("1 Input Mixer") do
@ -56,7 +56,7 @@ facts("AudioMixer") do
mix = AudioMixer([testnode])
render_output = render(mix, dev_input, test_info)
@fact render_output => AudioSample[1:test_info.buf_size]
@fact (@allocated render(mix, dev_input, test_info)) => lessthan(65)
@fact (@allocated render(mix, dev_input, test_info)) => 64
end
context("2 Input Mixer") do
@ -66,7 +66,7 @@ facts("AudioMixer") do
render_output = render(mix, dev_input, test_info)
# make sure the two inputs are being added together
@fact render_output => 2 * AudioSample[1:test_info.buf_size]
@fact (@allocated render(mix, dev_input, test_info)) => lessthan(97)
@fact (@allocated render(mix, dev_input, test_info)) => 96
# now we'll stop one of the inputs and make sure it gets removed
stop(test1)
render_output = render(mix, dev_input, test_info)
@ -96,7 +96,7 @@ facts("SinOSC") do
@fact mse(render_output,
test_vect[test_info.buf_size+1:2*test_info.buf_size]) =>
lessthan(MSE_THRESH)
@fact (@allocated render(osc, dev_input, test_info)) => lessthan(200)
@fact (@allocated render(osc, dev_input, test_info)) => 176
stop(osc)
render_output = render(osc, dev_input, test_info)
@fact render_output => AudioSample[]
@ -123,7 +123,7 @@ facts("SinOSC") do
expected[test_info.buf_size+1:2*test_info.buf_size]) =>
lessthan(MSE_THRESH)
# give a bigger budget here because we're rendering 2 nodes
@fact (@allocated render(osc, dev_input, test_info)) => lessthan(500)
@fact (@allocated render(osc, dev_input, test_info)) => 448
end
end
@ -135,7 +135,7 @@ facts("ArrayPlayer") do
@fact render_output => v[1:test_info.buf_size]
render_output = render(player, dev_input, test_info)
@fact render_output => v[(test_info.buf_size + 1) : (2*test_info.buf_size)]
@fact (@allocated render(player, dev_input, test_info)) => lessthan(200)
@fact (@allocated render(player, dev_input, test_info)) => 192
stop(player)
render_output = render(player, dev_input, test_info)
@fact render_output => AudioSample[]
@ -152,9 +152,18 @@ facts("ArrayPlayer") do
end
facts("Gain") do
context("Constant Gain") do
gained = TestNode(test_info.buf_size) * 0.75
render_output = render(gained, dev_input, test_info)
@fact render_output => 0.75 * AudioSample[1:test_info.buf_size]
@fact (@allocated render(gained, dev_input, test_info)) => 32
end
context("Gain by a Signal") do
gained = TestNode(test_info.buf_size) * TestNode(test_info.buf_size)
render_output = render(gained, dev_input, test_info)
@fact render_output => AudioSample[1:test_info.buf_size] .* AudioSample[1:test_info.buf_size]
@fact (@allocated render(gained, dev_input, test_info)) => 48
end
end
facts("LinRamp") do
@ -167,7 +176,7 @@ facts("LinRamp") do
@fact mse(render_output,
expected[(test_info.buf_size+1):(2*test_info.buf_size)]) =>
lessthan(MSE_THRESH)
@fact (@allocated render(ramp, dev_input, test_info)) => lessthan(300)
@fact (@allocated render(ramp, dev_input, test_info)) => 256
end
end # module TestAudioIONodes