Jeremy R. Donnell
2006-Oct-24 11:30 UTC
[Vorbis] oggdec.exe not using album gain stdout option
This question is mainly directed at John Edwards, I believe. I'm attempting to use oggdec.exe in a batch conversion of ogg vorbis files for use on a portable player. I'm using the -o option to redirect output to the LAME encoder. So far so good. However, I also want to do volume leveling using the replaygain tags. If I specify track (radio) gain, everything works fine, however, when I specify album (audiophile) gain, no gain is applied. I've had a look at the code, and as near as I can tell the problem is in here: 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". I'm not a C/C++ programmer, so although I can sort of read this code, I'm not at all familiar with getting it to compile. Using instructions that were posted to this list a month or so back, I've attempted to compile the project with Visual Studio 2005, but I haven't met with any success on that front. Any help (and maybe an updated binary ;) ) would be appreciated. Thanks. -- Jeremy -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/vorbis/attachments/20061024/19c2c892/attachment.html
Let me take a look at this and I'll get back to you. John Jeremy R. Donnell wrote:> This question is mainly directed at John Edwards, I believe. I'm > attempting to use oggdec.exe in a batch conversion of ogg vorbis files > for use on a portable player. I'm using the -o option to redirect output > to the LAME encoder. So far so good. > > However, I also want to do volume leveling using the replaygain tags. If > I specify track (radio) gain, everything works fine, however, when I > specify album (audiophile) gain, no gain is applied. I've had a look at > the code, and as near as I can tell the problem is in here: > > 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". > > I'm not a C/C++ programmer, so although I can sort of read this code, > I'm not at all familiar with getting it to compile. Using instructions > that were posted to this list a month or so back, I've attempted to > compile the project with Visual Studio 2005, but I haven't met with any > success on that front. > > Any help (and maybe an updated binary ;) ) would be appreciated. Thanks. > > -- > Jeremy >
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