mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 13:31:49 +00:00
fix
This commit is contained in:
parent
b809c2df84
commit
59fe8af8ca
1 changed files with 4 additions and 1 deletions
|
|
@ -27,6 +27,8 @@ std::int32_t convert_to_int(char* buffer, std::size_t len){
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
audio::PCM* wav::load_pcm(const std::filesystem::path& file, bool headerOnly) {
|
audio::PCM* wav::load_pcm(const std::filesystem::path& file, bool headerOnly) {
|
||||||
std::ifstream in(file, std::ios::binary);
|
std::ifstream in(file, std::ios::binary);
|
||||||
if(!in.is_open()){
|
if(!in.is_open()){
|
||||||
|
|
@ -83,7 +85,7 @@ audio::PCM* wav::load_pcm(const std::filesystem::path& file, bool headerOnly) {
|
||||||
throw std::runtime_error("could not read bits per sample");
|
throw std::runtime_error("could not read bits per sample");
|
||||||
}
|
}
|
||||||
int bitsPerSample = convert_to_int(buffer, 2);
|
int bitsPerSample = convert_to_int(buffer, 2);
|
||||||
channels /= bitsPerSample/8;
|
std::cout << "CHANN " << channels << std::endl;
|
||||||
|
|
||||||
// data chunk header "data"
|
// data chunk header "data"
|
||||||
if(!in.read(buffer, 4)){
|
if(!in.read(buffer, 4)){
|
||||||
|
|
@ -114,5 +116,6 @@ audio::PCM* wav::load_pcm(const std::filesystem::path& file, bool headerOnly) {
|
||||||
throw std::runtime_error("could not load wav data of '"+file.u8string()+"'");
|
throw std::runtime_error("could not load wav data of '"+file.u8string()+"'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << channels << " " << bitsPerSample << " " << sampleRate << std::endl;
|
||||||
return new audio::PCM(std::move(data), channels, bitsPerSample, sampleRate);
|
return new audio::PCM(std::move(data), channels, bitsPerSample, sampleRate);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue