1
Audio / For the SFML Developers: SoundStream Chunk
« on: July 15, 2014, 02:17:43 am »
Hi,
This may seem like a minor request, but could you make the SoundStream Chunk's "samples" field be non-const?
https://github.com/SFML/SFML/blob/master/include/SFML/Audio/SoundStream.hpp#L55
(Line 55)
It's hard to explain why this is such a big deal for me, but basically it would make my code a lot cleaner, faster, and easier if I could change its value over time. I guess this is the best way to explain why:
I'm generating sound data programmatically, and I am not using a file or stream source of any kind. I would prefer to be able to just store the sound data and add to it all within the Chunk. Instead, I have to do something more like this:
In addition, I might want to make modifications to the Chunk over time. I would prefer not to have to maintain two arrays/vectors/etc. when there only needs to be one. Hopefully this makes sense.
(I'm also a little curious as to why it was made const in the first place and why that would be necessary?)
Thanks,
- Andrew
This may seem like a minor request, but could you make the SoundStream Chunk's "samples" field be non-const?
https://github.com/SFML/SFML/blob/master/include/SFML/Audio/SoundStream.hpp#L55
(Line 55)
It's hard to explain why this is such a big deal for me, but basically it would make my code a lot cleaner, faster, and easier if I could change its value over time. I guess this is the best way to explain why:
I'm generating sound data programmatically, and I am not using a file or stream source of any kind. I would prefer to be able to just store the sound data and add to it all within the Chunk. Instead, I have to do something more like this:
short* soundData = new short[200000];
for (blahblah)
{
soundData[whatever] = etc.;
}
sf::SoundStream::Chunk c;
c.samples = soundData;
for (blahblah)
{
soundData[whatever] = etc.;
}
sf::SoundStream::Chunk c;
c.samples = soundData;
In addition, I might want to make modifications to the Chunk over time. I would prefer not to have to maintain two arrays/vectors/etc. when there only needs to be one. Hopefully this makes sense.
(I'm also a little curious as to why it was made const in the first place and why that would be necessary?)
Thanks,
- Andrew