Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/helpers/audio_render_float.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 | |
| 3 template<typename float_t> inline void render_float(float_t* out, const audio_sample* in, size_t count) { | |
| 4 audio_math::convert(in, out, count); | |
| 5 } | |
| 6 | |
| 7 template<typename float_t> inline const float_t* render_float(mem_block_container& buffer, const audio_sample* in, size_t count) { | |
| 8 if (sizeof(float_t) == sizeof(audio_sample)) { | |
| 9 return reinterpret_cast<const float_t*>(in); | |
| 10 } | |
| 11 buffer.set_size(sizeof(float_t) * count); | |
| 12 float_t* out = reinterpret_cast<float_t*>(buffer.get_ptr()); | |
| 13 render_float(out, in, count); | |
| 14 return out; | |
| 15 } | |
| 16 | |
| 17 inline const void* render_float_by_bps(unsigned bps, mem_block_container& buffer, const audio_sample* in, size_t count) { | |
| 18 switch (bps) { | |
| 19 case 32: | |
| 20 return render_float<float>(buffer, in, count); | |
| 21 case 64: | |
| 22 return render_float<double>(buffer, in, count); | |
| 23 default: | |
| 24 throw exception_io_data(); | |
| 25 } | |
| 26 } |
