From 9312fa745d1f60729da34162314a9fb0e1b72069 Mon Sep 17 00:00:00 2001 From: Spencer Russell Date: Mon, 23 Jun 2014 18:48:01 -0400 Subject: [PATCH] ports AudioInput to new type structure --- src/nodes.jl | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/nodes.jl b/src/nodes.jl index 95607a7..d2158de 100644 --- a/src/nodes.jl +++ b/src/nodes.jl @@ -150,22 +150,19 @@ function play{T <: Unsigned}(arr::Array{T}, args...) play(arr, args...) end -##### AudioInput #### -# -## Renders incoming audio input from the hardware -# -#export AudioInput -#type AudioInput <: AudioNode -# active::Bool -# deactivate_cond::Condition -# channel::Int -# -# function AudioInput(channel::Int) -# new(false, Condition(), channel) -# end -#end -# -#function render(node::AudioInput, device_input::AudioBuf, info::DeviceInfo) -# @assert size(device_input, 1) == info.buf_size -# return device_input[:, node.channel], is_active(node) -#end +#### AudioInput #### + +# Renders incoming audio input from the hardware + +type InputRenderer <: AudioRenderer + channel::Int +end + +function render(node::InputRenderer, device_input::AudioBuf, info::DeviceInfo) + @assert size(device_input, 1) == info.buf_size + return device_input[:, node.channel] +end + +typealias AudioInput AudioNode{InputRenderer} +AudioInput(channel::Int) = AudioInput(InputRenderer(channel)) +export AudioInput