rpcsx/rpcs3/Emu/Audio/AudioDumper.h
Peter Tissen c37905e465 initial start to eliminate static func init, not compilable atm
move module initialization into a module manager, still has some issues like stopping not working and debug crashing

add #idef 0 to modules that aren't in the windows project

don't double initialize and don't de-initialize for now, since many modules don't expect it and it leads to many errors

remove duplicate module lists for empty modules and implemented ones, make Module non-copyable but movable

add secondary project, no real use for it now

add some memleak config to the emucore and add asmjit path to rpcs3

small rebase error fixed to get it to compile again

add filters for emucore

re-add the module manager and static file

WIP commit, linker errors abound

some more abstraction layer stuff

fix the remaining linker errors, re-enable platform specific mouse, pad and keyboard handlers

rebasing

fix memset undefined and re() usage of se_t before declaration

Add wxGUI define by default for cmake builds

fix copy constructors of Datetime header

fix copy constructors of other wx interface classes

remove static declarations of global variables

make wxGLCanvas constructor non-ambiguous even with wx2.8. compat mode, fix wrong std::exception constructor calls

remove duplicate definition for FromUTF8 and ToUTF8

temp changes
2014-06-08 23:16:06 +02:00

70 lines
1.3 KiB
C++

#pragma once
struct WAVHeader
{
struct RIFFHeader
{
u32 ID; // "RIFF"
u32 Size; // FileSize - 8
u32 WAVE; // "WAVE"
RIFFHeader(u32 size)
: ID(*(u32*)"RIFF")
, WAVE(*(u32*)"WAVE")
, Size(size)
{
}
} RIFF;
struct FMTHeader
{
u32 ID; // "fmt "
u32 Size; // 16
u16 AudioFormat; // 1 for PCM, 3 for IEEE Floating Point
u16 NumChannels; // 1, 2, 6, 8
u32 SampleRate; // 48000
u32 ByteRate; // SampleRate * NumChannels * BitsPerSample/8
u16 BlockAlign; // NumChannels * BitsPerSample/8
u16 BitsPerSample; // sizeof(float) * 8
FMTHeader(u8 ch)
: ID(*(u32*)"fmt ")
, Size(16)
, AudioFormat(3)
, NumChannels(ch)
, SampleRate(48000)
, ByteRate(SampleRate * ch * sizeof(float))
, BlockAlign(ch * sizeof(float))
, BitsPerSample(sizeof(float) * 8)
{
}
} FMT;
u32 ID; // "data"
u32 Size; // size of data (256 * NumChannels * sizeof(float))
WAVHeader(u8 ch)
: ID(*(u32*)"data")
, Size(0)
, FMT(ch)
, RIFF(sizeof(RIFFHeader) + sizeof(FMTHeader))
{
}
};
class AudioDumper
{
private:
WAVHeader m_header;
rFile m_output;
public:
AudioDumper(u8 ch);
~AudioDumper();
bool Init();
void WriteHeader();
size_t WriteData(const void* buffer, size_t size);
void Finalize();
const u8 GetCh() const { return m_header.FMT.NumChannels; }
};