Skip to content

Commit 57ed6bf

Browse files
authored
Fix the build (#23)
* Update CMakeLists.txt * std::uint
1 parent 939dbd6 commit 57ed6bf

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
77
set(CMAKE_CXX_STANDARD 20)
88
set(CMAKE_CXX_STANDARD_REQUIRED OFF)
99
set(CMAKE_CXX_EXTENSIONS OFF)
10-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -std=c++20")
1110

1211
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
12+
# Use libc++ on macOS, system default on Linux
13+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
1314
include_directories(SYSTEM /usr/local/include)
1415
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
1516
link_libraries(stdc++fs)

dsp/wav.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Steven Atkinson on 12/31/22.
66
//
77

8+
#include <cstdint>
89
#include <cstring> // strncmp
910
#include <cmath> // pow
1011
#include <fstream>
@@ -43,9 +44,9 @@ struct WaveFileData
4344
short bitsPerSample;
4445
struct Extensible
4546
{
46-
uint16_t validBitsPerSample;
47-
uint16_t channelMask;
48-
uint32_t subFormat; // PCM, IEEE
47+
std::uint16_t validBitsPerSample;
48+
std::uint16_t channelMask;
49+
std::uint32_t subFormat; // PCM, IEEE
4950
} extensible;
5051
} fmtChunk;
5152

@@ -210,13 +211,13 @@ dsp::wav::LoadReturnCode ReadFmtChunk(std::ifstream& wavFile, WaveFileData& wfd,
210211
unsigned short cbSize = ReadUnsignedShort(wavFile);
211212
// Do we need to assert or modify the data loading below if this doesn't match bitsPerSample?
212213
wfd.fmtChunk.extensible.validBitsPerSample = ReadUnsignedShort(wavFile);
213-
auto read_u32 = [&]() -> uint32_t {
214-
uint8_t b[4];
214+
auto read_u32 = [&]() -> std::uint32_t {
215+
std::uint8_t b[4];
215216
wavFile.read((char*)b, 4);
216217
return b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24);
217218
};
218219
wfd.fmtChunk.extensible.channelMask = read_u32();
219-
uint8_t guid[16];
220+
std::uint8_t guid[16];
220221
wavFile.read((char*)guid, 16);
221222
wfd.fmtChunk.extensible.subFormat = guid[1] << 8 | guid[0];
222223
bytesRead += cbSize + 2; // Don't forget the 2 for the cbSize itself!

0 commit comments

Comments
 (0)