static int raiseVolume(unsigned char *buf,int len_in,float level)
{
#ifndef clamp
#define clamp(a,min,max) (((a)>(max))?(max):(((a)<(min))?(min):(a)))
#endif
#define NS_CHANNELS 2
int ch = 0,i;
int16_t* a = (int16_t*)buf; // Audio data
int len = len_in/2; // Number of samples
for(ch = 0; ch < NS_CHANNELS ; ch++){
if(1){
register int vol = (int)(255.0 * level);
for(i=ch;i<len;i+=NS_CHANNELS){
register int x = (a[i] * vol) >> 8;
a[i]=clamp(x,SHRT_MIN,SHRT_MAX);
}
}
}
return 0;
}
{
#ifndef clamp
#define clamp(a,min,max) (((a)>(max))?(max):(((a)<(min))?(min):(a)))
#endif
#define NS_CHANNELS 2
int ch = 0,i;
int16_t* a = (int16_t*)buf; // Audio data
int len = len_in/2; // Number of samples
for(ch = 0; ch < NS_CHANNELS ; ch++){
if(1){
register int vol = (int)(255.0 * level);
for(i=ch;i<len;i+=NS_CHANNELS){
register int x = (a[i] * vol) >> 8;
a[i]=clamp(x,SHRT_MIN,SHRT_MAX);
}
}
}
return 0;
}