more work

This commit is contained in:
AlexandreRouma
2022-12-06 14:52:42 +01:00
parent d069fb3af8
commit 5c690c9753
5 changed files with 206 additions and 59 deletions

View File

@@ -0,0 +1,41 @@
#pragma once
#include <fstream>
#include <string>
#include <stack>
#include <stdint.h>
namespace riff {
#pragma pack(push, 1)
struct ChunkHeader {
char id[4];
uint32_t size;
};
#pragma pack(pop)
struct ChunkDesc {
ChunkHeader hdr;
std::streampos pos;
};
class Writer {
public:
bool open(std::string path, char form[4]);
bool isOpen();
void close();
void beginList();
void endList();
void beginChunk(char id[4]);
void endChunk();
void write(void* data, size_t len);
private:
void beginRIFF(char form[4]);
void endRIFF();
std::ofstream file;
std::stack<ChunkDesc> chunks;
};
}