# LOG FILE SETTINGS
set("log.file.path", "./<script>.log")

# SERVER SETTINGS
set("server.telnet", true)
set("server.telnet.bind_addr", "0.0.0.0")
set("server.telnet.port", 1234)

set("server.socket", true)
set("server.socket.path", "./<script>.sock")

# SOUND CARD SETTINGS
input_device_0 = list.assoc("input_device[0]", ini)
#input_device_1 = list.assoc("input_device[1]", ini)
#input_device_2 = list.assoc("input_device[2]", ini)
output_device_0 = list.assoc("output_device[0]", ini)

ignore(input_device_0)
ignore(output_device_0)

# ALSA / pulse settings
use_alsa           = list.assoc("use_alsa", ini) == "y"
frame_duration     = float_of_string(list.assoc("frame_duration", ini))
frame_size         = int_of_string(list.assoc("frame_size", ini))
alsa_buffer        = int_of_string(list.assoc("alsa_buffer", ini))
alsa_buffer_length = int_of_string(list.assoc("alsa_buffer_length", ini))
alsa_periods       = int_of_string(list.assoc("alsa_periods", ini))

if use_alsa then
    if frame_duration > 0.0 then
        print("setting frame.duration to #{frame_duration}")
        set("frame.duration", frame_duration)
    end
    if frame_size > 0 then
        print("setting frame.size to #{frame_size}")
        set("frame.size", frame_size)
    end
    if alsa_buffer > 0 then
        print("setting alsa.buffer to #{alsa_buffer}")
        set("alsa.alsa_buffer", alsa_buffer)
    end
    if alsa_buffer > 0 then
        print("setting alsa.buffer_length to #{alsa_buffer_length}")
        set("alsa.buffer_length", alsa_buffer_length)
    end
    if alsa_periods > 0 then
        print("setting alsa.periods to #{alsa_periods}")
        set("alsa.periods", alsa_periods) # assertion error when setting periods other than 0 => alsa default
    end
end