0
0

How can I set a volume that is more the 255 for a channel? I want to make some sounds louder than 100% but not all.

Regards
Steffen

  • You must to post comments
0
0

[b:2mqwzwv8]SOLUTION 1:[/b:2mqwzwv8] central output

FSOUND_DSP_Create()

[b:2mqwzwv8]SOLUTION 2:[/b:2mqwzwv8] At the decoded source of the file

FSOUND_Stream_CreateDSP()

This way you amplify the sound yourself, ofcourse you can put a gain knob on your form to control the float value of gain.

[code:2mqwzwv8]float gain = Value; // something between 0.50 and 1.50 is nice

void *wa_dsp_callback(void *originalbuffer, void *newbuffer, int length, int param)
{
signed short *dspbuff = (signed short *)newbuffer; // source pointer from the data
signed short *srcleft, *srcright;

srcleft   = ((signed short *)newbuffer);
srcright  = ((signed short *)newbuffer)+1;

length <<= 1; // *2 for stereo (number of 16 bit samples)

signed int l, r;
for (int count=0; count<length; count+=2) {
            l = (signed int)srcleft[count];
            r = (signed int)srcright[count];
            l *= gain;
            r *= gain;

            if      (l < -32768) l = -32768;
            else if (l >  32767) l =  32767;
            if      (r < -32768) r = -32768;
            else if (r >  32767) r =  32767;

            dspbuff[count] = (signed short)(l);
            dspbuff[count+1] = (signed short)(r);
}

return newbuffer;

}[/code:2mqwzwv8]

  • You must to post comments
0
0

You could always play the same stream twice ๐Ÿ˜‰

  • You must to post comments
0
0

Is it so hard to allow more then 255 for volume?

  • You must to post comments
0
0

It is impossible, because the value used for the volume only ranges from 0-255, which is one byte. One byte is 8 bits. So after those 256 combinations there are no more possible combinations, and thus you can’t go higher than 255.

If it is so important for you to have some sounds go louder than others, put all sounds at like 70% and the extra loud ones at 100%. This way, the user can pick the proper volume himself/herself on the hardware volume thingy.

  • You must to post comments
0
0

The method doggo18 suggests is the better way simply because if you ipotethically set the volume of a channel over 100% you’ll probably get a lot of distortion and it won’t sound good at all.

  • You must to post comments
0
0

Is it possible to use replay gain to determine the gain for each file. This can be with MP3Gain for mp3 files (off-line, not when you are listen the music). [url:2oppzfqa]http://www.geocities.com/mp3gain/[/url:2oppzfqa]
For ogg vorbis files, you can read a special tag with the gain to be applied. (I don’t found a program similar at mp3gain for ogg vorbis). See WinVorbis and VorbisGain at [url:2oppzfqa]http://winvorbis.stationplaylist.com/[/url:2oppzfqa]

There are some soundcards that permit an output gain (my soundblaster is an example). This gain is 2 or 4x the ‘normal’ volume.

Sorry for the English

cmstein.

  • You must to post comments
0
0

Why is there only a byte for volume values? The API uses an int and the mixer is more then 8 bit…
Disortion would be no problem for me…

  • You must to post comments
0
0

cmstein>you can use Foobar2000 (http://foobar2000.hydrogenaudio.org) to apply replay gain to mp3/ogg/mpc/wav files.

  • You must to post comments
0
0

[quote="KarLKoX":z8wv9qyn]cmstein>you can use Foobar2000 (http://foobar2000.hydrogenaudio.org) to apply replay gain to mp3/ogg/mpc/wav files.[/quote:z8wv9qyn]

Thanks KarLKoX, but I’m not want a player….

MP3Gain isn’t a decodec/codec. This software changes a ‘internal gain’ in mp3 files.

Ahh….. I not knew 7-Zip. Thanks

cmstein

  • You must to post comments
0
0

Fobbar2000 can also encode to wav/ogg with the replaygain (track or album mode) ๐Ÿ˜‰

  • You must to post comments
Showing 10 results
Your Answer

Please first to submit.