Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/helpers/writer_wav.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 #ifdef _WIN32 | |
| 4 #include <mmreg.h> | |
| 5 #endif | |
| 6 | |
| 7 #include <SDK/audio_postprocessor.h> | |
| 8 | |
| 9 struct wavWriterSetup_t | |
| 10 { | |
| 11 unsigned m_bps,m_bpsValid,m_samplerate,m_channels,m_channel_mask; | |
| 12 bool m_float,m_dither, m_wave64; | |
| 13 bool m_rf64_implicit, m_rf64_explicit; | |
| 14 | |
| 15 | |
| 16 void initialize(const audio_chunk & p_chunk,unsigned p_bps,bool p_float,bool p_dither, bool p_wave64 = false); | |
| 17 void initialize2(const audio_chunk & p_chunk,unsigned p_bps, unsigned p_bpsValid,bool p_float,bool p_dither, bool p_wave64 = false); | |
| 18 void initialize3(const audio_chunk::spec_t & spec, unsigned bps, unsigned bpsValid, bool bFloat, bool bDither, bool bWave64 = false); | |
| 19 | |
| 20 #ifdef _WAVEFORMATEX_ | |
| 21 void setup_wfx(WAVEFORMATEX & p_wfx); | |
| 22 #endif | |
| 23 #ifdef _WAVEFORMATEXTENSIBLE_ | |
| 24 void setup_wfxe(WAVEFORMATEXTENSIBLE & p_wfx); | |
| 25 #endif | |
| 26 bool needWFXE() const; | |
| 27 }; | |
| 28 | |
| 29 class CWavWriter | |
| 30 { | |
| 31 public: | |
| 32 void open(const char * p_path, const wavWriterSetup_t & p_setup, abort_callback & p_abort); | |
| 33 void open(service_ptr_t<file> p_file, const wavWriterSetup_t & p_setup, abort_callback & p_abort); | |
| 34 void write(const audio_chunk & p_chunk,abort_callback & p_abort); | |
| 35 void write_raw( const void * raw, size_t rawSize, abort_callback & p_abort ); | |
| 36 void finalize(abort_callback & p_abort); | |
| 37 void close(); | |
| 38 bool is_open() const { return m_file.is_valid(); } | |
| 39 audio_chunk::spec_t get_spec() const; | |
| 40 private: | |
| 41 size_t align(abort_callback & abort); | |
| 42 void writeSize(t_uint64 size, abort_callback & abort); | |
| 43 bool is64() const {return m_setup.m_wave64;} | |
| 44 t_uint32 chunkOverhead() const {return is64() ? 24 : 8;} | |
| 45 void writeID(const GUID & id, abort_callback & abort); | |
| 46 service_ptr_t<file> m_file; | |
| 47 service_ptr_t<audio_postprocessor> m_postprocessor; | |
| 48 wavWriterSetup_t m_setup; | |
| 49 bool m_wfxe = false; | |
| 50 t_uint64 m_offset_fix1 = 0,m_offset_fix2 = 0,m_offset_fix1_delta = 0,m_bytes_written = 0; | |
| 51 uint64_t m_ds64_at = 0; | |
| 52 mem_block_container_aligned_incremental_impl<16> m_postprocessor_output; | |
| 53 }; | |
| 54 | |
| 55 file::ptr makeLiveWAVFile( const wavWriterSetup_t & setup, file::ptr data ); |
