0
0

Is it possible to get the wave data from a stream? We have written some code to visualize the waveform of a file. It is running fine with a Sound (not streaming). However, this has big limitation, because we get an"Not enough memory or resources." error after loading big files.

I know that is impossible to use sound::lock on a stream, but how do we get data from a stream?

  • You must to post comments
0
0
  • You must to post comments
0
0

No it is not the same, I don’t need an example!
Sorry, I might need to explain my thing a bit better…

We currently have C++ code that plots the waveform. It is working fine with static sound. We get the data with sound::lock. Then we convert each sample to a float (in between -1.0 and 1.0) and then we plot the data. The waveform visualization is comparable to WaveLab or Audacity.

My question is: If the sound is created as FMOD_CREATESTREAM, so the sound is not loaded into memory but decompressed at playing time what is the equivalent of sound::lock, sound::unlock to get the data? (Because, we can’t lock a stream).

I know that we can use sound::ReadData() but it is problematic to use it because it moves the position of the play head. However, I think that is my only option if I want to get data from a stream??

  • You must to post comments
0
0

if the sound is playing and you’re just plotting a windowed waveform, then you should use Channel::getWaveData. There’s already code that does that in ‘dsppluginviewer’

Otherwise if it is not playing, whats the problem with moving the read position? (play head as you called it). Just use seekData if you want to reset it. You would have to use readData anyway, that is correct in that case.

  • You must to post comments
0
0

channel::getWaveData is not good for me because I might need to display more than 16384 samples.

The problem with readData() is that we might want to play one region of a file and visualize a different region. So, we can not seek the file to use readData, because the sound is playing.

My idea is to create two streams for each file that I load in. The first stream would be used to play the sound; the second stream would be used to get data from the file (using readData and seekData).

  • You must to post comments
0
0

Post your code here to help.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.