mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-18 22:32:44 +00:00
more work
This commit is contained in:
41
misc_modules/recorder/src/riff.h
Normal file
41
misc_modules/recorder/src/riff.h
Normal 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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user