ConsoleTom
Member
I would like to calculate new volumes to my sounds and need a possibility to lower it by 3DB (about 70%). Then i could use bitshifts to generate a new volume:
100% -> 50% -> 25% etc
70% -> 35% -> 17.5% etc
Let's say i have a 20k sample (16 Bit):
unsigned short WaveData[20000] = { sampledata };
As i know this one is too slow:
for (i=0;i<20000;i++)
{
WaveData *= 0.7
}
How can i do it faster ? Should i create a table where all results from 1*0.7 to 65535*0.7 are stored ? Or what should i do here ?
Greetings
Tobias
100% -> 50% -> 25% etc
70% -> 35% -> 17.5% etc
Let's say i have a 20k sample (16 Bit):
unsigned short WaveData[20000] = { sampledata };
As i know this one is too slow:
for (i=0;i<20000;i++)
{
WaveData *= 0.7
}
How can i do it faster ? Should i create a table where all results from 1*0.7 to 65535*0.7 are stored ? Or what should i do here ?
Greetings
Tobias