mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Fix re-routing on the WASAPI backend.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// This test just plays a constant sine wave tone. Mainly intended to check how physically
|
||||
// unplugging a device while it's playing works.
|
||||
//#define MAL_DEBUG_OUTPUT
|
||||
#define MAL_DEBUG_OUTPUT
|
||||
#define MINI_AL_IMPLEMENTATION
|
||||
#include "../mini_al.h"
|
||||
#include <stdio.h>
|
||||
@@ -8,10 +8,11 @@
|
||||
mal_sine_wave g_sineWave;
|
||||
mal_event g_stopEvent;
|
||||
|
||||
void on_log(mal_context* pContext, mal_device* pDevice, const char* message)
|
||||
void on_log(mal_context* pContext, mal_device* pDevice, mal_uint32 logLevel, const char* message)
|
||||
{
|
||||
(void)pContext;
|
||||
(void)pDevice;
|
||||
(void)logLevel;
|
||||
printf("%s\n", message);
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ mal_uint32 on_send(mal_device* pDevice, mal_uint32 frameCount, void* pFramesOut)
|
||||
mal_assert(pDevice != NULL);
|
||||
|
||||
//printf("TESTING: %d\n", frameCount);
|
||||
return (mal_uint32)mal_sine_wave_read_ex(&g_sineWave, frameCount, pDevice->channels, mal_stream_layout_interleaved, (float**)&pFramesOut);
|
||||
return (mal_uint32)mal_sine_wave_read_f32_ex(&g_sineWave, frameCount, pDevice->channels, mal_stream_layout_interleaved, (float**)&pFramesOut);
|
||||
}
|
||||
|
||||
int main()
|
||||
@@ -41,12 +42,12 @@ int main()
|
||||
}
|
||||
|
||||
mal_context_config contextConfig = mal_context_config_init(on_log);
|
||||
mal_device_config deviceConfig = mal_device_config_init_playback(mal_format_f32, 0, 48000, on_send);
|
||||
mal_device_config deviceConfig = mal_device_config_init_playback(mal_format_f32, 0, 48000, on_send, NULL);
|
||||
deviceConfig.onStopCallback = on_stop;
|
||||
//deviceConfig.shareMode = mal_share_mode_exclusive;
|
||||
|
||||
mal_device device;
|
||||
result = mal_device_init_ex(&backend, 1, &contextConfig, mal_device_type_playback, NULL, &deviceConfig, NULL, &device);
|
||||
result = mal_device_init_ex(&backend, 1, &contextConfig, mal_device_type_playback, NULL, &deviceConfig, &device);
|
||||
if (result != MAL_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user