summaryrefslogtreecommitdiffstats
path: root/src/wavfile.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-21 11:50:28 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-21 11:50:28 +0100
commit3a5da13910ec0eccf439d8b3a9f6728d127dc1b8 (patch)
tree3442b428d7eb8bb21f057eb08b945a91950d25f4 /src/wavfile.cpp
parent60140af509d33cd2179c56388b16746e9d67071a (diff)
downloadODR-AudioEnc-3a5da13910ec0eccf439d8b3a9f6728d127dc1b8.tar.gz
ODR-AudioEnc-3a5da13910ec0eccf439d8b3a9f6728d127dc1b8.tar.bz2
ODR-AudioEnc-3a5da13910ec0eccf439d8b3a9f6728d127dc1b8.zip
Correct wav header write
Diffstat (limited to 'src/wavfile.cpp')
-rw-r--r--src/wavfile.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wavfile.cpp b/src/wavfile.cpp
index 7de4ffc..4bd4bd6 100644
--- a/src/wavfile.cpp
+++ b/src/wavfile.cpp
@@ -219,7 +219,7 @@ WavWriter::WavWriter(const char *filename)
}
}
-void WavWriter::initialise_header(int rate)
+void WavWriter::initialise_header(int rate, int channels)
{
struct wavfile_header header;
@@ -234,10 +234,10 @@ void WavWriter::initialise_header(int rate)
header.riff_length = 0;
header.fmt_length = 16;
header.audio_format = 1;
- header.num_channels = 2;
+ header.num_channels = channels;
header.sample_rate = samples_per_second;
- header.byte_rate = samples_per_second*(bits_per_sample/8);
- header.block_align = bits_per_sample/8;
+ header.byte_rate = samples_per_second*(bits_per_sample/8)*channels;
+ header.block_align = channels*bits_per_sample/8;
header.bits_per_sample = bits_per_sample;
header.data_length = 0;