mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 16:24:04 +02:00
"mal_" to "ma_".
This commit is contained in:
+18
-18
@@ -13,7 +13,7 @@ void main_loop__em()
|
||||
}
|
||||
#endif
|
||||
|
||||
void log_callback(mal_context* pContext, mal_device* pDevice, mal_uint32 logLevel, const char* message)
|
||||
void log_callback(ma_context* pContext, ma_device* pDevice, ma_uint32 logLevel, const char* message)
|
||||
{
|
||||
(void)pContext;
|
||||
(void)pDevice;
|
||||
@@ -21,21 +21,21 @@ void log_callback(mal_context* pContext, mal_device* pDevice, mal_uint32 logLeve
|
||||
printf("%s\n", message);
|
||||
}
|
||||
|
||||
void stop_callback(mal_device* pDevice)
|
||||
void stop_callback(ma_device* pDevice)
|
||||
{
|
||||
(void)pDevice;
|
||||
printf("STOPPED\n");
|
||||
}
|
||||
|
||||
void data_callback(mal_device* pDevice, void* pOutput, const void* pInput, mal_uint32 frameCount)
|
||||
void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
|
||||
{
|
||||
/* In this test the format and channel count are the same for both input and output which means we can just memcpy(). */
|
||||
mal_copy_memory(pOutput, pInput, frameCount * mal_get_bytes_per_frame(pDevice->capture.format, pDevice->capture.channels));
|
||||
ma_copy_memory(pOutput, pInput, frameCount * ma_get_bytes_per_frame(pDevice->capture.format, pDevice->capture.channels));
|
||||
|
||||
#if 1
|
||||
/* Also write to a wav file for debugging. */
|
||||
drwav* pWav = (drwav*)pDevice->pUserData;
|
||||
mal_assert(pWav != NULL);
|
||||
ma_assert(pWav != NULL);
|
||||
|
||||
drwav_write_pcm_frames(pWav, frameCount, pInput);
|
||||
#endif
|
||||
@@ -43,7 +43,7 @@ void data_callback(mal_device* pDevice, void* pOutput, const void* pInput, mal_u
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mal_result result;
|
||||
ma_result result;
|
||||
|
||||
#if 1
|
||||
drwav_data_format wavFormat;
|
||||
@@ -61,26 +61,26 @@ int main(int argc, char** argv)
|
||||
#endif
|
||||
|
||||
|
||||
mal_backend backend = mal_backend_wasapi;
|
||||
ma_backend backend = ma_backend_wasapi;
|
||||
|
||||
mal_context_config contextConfig = mal_context_config_init();
|
||||
ma_context_config contextConfig = ma_context_config_init();
|
||||
contextConfig.logCallback = log_callback;
|
||||
|
||||
mal_context context;
|
||||
result = mal_context_init(&backend, 1, &contextConfig, &context);
|
||||
ma_context context;
|
||||
result = ma_context_init(&backend, 1, &contextConfig, &context);
|
||||
if (result != MA_SUCCESS) {
|
||||
printf("Failed to initialize context.\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
mal_device_config deviceConfig = mal_device_config_init(mal_device_type_duplex);
|
||||
ma_device_config deviceConfig = ma_device_config_init(ma_device_type_duplex);
|
||||
deviceConfig.capture.pDeviceID = NULL;
|
||||
deviceConfig.capture.format = mal_format_s16;
|
||||
deviceConfig.capture.format = ma_format_s16;
|
||||
deviceConfig.capture.channels = 2;
|
||||
deviceConfig.playback.pDeviceID = NULL;
|
||||
deviceConfig.playback.format = mal_format_s16;
|
||||
deviceConfig.playback.format = ma_format_s16;
|
||||
deviceConfig.playback.channels = 2;
|
||||
deviceConfig.playback.shareMode = mal_share_mode_shared;
|
||||
deviceConfig.playback.shareMode = ma_share_mode_shared;
|
||||
deviceConfig.sampleRate = 44100;
|
||||
//deviceConfig.bufferSizeInMilliseconds = 60;
|
||||
deviceConfig.bufferSizeInFrames = 4096;
|
||||
@@ -89,8 +89,8 @@ int main(int argc, char** argv)
|
||||
deviceConfig.stopCallback = stop_callback;
|
||||
deviceConfig.pUserData = &wav;
|
||||
|
||||
mal_device device;
|
||||
result = mal_device_init(&context, &deviceConfig, &device);
|
||||
ma_device device;
|
||||
result = ma_device_init(&context, &deviceConfig, &device);
|
||||
if (result != MA_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ int main(int argc, char** argv)
|
||||
getchar();
|
||||
#endif
|
||||
|
||||
mal_device_start(&device);
|
||||
ma_device_start(&device);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_main_loop(main_loop__em, 0, 1);
|
||||
@@ -108,7 +108,7 @@ int main(int argc, char** argv)
|
||||
getchar();
|
||||
#endif
|
||||
|
||||
mal_device_uninit(&device);
|
||||
ma_device_uninit(&device);
|
||||
drwav_uninit(&wav);
|
||||
|
||||
(void)argc;
|
||||
|
||||
Reference in New Issue
Block a user