mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 22:35:45 +00:00
specify bits instead of bytes
This commit is contained in:
parent
52b16be64a
commit
d2770a9de2
1 changed files with 4 additions and 3 deletions
7
wav.hh
7
wav.hh
|
|
@ -24,16 +24,17 @@ class WriteWAV : public WritePCM<TYPE>
|
|||
os.put(255 & (v >> (8 * i)));
|
||||
}
|
||||
public:
|
||||
WriteWAV(const char *name, int rate, int bytes, int channels) : os(name, std::ios::binary | std::ios::trunc), bytes(bytes), channels(channels)
|
||||
WriteWAV(const char *name, int rate, int bits, int channels) : os(name, std::ios::binary | std::ios::trunc), bytes(bits / 8), channels(channels)
|
||||
{
|
||||
switch (bytes) {
|
||||
case 1:
|
||||
switch (bits) {
|
||||
case 8:
|
||||
offset = 128;
|
||||
factor = 127;
|
||||
min = 0;
|
||||
max = 255;
|
||||
break;
|
||||
default:
|
||||
bits = 16;
|
||||
bytes = 2;
|
||||
offset = 0;
|
||||
factor = 32767;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue