Skip to content
Snippets Groups Projects
Commit 0164c347 authored by ferrari's avatar ferrari
Browse files

Fix bit_depth option

parent 81563a7c
No related branches found
No related tags found
2 merge requests!2HighBlueParser dev branch merged to empty main branch,!1High blue rec
......@@ -92,7 +92,7 @@ WavFileWriter::WavFileWriter(std::string &filename_template, size_t num_channels
// write header
store_little_endian(header.fmt_channels, num_channels);
store_little_endian(header.fmt_sample_rate, sample_rate);
store_little_endian(header.fmt_bits_per_sample, 1<<(2+depth));
store_little_endian(header.fmt_bits_per_sample, 8 * depth);
store_little_endian(header.fmt_byte_rate, num_channels * sample_rate * depth);
store_little_endian(header.fmt_frame_size, num_channels * depth);
if (expected_num_samples) {
......
......@@ -69,7 +69,7 @@ int record(size_t channels, size_t rate, size_t depth, size_t filter, std::stri
size_t sample_size = channels * depth;
std::vector<std::uint8_t> samples;
try {
std::cout << "Setting recording format to " << channels << " channels at " << rate << " Hz " << (1<<(2+depth)) << " bits" << std::endl;
std::cout << "Setting recording format to " << channels << " channels at " << rate << " Hz " << (8 * depth) << " bits" << std::endl;
recorder.start_recording(channels, rate, depth, filter);
// we will record until we have enough (or forever, if totallen == 0)
while ((total_samples_wanted == 0) || (total_samples_read < total_samples_wanted)) {
......
......@@ -122,7 +122,7 @@ void JasonRecorder::start_recording(std::uint8_t num_channels,size_t sample_rat
(std::uint8_t) ((sample_rate >> 8) & 0xFF),
(std::uint8_t) (sample_rate & 0xFF),
num_channels,
(std::uint8_t) ((1 << (2 + depth))),
(std::uint8_t) (8 * depth),
num_filter};
send_message(START_ID, payload1);
this->num_channels = num_channels;
......@@ -141,7 +141,7 @@ void JasonRecorder::stop_recording() {
(std::uint8_t) ((this->sample_rate >> 8) & 0xFF),
(std::uint8_t) (this->sample_rate & 0xFF),
this->num_channels,
(std::uint8_t) ((1 << (2 + this->depth))),
(std::uint8_t) (8 * this->depth),
this->num_filter};
send_message(START_ID, payload1);
recording = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment