[Vorbis] oggdec.exe not using album gain stdout option

Jeremy R. Donnell jeremydonnell at gmail.com
Tue Oct 24 13:59:32 PDT 2006


In C#, '&&' and '||' are called conditional-AND/OR operators. They
will short-circuit evaluation of the expression when possible. See
here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfandandoperator.asp

I guess in C# the '&' and '|' operators would evaluate as you have
specified. Personally, I'd use parens to make it clearer for myself.

Either way, I think the logic in oggdec is not right unless it was the
intention to prevent using album gain with the stdout option.


On 10/24/06, Ian Malone <ibmalone at gmail.com> wrote:
> Jeremy R. Donnell wrote:
>
> >
> >
> > line 775 of oggdec.c
> >
> >        if(!send_to_stdout && audiophile || radio)
> >        {
> >            fprintf(stderr, audiophile
> >                ? " Running in Album/Audiophile mode\n\n"
> >                : " Running in Track/Radio mode\n\n");
> >            /* We are using ReplayGain tags, so get the scale for gain
> > adjustment. */
> >            scale = get_scale(file_names[i], audiophile, radio);
> >        }
> >        else
> >            scale = 1.0;
> >
> > It seems to me from looking at that code that it shouldn't do either track
> > or album gain when stdout is selected, but that contradicts the actual
> > results that I've obtained. Perhaps I don't fully grasp the logical
> > operator
> > rules in C? In C# this would dump to the else as soon as !send_to_stdout
> > evaluated as false, and the audiophile and radio operands would not even be
> > evaluated. I'm thinking that the correct solution would be to take the
> > !send_to_stdout out of the first if statement and add it in before the
> > fprintf() call. In fact, I've seen the "Running in Track/Radio mode"
> > message
> > when using the options "-r -o".
>
> '&&' binds more tightly than '||', is this actually different in C#?
> This if clause is equivalent to
> ((!send_to_stdout && audiophile) || radio)
>
> --
> imalone
> _______________________________________________
> Vorbis mailing list
> Vorbis at xiph.org
> http://lists.xiph.org/mailman/listinfo/vorbis
>


-- 
Jeremy


More information about the Vorbis mailing list