The reason I brought this up, is because currently our code is as follows:

        output_mono = (...)
        output_stereo = (...)
        if type == "mp3" then
            if bitrate == 24 then
                if stereo then
                    ignore(output_stereo(%mp3(bitrate = 24, stereo = true),
!source))
                else
                    ignore(output_mono(%mp3(bitrate = 24, stereo = false),
mean(!source)))
                end
            elsif bitrate == 32 then
                if stereo then
                    ignore(output_stereo(%mp3(bitrate = 32, stereo = true),
!source))
                else
                    ignore(output_mono(%mp3(bitrate = 32, stereo = false),
mean(!source)))
                end
            elsif bitrate == 48 then
                if stereo then
                    ignore(output_stereo(%mp3(bitrate = 48, stereo = true),
!source))
                else
                    ignore(output_mono(%mp3(bitrate = 48, stereo = false),
mean(!source)))
                end

Multiply for all bitrates up to 320kbps, then once again for %vorbis, and
then once again for shoutcast :)

Right now it's not so bad, but in the future if we add one more user
customizable variable, it would be wiser to use a code generator :)

Martin

On Mon, Sep 10, 2012 at 3:25 AM, Samuel Mimram <smim...@gmail.com> wrote:

> Hi,
>
> The parameters of encoding formats are very special because the type of
> the source depends on them, and types are checked before executing the
> script. This explains why we have to know those parameters directly by
> looking at those and not having to compute the contents of a variable, etc.
>
> So, your first commandline is not expected to work in a forseeable future
> (we could allow some simple variables at some point but this would make the
> code much more complicated for not many benefits), and the second one is
> the way to go! Also, notice that things might be a bit more involved with a
> source which is not sine() since the first output.icecast expects a mono
> source and the second one expects a stereo source...
>
> Cheers,
>
> Samuel.
>
>
> On Wed, Aug 29, 2012 at 10:10 PM, Martin Konečný <
> martin.kone...@sourcefabric.org> wrote:
>
>> Hello,
>>
>> I am trying make the number of channels to my output configurable and am
>> running following line from the command-line
>>
>> liquidsoap 'xxx = 2; output.icecast(%vorbis(channels=xxx), host =
>> "localhost", port = 8000, user= "source", password = "hackme",
>> mount="test.mp3", sine())'
>>
>> This returns the error "variables are forbidden in encoding formats."
>>
>> I guess the way to get around this is as follows:
>>
>> if xxx == 1 then
>>    output.icecast(%vorbis(channels=1), host = "localhost", port = 8000,
>> user= "source", password = "hackme", mount="test.mp3", sine())'
>> elsif xxx == 2 then
>>    output.icecast(%vorbis(channels=2), host = "localhost", port = 8000,
>> user= "source", password = "hackme", mount="test.mp3", sine())'
>> end
>>
>>
>> Is this the correct way or this a way to go back to the first method? :)
>>
>>
>> Martin
>> --
>>  Open source radio in the cloud. Get yours now! ---> http://airtime.pro
>>
>> Martin Konecny
>> Software Developer, Sourcefabric
>> martin.kone...@sourcefabric.org
>>
>> 720 Bathurst St. Suite 203
>> M5S 2R4, Toronto, ON, Canada
>> +1 (416) 892-8420 (Cell)
>> Skype: martin.konecny15
>>
>> http://www.sourcefabric.org
>> http://www.twitter.com/Sourcefabric
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Savonet-users mailing list
>> Savonet-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>
>>
>


-- 
Open source radio in the cloud. Get yours now! ---> http://airtime.pro

Martin Konecny
Software Developer, Sourcefabric
martin.kone...@sourcefabric.org

720 Bathurst St. Suite 203
M5S 2R4, Toronto, ON, Canada
+1 (416) 892-8420 (Cell)
Skype: martin.konecny15

http://www.sourcefabric.org
http://www.twitter.com/Sourcefabric
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to