Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • aura/engine
  • hermannschwaerzler/engine
  • sumpfralle/aura-engine
3 results
Show changes
Showing
with 1354 additions and 0 deletions
#!/usr/bin/liquidsoap
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
icecast_vorbis_metadata = false
inputs = ref []
# load settings from ini file
%include "settings.liq"
# include some functions
%include "library.liq"
# include fallback functions
%include "fallback.liq"
#################
# create inputs #
#################
# enable play from filesystem
%include "in_filesystem.liq"
# enable stream overtakes
%include "in_stream.liq"
# enabled line in from soundcard
%include "in_soundcard.liq"
# fill the mixer
mixer = mix(id="input_mixer", list.append([input_fs, input_http], !inputs))
# output source with fallbacks
stripped_stream = strip_blank(id="strip_blank", track_sensitive=false, max_blank=fallback_max_blank, min_noise=fallback_min_noise, threshold=fallback_threshold, mixer)
# enable fallback
output_source = fallback(id="output_source", track_sensitive=false, [stripped_stream, timeslot_fallback, show_fallback, mksafe(station_fallback)])
##################
# create outputs #
##################
# create soundcard output
%include "out_soundcard.liq"
# recording output
%include "out_filesystem.liq"
# stream output
%include "out_stream.liq"
# enable socket functions
%include "serverfunctions.liq"
########################
# start initialization #
########################
system('#{list.assoc("install_dir", ini)}/guru.py --init-player --quiet')
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
# Custom crossfade to deal with jingles.
def smart_crossfade (~start_next=5.,~fade_in=3.,~fade_out=3.,
~default=(fun (a,b) -> sequence([a, b])),
~high=-15., ~medium=-32., ~margin=4.,
~width=2.,~conservative=false,s)
fade.out = fade.out(type="sin",duration=fade_out)
fade.in = fade.in(type="sin",duration=fade_in)
add = fun (a,b) -> add(normalize=false,[b, a])
log = log(label="smart_crossfade")
def transition(a,b,ma,mb,sa,sb)
list.iter(fun(x)-> log(level=4,"Before: #{x}"),ma)
list.iter(fun(x)-> log(level=4,"After : #{x}"),mb)
if ma["type"] == "jingles" or mb["type"] == "jingles" then
log("Old or new file is a jingle: sequenced transition.")
sequence([sa, sb])
elsif
# If A and B are not too loud and close, fully cross-fade them.
a <= medium and b <= medium and abs(a - b) <= margin
then
log("Old <= medium, new <= medium and |old-new| <= margin.")
log("Old and new source are not too loud and close.")
log("Transition: crossed, fade-in, fade-out.")
add(fade.out(sa),fade.in(sb))
elsif
# If B is significantly louder than A, only fade-out A.
# We don't want to fade almost silent things, ask for >medium.
b >= a + margin and a >= medium and b <= high
then
log("new >= old + margin, old >= medium and new <= high.")
log("New source is significantly louder than old one.")
log("Transition: crossed, fade-out.")
add(fade.out(sa),sb)
elsif
# Opposite as the previous one.
a >= b + margin and b >= medium and a <= high
then
log("old >= new + margin, new >= medium and old <= high")
log("Old source is significantly louder than new one.")
log("Transition: crossed, fade-in.")
add(sa,fade.in(sb))
elsif
# Do not fade if it's already very low.
b >= a + margin and a <= medium and b <= high
then
log("new >= old + margin, old <= medium and new <= high.")
log("Do not fade if it's already very low.")
log("Transition: crossed, no fade.")
add(sa,sb)
# What to do with a loud end and a quiet beginning ?
# A good idea is to use a jingle to separate the two tracks,
# but that's another story.
else
# Otherwise, A and B are just too loud to overlap nicely,
# or the difference between them is too large and overlapping would
# completely mask one of them.
log("No transition: using default.")
default(sa, sb)
end
end
smart_cross(width=width, duration=start_next, conservative=conservative, transition, s)
end
# create a pool
def fallback_create(~skip=true, name, requestor)
log("Creating channel #{name}")
# Create the request.dynamic source
# Set conservative to true to queue several songs in advance
#source = request.dynamic(conservative=true, length=50., id="pool_"^name, requestor, timeout=60.)
source = request.dynamic(length=50., id="pool_"^name, requestor, timeout=60.)
# Apply normalization using replaygain information
source = amplify(1., override="replay_gain", source)
# Skip blank when asked to
source =
if skip then
skip_blank(max_blank=fallback_max_blank, min_noise=fallback_min_noise, threshold=fallback_threshold, source)
else
source
end
# Tell the system when a new track
# is played
source = on_metadata(fun (meta) ->
# log("ON_METADATA_DISABLED"),
system('#{list.assoc("install_dir", ini)}/guru.py --adapt-trackservice name'),
source)
log("channel created")
# Finally apply a smart crossfading
smart_crossfade(source)
end
def create_dynamic_playlist(next)
request.create(list.hd(next))
end
def create_playlist() =
log("requesting next song for PLAYLIST")
result = get_process_lines('#{list.assoc("install_dir", ini)}/guru.py --get-next-file-for "playlist" --quiet')
create_dynamic_playlist(result)
end
def create_station_fallback() =
result = get_process_lines('#{list.assoc("install_dir", ini)}/guru.py --get-next-file-for station --quiet')
log("next song for STATION fallback is: #{result}")
create_dynamic_playlist(result)
end
def create_show_fallback() =
result = get_process_lines('#{list.assoc("install_dir", ini)}/guru.py --get-next-file-for show --quiet')
log("next song for SHOW fallback is: #{result}")
create_dynamic_playlist(result)
end
def create_timeslot_fallback() =
result = get_process_lines('#{list.assoc("install_dir", ini)}/guru.py --get-next-file-for timeslot --quiet')
log("next song for TIMESLOT fallback is: #{result}")
create_dynamic_playlist(result)
end
# create fallbacks
timeslot_fallback = fallback_create(skip=true, "timeslot_fallback", create_timeslot_fallback)
station_fallback = fallback_create(skip=true, "station_fallback", create_station_fallback)
show_fallback = fallback_create(skip=true, "show_fallback", create_show_fallback)
\ No newline at end of file
__author__ = 'michel'
import os
import sys
#!/bin/bash
pack_int(){ printf "%08X\n" $1 | sed 's/\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)/\\\\\\x\4\\\\\\x\3\\\\\\x\2\\\\\\x\1/I' | xargs printf; }
pack_short(){ printf "%04X\n" $1 | sed 's/\([0-9A-F]\{2\}\)\([0-9A-F]\{2\}\)/\\\\\\x\2\\\\\\x\1/I' | xargs printf; }
duration=1800
if [[ $# -eq 1 ]]; then
duration=$1
fi
channels=2
bps=16
sample=44100
Subchunk1Size=18
Subchunk2Size=$(echo "$duration*$sample*$channels*$bps/8" | bc)
ChunkSize=$((20 + $Subchunk1Size + $Subchunk2Size))
echo -n RIFF
pack_int $ChunkSize
echo -n "WAVEfmt "
pack_int $Subchunk1Size
pack_short 1
pack_short $channels
pack_int $sample
pack_int $((bps/8 * channels * sample))
pack_short $((bps/8 * channels))
pack_short $bps
pack_short 0
echo -n data
pack_int $Subchunk2Size
dd if=/dev/zero bs=1 count=$Subchunk2Size 2>/dev/null
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
# a hard one
input_fs = request.equeue(id="input_fs")
\ No newline at end of file
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
if a0_in != "" then
# we can ignore the result, since it is stored in the list 'inputs'
set_input(a0_in, "input_linein_0")
end
if a1_in != "" then
ignore(set_input(a1_in, "input_linein_1"))
end
if a2_in != "" then
ignore(set_input(a2_in, "input_linein_2"))
end
if a3_in != "" then
ignore(set_input(a3_in, "input_linein_3"))
end
if a4_in != "" then
ignore(set_input(a4_in, "input_linein_4"))
# input_4 = ref output.dummy(blank())
# set_input(input_4, a4_in, "aura_linein_4")
# inputs := list.append([!input_4], !inputs)
end
\ No newline at end of file
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
# this is overwritten as soon as a streamovertake is programmed, but liquidsoap needs it to initialize this input
#starturl = "http://stream.fro.at/fro-128.ogg"
#starturl = "http://trance.out.airtime.pro:8000/trance_a"
starturl = "http://chill.out.airtime.pro:8000/chill_a"
input_http = input.http(id="input_stream", starturl)
\ No newline at end of file
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
#####################
# stream to icecast #
#####################
def stream_to_icecast(id, encoding, bitrate, host, port, pass, mount_point, url, description, genre, user, stream, streamnumber, connected, name, channels) =
source = ref stream
def on_error(msg)
connected := "false"
log(msg)
5.
end
def on_connect()
connected := "true"
log("Successfully connected to stream_#{streamnumber}")
end
stereo = (int_of_string(channels) >= 2)
user_ref = ref user
if user == "" then
user_ref := "source"
end
# dumbass liquidsoap cannot handle one output definition for mono and stereo
output_icecast_mono = output.icecast(id = id, host = host, port = port, password = pass, mount = mount_point, fallible = true, url = url, description = description, name = name, genre = genre, user = !user_ref, on_error = on_error, on_connect = on_connect)
output_icecast_stereo = output.icecast(id = id, host = host, port = port, password = pass, mount = mount_point, fallible = true, url = url, description = description, name = name, genre = genre, user = !user_ref, on_error = on_error, on_connect = on_connect)
%ifencoder %aac
if encoding == "aac" then
log("ENABLING AAC to ICECAST")
%include "outgoing_streams/aac.liq"
end
%endif
%ifencoder %flac
if encoding == "flac" then
log("ENABLING FLAC to ICECAST")
%include "outgoing_streams/flac.liq"
end
%endif
if encoding == "mp3" then
log("ENABLING Mp3 to ICECAST")
%include "outgoing_streams/mp3.liq"
end
if encoding == "ogg" then
log("ENABLING OGG to ICECAST")
%include "outgoing_streams/ogg.liq"
end
%ifencoder %opus
if encoding == "opus" then
log("ENABLING OPUS to ICECAST")
%include "outgoing_streams/opus.liq"
end
%endif
end
###########
# line in #
###########
def set_input(device, name) =
if use_alsa == true then
alsa_in = input.alsa(id=name, device=a0_in, clock_safe=false, bufferize = false)
inputs := list.append([alsa_in], !inputs)
elsif use_jack == true then
jack_in = input.jack(id=name, clock_safe=false)
inputs := list.append([jack_in], !inputs)
else
pulse_in = input.pulseaudio(id=name, client="AuraEngine Line IN")
inputs := list.append([pulse_in], !inputs)
end
end
############
# line out #
############
def get_output(source, device, name) =
if device != "" then
if use_alsa == true then
output.alsa(id=name, device=device, bufferize = false, source)
elsif use_jack == true then
output.jack(id=name, source)
else
output.pulseaudio(id=name, client="AuraEngine Line OUT", source)
end
else
log("OUTPUT DUMMY")
output.dummy(id=name^"_DUMMY", blank())
end
end
########################
# record to filesystem #
########################
# shows current file and how many bytes were written so far
def currecording(recfile)
if recfile != "" then
bytes_written = list.hd(get_process_lines("echo $(($(stat -c%s "^recfile^")))"))
"#{recfile}, #{bytes_written}B"
else
""
end
end
def start_recorder(name, folder, duration, encoding, bitrate, channels, filenamepattern, is_recording, stream) =
source = ref stream
stereo = (int_of_string(channels) >= 2)
# define on_start, on_close (good case) and on_stop (error case)
recfile = ref ''
def on_start()
is_recording := true
recfile := list.hd(get_process_lines("date +#{filenamepattern}"))
end
def on_close(filename)
is_recording := false
recfile := list.hd(get_process_lines("date +#{filenamepattern}"))
end
def on_stop()
is_recording := false
end
# register server function
server.register(namespace=name, description="Show current file.", usage="curfile", "curfile", fun (s) -> currecording(!recfile) )
# dumbass liquidsoap cannot handle one output definition for mono and stereo
output_filesystem_mono = output.file(id=name, perm = 0o664, on_start=on_start, on_close=on_close, on_stop=on_stop, reopen_when={ int_of_float(gettimeofday()/60.) mod duration == 0 })
output_filesystem_stereo = output.file(id=name, perm = 0o664, on_start=on_start, on_close=on_close, on_stop=on_stop, reopen_when={ int_of_float(gettimeofday()/60.) mod duration == 0 })
%ifencoder %aac
if encoding == "aac" then
log("ENABLING aac recorder to filesystem")
%include "outgoing_recordings/aac.liq"
end
%endif
%ifencoder %flac
if encoding == "flac" then
log("ENABLING flac recorder to filesystem")
%include "outgoing_recordings/flac.liq"
end
%endif
%ifencoder %mp3
if encoding == "mp3" then
log("ENABLING mp3 recorder to filesystem")
%include "outgoing_recordings/mp3.liq"
end
%endif
%ifencoder %vorbis
if encoding == "ogg" then
log("ENABLING ogg recorder to filesystem")
%include "outgoing_recordings/ogg.liq"
end
%endif
%ifencoder %opus
if encoding == "opus" then
log("ENABLING opus recorder to filesystem")
%include "outgoing_recordings/opus.liq"
end
%endif
%ifencoder %wav
if encoding == "wav" then
log("ENABLING wav recorder to filesystem")
%include "outgoing_recordings/wav.liq"
end
%endif
end
set("log.file.path", "./<script>.log")
#%include "readini.liq"
#ini = read_ini("/etc/aura/engine.ini")
# output_source = mksafe(blank())
# %include "stream.liq"
# stream = get_stream(0)
# output_stream = input.external("arecord -f S16_LE -c2 -r44100 -t raw -D dsnoop:1,0 -")
output.icecast(
%vorbis(quality = 0.5),
mount="aura-test.ogg",
host="develop.servus.at",
port=8000,
name="LQSTest",
user="source",
password="A7E7tst1",
fallible=true,
input.alsa(device="pcm.plugj")
)
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
r0_enable = list.assoc("rec_0", ini) == "y"
r1_enable = list.assoc("rec_1", ini) == "y"
r2_enable = list.assoc("rec_2", ini) == "y"
r3_enable = list.assoc("rec_3", ini) == "y"
r4_enable = list.assoc("rec_4", ini) == "y"
r0_folder = list.assoc("rec_0_folder", ini)
r0_duration = int_of_string(list.assoc("rec_0_duration", ini))
r0_encoding = list.assoc("rec_0_encoding", ini)
r0_bitrate = int_of_string(list.assoc("rec_0_bitrate", ini))
r0_channels = list.assoc("rec_0_channels", ini)
r0_filenamepattern = r0_folder^"/%Y-%m-%d/%Y-%m-%d-%H-%M."^r0_encoding
r1_folder = list.assoc("rec_1_folder", ini)
r1_duration = int_of_string(list.assoc("rec_1_duration", ini))
r1_encoding = list.assoc("rec_1_encoding", ini)
r1_bitrate = int_of_string(list.assoc("rec_1_bitrate", ini))
r1_channels = list.assoc("rec_1_channels", ini)
r1_filenamepattern = r1_folder^"/%Y-%m-%d/%Y-%m-%d-%H-%M."^r1_encoding
r2_folder = list.assoc("rec_2_folder", ini)
r2_duration = int_of_string(list.assoc("rec_2_duration", ini))
r2_encoding = list.assoc("rec_2_encoding", ini)
r2_bitrate = int_of_string(list.assoc("rec_2_bitrate", ini))
r2_channels = list.assoc("rec_2_channels", ini)
r2_filenamepattern = r2_folder^"/%Y-%m-%d/%Y-%m-%d-%H-%M."^r2_encoding
r3_folder = list.assoc("rec_3_folder", ini)
r3_duration = int_of_string(list.assoc("rec_3_duration", ini))
r3_encoding = list.assoc("rec_3_encoding", ini)
r3_bitrate = int_of_string(list.assoc("rec_3_bitrate", ini))
r3_channels = list.assoc("rec_3_channels", ini)
r3_filenamepattern = r3_folder^"/%Y-%m-%d/%Y-%m-%d-%H-%M."^r3_encoding
r4_folder = list.assoc("rec_4_folder", ini)
r4_duration = int_of_string(list.assoc("rec_4_duration", ini))
r4_encoding = list.assoc("rec_4_encoding", ini)
r4_bitrate = int_of_string(list.assoc("rec_4_bitrate", ini))
r4_channels = list.assoc("rec_4_channels", ini)
r4_filenamepattern = r4_folder^"/%Y-%m-%d/%Y-%m-%d-%H-%M."^r4_encoding
r0_is_recording = ref false
r1_is_recording = ref false
r2_is_recording = ref false
r3_is_recording = ref false
r4_is_recording = ref false
if r0_enable == true then
# enable recording status for that recorder
server.register(namespace="output_recorder_0", "recording", fun (s) -> begin if !r0_is_recording == false then "false" else "true" end end)
# start the recorder
start_recorder("output_recorder_0", r0_folder, r0_duration, r0_encoding, r0_bitrate, r0_channels, r0_filenamepattern, r0_is_recording, output_source)
end
if r1_enable == true then
server.register(namespace="output_recorder_1", "recording", fun (s) -> begin if !r1_is_recording == false then "false" else "true" end end)
start_recorder("output_recorder_1", r1_folder, r1_duration, r1_encoding, r1_bitrate, r1_channels, r1_filenamepattern, r1_is_recording, output_source)
end
if r2_enable == true then
server.register(namespace="output_recorder_2", "recording", fun (s) -> begin if !r2_is_recording == false then "false" else "true" end end)
start_recorder("output_recorder_2", r2_folder, r2_duration, r2_encoding, r2_bitrate, r2_channels, r2_filenamepattern, r2_is_recording, output_source)
end
if r3_enable == true then
server.register(namespace="output_recorder_3", "recording", fun (s) -> begin if !r3_is_recording == false then "false" else "true" end end)
start_recorder("output_recorder_3", r3_folder, r3_duration, r3_encoding, r3_bitrate, r3_channels, r3_filenamepattern, r3_is_recording, output_source)
end
if r4_enable == true then
server.register(namespace="output_recorder_4", "recording", fun (s) -> begin if !r4_is_recording == false then "false" else "true" end end)
start_recorder("output_recorder_4", r4_folder, r4_duration, r4_encoding, r4_bitrate, r4_channels, r4_filenamepattern, r4_is_recording, output_source)
end
\ No newline at end of file
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
if a0_out != "" then
ignore(get_output(output_source, a0_out, "output_lineout_0"))
end
if a1_out != "" then
ignore(get_output(output_source, a1_out, "output_lineout_1"))
end
if a2_out != "" then
ignore(get_output(output_source, a2_out, "output_lineout_2"))
end
if a3_out != "" then
ignore(get_output(output_source, a3_out, "output_lineout_3"))
end
if a4_out != "" then
ignore(get_output(output_source, a4_out, "output_lineout_4"))
#output_4 = ref output.dummy(blank())
#get_output(output_4, output_source, a4_out, "aura_lineout_4")
#output_4 := get_output(output_source, a4_out, "aura_lineout_4")
#get_output(output_source, a4_out, "aura_lineout_4")
end
#
# engine
#
# Playout Daemon for autoradio project
#
#
# Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
#
# This file is part of engine.
#
# engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine. If not, see <http://www.gnu.org/licenses/>.
#
# Output streaming settings
# What a mess...
s0_enable = list.assoc("stream_0", ini) == "y"
s1_enable = list.assoc("stream_1", ini) == "y"
s2_enable = list.assoc("stream_2", ini) == "y"
s3_enable = list.assoc("stream_3", ini) == "y"
s4_enable = list.assoc("stream_4", ini) == "y"
s0_encoding = list.assoc("stream_0_encoding", ini)
s0_bitrate = int_of_string(list.assoc("stream_0_bitrate", ini))
s0_host = list.assoc("stream_0_host", ini)
s0_port = int_of_string(list.assoc("stream_0_port", ini))
s0_user = list.assoc("stream_0_user", ini)
s0_pass = list.assoc("stream_0_password", ini)
s0_mount = list.assoc("stream_0_mountpoint", ini)
s0_url = list.assoc("stream_0_displayurl", ini)
s0_desc = list.assoc("stream_0_description", ini)
s0_genre = list.assoc("stream_0_genre", ini)
s0_name = list.assoc("stream_0_name", ini)
s0_channels = list.assoc("stream_0_channels", ini)
s1_encoding = list.assoc("stream_1_encoding", ini)
s1_bitrate = int_of_string(list.assoc("stream_1_bitrate", ini))
s1_host = list.assoc("stream_1_host", ini)
s1_port = int_of_string(list.assoc("stream_1_port", ini))
s1_user = list.assoc("stream_1_user", ini)
s1_pass = list.assoc("stream_1_password", ini)
s1_mount = list.assoc("stream_1_mountpoint", ini)
s1_url = list.assoc("stream_1_displayurl", ini)
s1_desc = list.assoc("stream_1_description", ini)
s1_genre = list.assoc("stream_1_genre", ini)
s1_name = list.assoc("stream_1_name", ini)
s1_channels = list.assoc("stream_1_channels", ini)
s2_encoding = list.assoc("stream_2_encoding", ini)
s2_bitrate = int_of_string(list.assoc("stream_2_bitrate", ini))
s2_host = list.assoc("stream_2_host", ini)
s2_port = int_of_string(list.assoc("stream_2_port", ini))
s2_user = list.assoc("stream_2_user", ini)
s2_pass = list.assoc("stream_2_password", ini)
s2_mount = list.assoc("stream_2_mountpoint", ini)
s2_url = list.assoc("stream_2_displayurl", ini)
s2_desc = list.assoc("stream_2_description", ini)
s2_genre = list.assoc("stream_2_genre", ini)
s2_name = list.assoc("stream_2_name", ini)
s2_channels = list.assoc("stream_2_channels", ini)
s3_encoding = list.assoc("stream_3_encoding", ini)
s3_bitrate = int_of_string(list.assoc("stream_3_bitrate", ini))
s3_host = list.assoc("stream_3_host", ini)
s3_port = int_of_string(list.assoc("stream_3_port", ini))
s3_user = list.assoc("stream_3_user", ini)
s3_pass = list.assoc("stream_3_password", ini)
s3_mount = list.assoc("stream_3_mountpoint", ini)
s3_url = list.assoc("stream_3_displayurl", ini)
s3_desc = list.assoc("stream_3_description", ini)
s3_genre = list.assoc("stream_3_genre", ini)
s3_name = list.assoc("stream_3_name", ini)
s3_channels = list.assoc("stream_3_channels", ini)
s4_encoding = list.assoc("stream_4_encoding", ini)
s4_bitrate = int_of_string(list.assoc("stream_4_bitrate", ini))
s4_host = list.assoc("stream_4_host", ini)
s4_port = int_of_string(list.assoc("stream_4_port", ini))
s4_user = list.assoc("stream_4_user", ini)
s4_pass = list.assoc("stream_4_password", ini)
s4_mount = list.assoc("stream_4_mountpoint", ini)
s4_url = list.assoc("stream_4_displayurl", ini)
s4_desc = list.assoc("stream_4_description", ini)
s4_genre = list.assoc("stream_4_genre", ini)
s4_name = list.assoc("stream_4_name", ini)
s4_channels = list.assoc("stream_4_channels", ini)
s0_connected = ref ''
s1_connected = ref ''
s2_connected = ref ''
s3_connected = ref ''
s4_connected = ref ''
b = interactive.bool("enable_stream", true)
if s0_enable == true then
# enable connection status for that stream
server.register(namespace="output_stream_0", "connected", fun (_) -> begin !s0_connected end)
# aaand stream
stream_to_icecast("output_stream_0", s0_encoding, s0_bitrate, s0_host, s0_port, s0_pass, s0_mount, s0_url, s0_desc, s0_genre, s0_user, output_source, "0", s0_connected, s0_name, s0_channels)
end
if s1_enable == true then
server.register(namespace="output_stream_1", "connected", fun (_) -> begin !s1_connected end)
stream_to_icecast("output_stream_1", s1_encoding, s1_bitrate, s1_host, s1_port, s1_pass, s1_mount, s1_url, s1_desc, s1_genre, s1_user, output_source, "1", s1_connected, s1_name, s1_channels)
end
if s2_enable == true then
server.register(namespace="output_stream_2", "connected", fun (_) -> begin !s2_connected end)
stream_to_icecast("output_stream_2", s2_encoding, s2_bitrate, s2_host, s2_port, s2_pass, s2_mount, s2_url, s2_desc, s2_genre, s2_user, output_source, "2", s2_connected, s2_name, s2_channels)
end
if s3_enable == true then
server.register(namespace="output_stream_3", "connected", fun (_) -> begin !s3_connected end)
stream_to_icecast("output_stream_3", s3_encoding, s3_bitrate, s3_host, s3_port, s3_pass, s3_mount, s3_url, s3_desc, s3_genre, s3_user, output_source, "3", s3_connected, s3_name, s3_channels)
end
if s4_enable == true then
server.register(namespace="output_stream_4", "connected", fun (_) -> begin !s4_connected end)
stream_to_icecast("output_stream_4", s4_encoding, s4_bitrate, s4_host, s4_port, s4_pass, s4_mount, s4_url, s4_desc, s4_genre, s4_user, output_source, "4", s4_connected, s4_name, s4_channels)
end
if bitrate == 24 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 24, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 24, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 32 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 32, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 32, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 48 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 48, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 48, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 64, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 64, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 96, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 96, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 128, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 128, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 160, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 160, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 192, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 192, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 224, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 224, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 256, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 256, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_filesystem_stereo(%aac(bitrate = 320, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%aac(bitrate = 320, channels = 1), filenamepattern, mean(!source)))
end
end
if bitrate == 24 or bitrate == 32 or bitrate == 48 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 7, bits_per_sample=8), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 7, bits_per_sample=8), filenamepattern, mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 7, bits_per_sample=8), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 7, bits_per_sample=8), filenamepattern, mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 7, bits_per_sample=8), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 7, bits_per_sample=8), filenamepattern, mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 6, bits_per_sample=16), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 6, bits_per_sample=16), filenamepattern, mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 5, bits_per_sample=16), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 5, bits_per_sample=16), filenamepattern, mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 4, bits_per_sample=16), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 4, bits_per_sample=16), filenamepattern, mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 3, bits_per_sample=32), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 3, bits_per_sample=32), filenamepattern, mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 2, bits_per_sample=32), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 2, bits_per_sample=32), filenamepattern, mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_filesystem_stereo(%flac(samplerate=44100, channels = 2, compression = 1, bits_per_sample=32), filenamepattern, !source))
else
ignore(output_filesystem_mono(%flac(samplerate=44100, channels = 1, compression = 1, bits_per_sample=32), filenamepattern, mean(!source)))
end
end
if bitrate == 24 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 24, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 24, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 32 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 32, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 32, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 48 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 48, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 48, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 64, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 64, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 96, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 96, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 128, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 128, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 160, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 160, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 192, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 192, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 224, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 224, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 256, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 256, stereo = false), filenamepattern, mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_filesystem_stereo(%mp3(bitrate = 320, stereo = true), filenamepattern, !source))
else
ignore(output_filesystem_mono(%mp3(bitrate = 320, stereo = false), filenamepattern, mean(!source)))
end
end
if bitrate == 24 or bitrate == 32 or bitrate == 48 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=-0.1, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=-0.1, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.2, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.2, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.4, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.4, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.5, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.5, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.6, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.6, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.7, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.7, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.8, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.8, channels = 1), filenamepattern, mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_filesystem_stereo(%vorbis(quality=0.9, channels = 2), filenamepattern, !source))
else
ignore(output_filesystem_mono(%vorbis(quality=0.9, channels = 1), filenamepattern, mean(!source)))
end
end
if bitrate == 24 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 24, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 24, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 32 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 32, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 32, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 48 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 48, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 48, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 64, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 64, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 96, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 96, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 128, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 128, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 160, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 160, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 192, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 192, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 224, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 224, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 256, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 256, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_filesystem_stereo(%opus(bitrate = 320, channels = 2, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, !source))
else
ignore(output_filesystem_mono(%opus(bitrate = 320, channels = 1, signal="music", application="audio", complexity=10, vbr="constrained"), filenamepattern, mean(!source)))
end
end
if bitrate <= 128 then
if stereo then
ignore(output_filesystem_stereo(%wav(stereo=true, channels=2, samplesize=8, header=true, duration=30.), filenamepattern, !source))
else
ignore(output_filesystem_mono(%wav(stereo=false, channels=1, samplesize=8, header=true, duration=30.), filenamepattern, mean(!source)))
end
else
if stereo then
ignore(output_filesystem_stereo(%wav(stereo=true, channels=2, samplesize=16, header=true, duration=30.), filenamepattern, !source))
else
ignore(output_filesystem_mono(%wav(stereo=false, channels=1, samplesize=16, header=true, duration=30.), filenamepattern, mean(!source)))
end
end
\ No newline at end of file
if bitrate == 24 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 24, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 24, channels = 1), mean(!source)))
end
elsif bitrate == 32 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 32, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 32, channels = 1), mean(!source)))
end
elsif bitrate == 48 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 48, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 48, channels = 1), mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 64, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 64, channels = 1), mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 96, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 96, channels = 1), mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 128, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 128, channels = 1), mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 160, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 160, channels = 1), mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 192, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 192, channels = 1), mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 224, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 224, channels = 1), mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 256, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 256, channels = 1), mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_icecast_stereo(%aac(bitrate = 320, channels = 2), !source))
else
ignore(output_icecast_mono(%aac(bitrate = 320, channels = 1), mean(!source)))
end
end
if not icecast_vorbis_metadata then
source := add(normalize=false, [amplify(0.00001, noise()), !source])
end
if bitrate == 24 or bitrate == 32 or bitrate == 48 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 7, bits_per_sample=8), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 7, bits_per_sample=8), mean(!source)))
end
elsif bitrate == 64 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 7, bits_per_sample=8), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 7, bits_per_sample=8), mean(!source)))
end
elsif bitrate == 96 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 7, bits_per_sample=8), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 7, bits_per_sample=8), mean(!source)))
end
elsif bitrate == 128 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 6, bits_per_sample=16), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 6, bits_per_sample=16), mean(!source)))
end
elsif bitrate == 160 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 5, bits_per_sample=16), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 5, bits_per_sample=16), mean(!source)))
end
elsif bitrate == 192 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 4, bits_per_sample=16), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 4, bits_per_sample=16), mean(!source)))
end
elsif bitrate == 224 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 3, bits_per_sample=32), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 3, bits_per_sample=32), mean(!source)))
end
elsif bitrate == 256 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 2, bits_per_sample=32), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 2, bits_per_sample=32), mean(!source)))
end
elsif bitrate == 320 then
if stereo then
ignore(output_icecast_stereo(%flac(samplerate=44100, channels = 2, compression = 1, bits_per_sample=32), !source))
else
ignore(output_icecast_mono(%flac(samplerate=44100, channels = 1, compression = 1, bits_per_sample=32), mean(!source)))
end
end