mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-17 01:45:41 +00:00
fix compiling with visual studio
This commit is contained in:
parent
75f8ee61a3
commit
c0729c1048
|
@ -246,8 +246,8 @@ bool OpenAudio()
|
||||||
return ErrorLog("Unable to open 44.1KHz 2-channel audio with SDL: %s\n", SDL_GetError());
|
return ErrorLog("Unable to open 44.1KHz 2-channel audio with SDL: %s\n", SDL_GetError());
|
||||||
|
|
||||||
// Create audio buffer
|
// Create audio buffer
|
||||||
const constexpr uint32_t bufferSize = SAMPLE_RATE * BYTES_PER_SAMPLE * latency / MAX_LATENCY;
|
constexpr uint32_t bufferSize = SAMPLE_RATE * BYTES_PER_SAMPLE * latency / MAX_LATENCY;
|
||||||
static_assert(bufferSize % BYTES_PER_SAMPLE == 0); // must be an integer multiple of the sample size
|
static_assert(bufferSize % BYTES_PER_SAMPLE == 0, "must be an integer multiple of the sample size");
|
||||||
audioBufferSize = bufferSize;
|
audioBufferSize = bufferSize;
|
||||||
|
|
||||||
int minBufferSize = 3 * BYTES_PER_FRAME;
|
int minBufferSize = 3 * BYTES_PER_FRAME;
|
||||||
|
@ -262,12 +262,12 @@ bool OpenAudio()
|
||||||
|
|
||||||
// Set initial play position to be beginning of buffer and initial write position to be half-way into buffer
|
// Set initial play position to be beginning of buffer and initial write position to be half-way into buffer
|
||||||
playPos = 0;
|
playPos = 0;
|
||||||
const constexpr uint32_t endOfBuffer = bufferSize - BYTES_PER_FRAME;
|
constexpr uint32_t endOfBuffer = bufferSize - BYTES_PER_FRAME;
|
||||||
const constexpr uint32_t midpointAfterFirstFrameUnaligned = BYTES_PER_FRAME + (bufferSize - BYTES_PER_FRAME) / 2;
|
constexpr uint32_t midpointAfterFirstFrameUnaligned = BYTES_PER_FRAME + (bufferSize - BYTES_PER_FRAME) / 2;
|
||||||
const constexpr uint32_t extraPaddingNeeded = (BYTES_PER_SAMPLE - midpointAfterFirstFrameUnaligned % BYTES_PER_SAMPLE) % BYTES_PER_SAMPLE;
|
constexpr uint32_t extraPaddingNeeded = (BYTES_PER_SAMPLE - midpointAfterFirstFrameUnaligned % BYTES_PER_SAMPLE) % BYTES_PER_SAMPLE;
|
||||||
const constexpr uint32_t midpointAfterFirstFrame = midpointAfterFirstFrameUnaligned + extraPaddingNeeded;
|
constexpr uint32_t midpointAfterFirstFrame = midpointAfterFirstFrameUnaligned + extraPaddingNeeded;
|
||||||
static_assert(endOfBuffer % BYTES_PER_SAMPLE == 0); // make sure we are aligned to a sample boundary otherwise underrun/overrun adjustment will end up shifting playback by one channel causing stereo to flip
|
static_assert(endOfBuffer % BYTES_PER_SAMPLE == 0, "make sure we are aligned to a sample boundary otherwise underrun/overrun adjustment will end up shifting playback by one channel causing stereo to flip");
|
||||||
static_assert(midpointAfterFirstFrame % BYTES_PER_SAMPLE == 0);
|
static_assert(midpointAfterFirstFrame % BYTES_PER_SAMPLE == 0,"error");
|
||||||
writePos = std::min<int>(endOfBuffer, midpointAfterFirstFrame);
|
writePos = std::min<int>(endOfBuffer, midpointAfterFirstFrame);
|
||||||
writeWrapped = false;
|
writeWrapped = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue