Author Topic: [Solved]How add sample data to existing channel sample data at any position... ?  (Read 307 times)

RC

  • Posts: 14
Hi Team,

I have opened a new wave file by StreamCreate.... and use BASS_ChannelGetData() into an float array. Now I'm able to add new Samples at any position to the sample array.
But how I can pass the new sample array back to the existing HStream, so the stream knows about the new changes and sample length info (and for playing as well), etc?
Any XXXX__SetData() does not exist.

Thanks again, Roger

Edit:
Seems to be possible with
http://www.un4seen.com/doc/#bass/BASS_StreamPutData.html
« Last Edit: 20 Jul '21 - 13:35 by RC »

Ian @ un4seen

  • Administrator
  • Posts: 23889
It isn't possible to change a file stream's data, but you can create another stream with BASS_StreamCreate to play the new data. You can use either a STREAMPROC callback or BASS_StreamPutData (when proc=STREAMPROC_PUSH) to feed the data to the stream. Please see the documentation for details on the mentioned functions.

RC

  • Posts: 14
Does that mean, everytime I change samples and want to hear the new result, then I have to create a new stream in memory and pass the new samples and play?

Ian @ un4seen

  • Administrator
  • Posts: 23889
If the sample format is the same then you can reuse the stream that you created previously for the new data. If it's a "push" stream (STREAMPROC_PUSH) then you can use BASS_ChannelSetPosition with pos=0 to remove any old data from it first. If the data is changing frequently or mid-playback then it may be better to use a STREAMRPROC callback rather than a "push" stream.

RC

  • Posts: 14
If the sample format is the same then you can reuse the stream that you created previously for the new data. If it's a "push" stream (STREAMPROC_PUSH) then you can use BASS_ChannelSetPosition with pos=0 to remove any old data from it first. If the data is changing frequently or mid-playback then it may be better to use a STREAMRPROC callback rather than a "push" stream.

Thank you..

Unfortunately I must read/write some 24 bit wave files as well by my own.
I need to convert a decimal value to an IEEE 754 24 bit floating point (3 bytes) .. by pure code. I'm currently on assembler and do not have any c++ system functions.
Further... I'm not sure how many bits are used for Sign Exponent Mantissa at 24 bit. 1-7-16?
Did you have some info or a code about?



+1.0 is represented in memory as $FFFF7F
-1.0 =  $000080