Bringing in algorithm for std::copy, and vector for automatic memory management.
Initializing the buffer with zeroes in the same operation as resizing the buffer. Going back to using an unsigned int for realsize, to prevent the buffer from becoming an unreasonably large size.
The constructor and destructor can be empty since the vector<float>'s own destructor will take care of freeing allocated memory.
The static_cast to an int in read(int16_t *pBuf) is changed to a static_cast to an int16_t, as audio data is expressed in 16 bit integers, and the fractional part is inherently rounded towards zero by truncation.
1) Set a buffer of 2MB instead of setting the buffer to nullptr and depend on it being grown by assets being loaded at the game launch
2) Update some C style code to C++ style
3) Improve Extend feature to support handling a larger number of samples, and error handling in case of a memory allocation failure
The content of src/archutils/Darwin/VectorHelper.cpp is very old, these are AltiVec and SSE2 instructions. This is only actually used in RageSoundMixBuffer.cpp. This level of micro-optimization is not needed since platforms this old are not supported by ITGm.
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include
e.g. floorf(x) -> std::floor(x)
The m_iSelection array could probably be made unsigned... IF we were
confident we never try to assign it a negative number, of which fact I'm
not convinced.
JACK processes every channel separately, so we need this. The audio data is
interlaced all the way back at RageSound::GetDataToPlay(), so this is an easier
hack for now than using deinterlaced until it's needed.