class ATEM::Switcher::Input::Audio

Attributes

balance[R]
gain[R]
id[R]
input[R]
levels[RW]
media_player[R]
mix[R]
plug[R]
switcher[R]
type[R]

Public Class Methods

from(packet, switcher, input) click to toggle source
# File lib/atem/switcher/input/audio.rb, line 12
def self.from packet, switcher, input

        audio = self.new switcher, input
        audio.init_from packet
        audio

end
new(switcher, input) click to toggle source
# File lib/atem/switcher/input/audio.rb, line 20
def initialize switcher, input 

        @switcher = switcher
        @input = input
        @level = 0

end

Public Instance Methods

init_from(packet) click to toggle source
# File lib/atem/switcher/input/audio.rb, line 28
def init_from packet 

        @id, @type, @media_player, @plug, @mix, @gain, @balance =
                packet.unpack("S>CxxxCCCxS>s>")

        # Now we have the right data, we can name the input itself
        if @input.quick_init

                values = {
                        1001 => ['XLR', 'XLR0'],
                        1101 => ['AES/EBU', 'AES3'],
                        1201 => ['RCA', 'RCA_'],
                }
                @input.init @input.id, values[@input.id][0], values[@input.id][1]

        end

end
level() click to toggle source
# File lib/atem/switcher/input/audio.rb, line 49
def level
        (@levels[:left] + @levels[:right]) / 2
end