hi again.
Some posts earlier Ian @ Un4seen posted a way to add silent padding to a sample. Since i am a delphi user and never got into C i have a bit trouble to convert it. Would be really nice if someone could help me.
decoder=BASS_StreamCreateFile(FALSE, filename, 0, 0, BASS_STREAM_DECODE); // create decoder for audio file
BASS_CHANNELINFO ci;
BASS_ChannelGetInfo(decoder, &ci); // get sample format
output=BASS_StreamCreate(ci.freq, ci.chans, ci.flags&~BASS_STREAM_DECODE, StreamProc, 0); // create stream to play decoded data + silent padding
padding=BASS_ChannelSeconds2Bytes(output, paddingseconds); // length of silent padding
BASS_ChannelPlay(output, 0); // start the output
...
DWORD CALLBACK StreamProc(HSTREAM handle, void *buffer, DWORD length, void *user)
{
int r=BASS_ChannelGetData(decoder, buffer, length); // get data from the decoder
if (r<0 || !BASS_ChannelIsActive(decoder)) { // end of file, add padding...
if (r<0) r=0;
int c=min(length-r, padding); // amount of padding to add
memset(((BYTE*)buffer)+r, 0, c); // add the padding
r+=c;
padding-=c; // decrease padding counter
if (!padding) r|=BASS_STREAMPROC_END; // no more padding, end of stream
}
return r;
}
I know most of the equivalent syntax but i don't know what the counterpart for memset is.