Commit Graph

19 Commits

Author SHA1 Message Date
sukibaby a7477a6c56 Better type choices, comment improvements, adding missing braces, removal of dead code. 2025-03-02 08:40:36 -08:00
sukibaby 94eb8d2a7f Vector based RageSoundMixBuffer
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.
2025-03-02 08:40:36 -08:00
sukibaby a6a60e2e56 Remove std prefix from int types
std::int* -> int*
2024-10-08 20:52:52 -07:00
sukibaby 659cd549a2 Remove std prefix from uint types
std::uint*  ->  uint*
2024-10-05 19:25:41 -07:00
sukibaby 21088502b9 Remove clamp macro
Doesn't really need to exist since  all it's doing is inlining std::clamp.
2024-09-03 20:50:48 -07:00
sukibaby 06bfbbf15d Make BUF_SIZE constexpr 2024-07-10 22:09:23 -07:00
sukibaby 9e3c7fc207 Update RageSoundMixBuffer
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
2024-06-18 06:27:56 -07:00
sukibaby b730a5a750 Remove AltiVec code
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.
2024-05-28 09:34:59 -07:00
sukibaby 2e2d49393b Replace lrint(x) with static_cast(x+0.5)
Update 9 files

Update RageSoundReader_Extend.cpp
Update RageSoundReader_Preload.cpp
Update RageSoundUtil.cpp
Update RageSoundReader_ThreadedBuffer.cpp
Update RageSoundReader_SpeedChange.cpp
Update RageSoundReader_Resample_Good.cpp
Update RageSoundReader_Merge.cpp
Update RageSoundReader_Chain.cpp
Update RageSoundMixBuffer.cpp
2024-05-03 23:17:59 -07:00
Martin Natano aa87f85eef Decouple <cstdint> 2023-04-21 22:13:41 +02:00
Martin Natano b68ca517e6 Clean up math functions
- 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)
2023-04-19 19:31:40 +02:00
teejusb 7e3789b131 Integrate C++11 branch into 5_1-new 2019-06-22 12:35:38 -07:00
Devin J. Pohly 9916275a8a fix signed-compare warnings
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.
2014-02-08 20:30:33 -05:00
Devin J. Pohly 72b490534e Fix stereo problem - samples, not frames 2013-08-08 18:08:19 -04:00
Devin J. Pohly deab7e6f47 Add deinterlacing function to RageSoundMixBuffer
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.
2013-08-08 13:24:21 -04:00
Jason Felds 28e5148dec The big NULL replacement party part 5.
Right. ' = NULL' would get a lot of these.
2013-05-03 23:39:52 -04:00
Jason Felds a085d0d1da Line endings...be normalized! 2011-03-17 01:47:30 -04:00
AJ Kelly 3e51544930 Initial commit. 2010-01-26 21:00:30 -06:00
Devin J. Pohly 80057f53cd smsvn -> ssc-hg glue: rearrange directory structure 2013-06-10 15:38:43 -04:00