summaryrefslogtreecommitdiffstats
path: root/src/wavfile.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-07-24 11:11:16 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-07-24 11:11:16 +0200
commit864cebd1d753a603de9a24d26a830bad87e2a42f (patch)
treeb2f838c8b4e42285cd30ae697b80bdd8feb40aff /src/wavfile.h
parent0dbcb9a977fd9b91d86c79657d1007c77feaffd9 (diff)
downloadODR-AudioEnc-864cebd1d753a603de9a24d26a830bad87e2a42f.tar.gz
ODR-AudioEnc-864cebd1d753a603de9a24d26a830bad87e2a42f.tar.bz2
ODR-AudioEnc-864cebd1d753a603de9a24d26a830bad87e2a42f.zip
Add wav file writer
Diffstat (limited to 'src/wavfile.h')
-rw-r--r--src/wavfile.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/wavfile.h b/src/wavfile.h
index e121b33..92ea56f 100644
--- a/src/wavfile.h
+++ b/src/wavfile.h
@@ -1,5 +1,6 @@
/* ------------------------------------------------------------------
* Copyright (C) 2009 Martin Storsjo
+ * Copyright (C) 2017 Matthias P. Braendli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +19,7 @@
#pragma once
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <cstdio>
void* wav_read_open(const char *filename);
void wav_read_close(void* obj);
@@ -28,7 +27,16 @@ void wav_read_close(void* obj);
int wav_get_header(void* obj, int* format, int* channels, int* sample_rate, int* bits_per_sample, unsigned int* data_length);
int wav_read_data(void* obj, unsigned char* data, unsigned int length);
-#ifdef __cplusplus
-}
-#endif
+class WavWriter {
+ public:
+ WavWriter(const char *filename, int rate);
+ ~WavWriter();
+ WavWriter(const WavWriter& other) = delete;
+ WavWriter& operator=(const WavWriter& other) = delete;
+
+ void write_data(short *data, int length);
+
+ private:
+ FILE *m_fd = nullptr;
+};