Author Topic: Fade out a recording  (Read 191 times)

normcook04

  • Posts: 26
Fade out a recording
« on: 15 Apr '17 - 13:19 »
I have successfully used BASS_ChannelSlideAttribute on playing music.
However, it does not seem to work on a Record Channel.
I just want to fade out the recording before the call to stop the recording.

Ian @ un4seen

  • Administrator
  • Posts: 20393
Re: Fade out a recording
« Reply #1 on: 17 Apr '17 - 16:30 »
What are you doing with the recorded data? If you're processing it in the RECORDPROC function, then you could apply the fade-out there too. For example, something like this:

Code: [Select]
BOOL CALLBACK RecordProc(HRECORD handle, const void *buffer, DWORD length, void *user)
{
if (ending) {
short *d=(short*)buffer; // assuming 16-bit
int fadelen=length/sizeof(short);
for (int a=0; a<fadelen; a++)
d[a]=d[a]*(1-(float)a/fadelen); // apply fade-out
}
// other processing...
return !ending;
}