mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2025-01-10 14:45:38 +00:00
Merge pull request #155 from Slin/master
Fixed WASAPI input stream failing and removed /WX compile flag for MSVC.
This commit is contained in:
commit
90a4a2e4b7
|
@ -198,7 +198,7 @@ set(LIBSOUNDIO_LIBS
|
|||
)
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX /Wall")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Wall")
|
||||
set(LIB_CFLAGS "/TP /W4")
|
||||
set(EXAMPLE_CFLAGS "/W4")
|
||||
set(TEST_CFLAGS "${LIB_CFLAGS}")
|
||||
|
|
13
src/wasapi.c
13
src/wasapi.c
|
@ -2084,7 +2084,9 @@ static int instream_begin_read_wasapi(struct SoundIoPrivate *si, struct SoundIoI
|
|||
{
|
||||
return SoundIoErrorStreaming;
|
||||
}
|
||||
isw->opened_buf_frames = frames_to_read;
|
||||
isw->read_buf_frames_left = frames_to_read;
|
||||
|
||||
if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
|
||||
isw->read_buf = NULL;
|
||||
}
|
||||
|
@ -2096,6 +2098,8 @@ static int instream_begin_read_wasapi(struct SoundIoPrivate *si, struct SoundIoI
|
|||
for (int ch = 0; ch < instream->layout.channel_count; ch += 1) {
|
||||
isw->areas[ch].ptr = isw->read_buf + ch * instream->bytes_per_sample;
|
||||
isw->areas[ch].step = instream->bytes_per_frame;
|
||||
|
||||
isw->areas[ch].ptr += instream->bytes_per_frame * (isw->opened_buf_frames - isw->read_buf_frames_left);
|
||||
}
|
||||
|
||||
*out_areas = isw->areas;
|
||||
|
@ -2109,10 +2113,15 @@ static int instream_begin_read_wasapi(struct SoundIoPrivate *si, struct SoundIoI
|
|||
static int instream_end_read_wasapi(struct SoundIoPrivate *si, struct SoundIoInStreamPrivate *is) {
|
||||
struct SoundIoInStreamWasapi *isw = &is->backend_data.wasapi;
|
||||
HRESULT hr;
|
||||
if (FAILED(hr = IAudioCaptureClient_ReleaseBuffer(isw->audio_capture_client, isw->read_frame_count))) {
|
||||
|
||||
isw->read_buf_frames_left -= isw->read_frame_count;
|
||||
|
||||
if (isw->read_buf_frames_left <= 0) {
|
||||
if (FAILED(hr = IAudioCaptureClient_ReleaseBuffer(isw->audio_capture_client, isw->opened_buf_frames))) {
|
||||
return SoundIoErrorStreaming;
|
||||
}
|
||||
isw->read_buf_frames_left -= isw->read_frame_count;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ struct SoundIoInStreamWasapi {
|
|||
bool started;
|
||||
char *read_buf;
|
||||
int read_buf_frames_left;
|
||||
int opened_buf_frames;
|
||||
struct SoundIoChannelArea areas[SOUNDIO_MAX_CHANNELS];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue