mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Fix a bug in the node graph relating to attaching and detaching nodes.
This was setting the previous pointer of newly attached nodes to NULL instead of a pointer to the dummy head node. This then results in the dummy head node never being updated when the node is detached which in turn results in an uninitialized node being dereferenced.
This commit is contained in:
@@ -78,7 +78,7 @@ int main(int argc, char** argv)
|
|||||||
loadNotification.cb.onSignal = on_sound_loaded;
|
loadNotification.cb.onSignal = on_sound_loaded;
|
||||||
loadNotification.pSound = &sound;
|
loadNotification.pSound = &sound;
|
||||||
|
|
||||||
result = ma_sound_init_from_file(&engine, argv[1], /*MA_DATA_SOURCE_FLAG_DECODE | MA_DATA_SOURCE_FLAG_ASYNC |*/ MA_DATA_SOURCE_FLAG_STREAM, &loadNotification, NULL, &sound);
|
result = ma_sound_init_from_file(&engine, argv[1], MA_DATA_SOURCE_FLAG_DECODE /*| MA_DATA_SOURCE_FLAG_ASYNC | MA_DATA_SOURCE_FLAG_STREAM*/, &loadNotification, NULL, &sound);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
printf("Failed to load sound: %s\n", argv[1]);
|
printf("Failed to load sound: %s\n", argv[1]);
|
||||||
ma_engine_uninit(&engine);
|
ma_engine_uninit(&engine);
|
||||||
@@ -93,6 +93,8 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*ma_data_source_seek_to_pcm_frame(sound.pDataSource, 5000000);*/
|
/*ma_data_source_seek_to_pcm_frame(sound.pDataSource, 5000000);*/
|
||||||
|
|
||||||
//ma_sound_group_set_pan(ma_engine_get_master_sound_group(&engine), -1);
|
//ma_sound_group_set_pan(ma_engine_get_master_sound_group(&engine), -1);
|
||||||
@@ -105,7 +107,7 @@ int main(int argc, char** argv)
|
|||||||
/*ma_sound_set_volume(&sound, 0.25f);*/
|
/*ma_sound_set_volume(&sound, 0.25f);*/
|
||||||
/*ma_sound_set_pitch(&sound, 1.2f);*/
|
/*ma_sound_set_pitch(&sound, 1.2f);*/
|
||||||
/*ma_sound_set_pan(&sound, 0.0f);*/
|
/*ma_sound_set_pan(&sound, 0.0f);*/
|
||||||
//ma_sound_set_looping(&sound, MA_TRUE);
|
ma_sound_set_looping(&sound, MA_TRUE);
|
||||||
//ma_sound_seek_to_pcm_frame(&sound, 6000000);
|
//ma_sound_seek_to_pcm_frame(&sound, 6000000);
|
||||||
//ma_sound_set_start_time(&sound, 1110);
|
//ma_sound_set_start_time(&sound, 1110);
|
||||||
//ma_sound_set_volume(&sound, 0.5f);
|
//ma_sound_set_volume(&sound, 0.5f);
|
||||||
@@ -116,6 +118,7 @@ int main(int argc, char** argv)
|
|||||||
//ma_sound_set_volume(&sound, 1);
|
//ma_sound_set_volume(&sound, 1);
|
||||||
//ma_sound_set_start_time(&sound, 48000);
|
//ma_sound_set_start_time(&sound, 48000);
|
||||||
ma_sound_start(&sound);
|
ma_sound_start(&sound);
|
||||||
|
/*ma_sound_uninit(&sound);*/
|
||||||
|
|
||||||
//ma_sleep(1000);
|
//ma_sleep(1000);
|
||||||
//ma_sound_set_looping(&sound2, MA_TRUE);
|
//ma_sound_set_looping(&sound2, MA_TRUE);
|
||||||
@@ -134,7 +137,7 @@ int main(int argc, char** argv)
|
|||||||
ma_engine_play_sound(&engine, argv[3], NULL);*/
|
ma_engine_play_sound(&engine, argv[3], NULL);*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
float pitch = 1;
|
float pitch = 1;
|
||||||
float pitchStep = 0.01f;
|
float pitchStep = 0.01f;
|
||||||
float pitchMin = 0.125f;
|
float pitchMin = 0.125f;
|
||||||
|
|||||||
@@ -2493,7 +2493,7 @@ static void ma_node_input_bus_attach(ma_node_input_bus* pInputBus, ma_node_outpu
|
|||||||
*/
|
*/
|
||||||
ma_node_input_bus_lock(pInputBus);
|
ma_node_input_bus_lock(pInputBus);
|
||||||
{
|
{
|
||||||
ma_node_output_bus* pNewPrev = NULL;
|
ma_node_output_bus* pNewPrev = &pInputBus->head;
|
||||||
ma_node_output_bus* pNewNext = (ma_node_output_bus*)c89atomic_load_ptr(&pInputBus->head.pNext);
|
ma_node_output_bus* pNewNext = (ma_node_output_bus*)c89atomic_load_ptr(&pInputBus->head.pNext);
|
||||||
|
|
||||||
/* Update the local output bus. */
|
/* Update the local output bus. */
|
||||||
@@ -8714,6 +8714,10 @@ MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEng
|
|||||||
ma_engine_config engineConfig;
|
ma_engine_config engineConfig;
|
||||||
ma_context_config contextConfig;
|
ma_context_config contextConfig;
|
||||||
|
|
||||||
|
if (pEngine != NULL) {
|
||||||
|
MA_ZERO_OBJECT(pEngine);
|
||||||
|
}
|
||||||
|
|
||||||
/* The config is allowed to be NULL in which case we use defaults for everything. */
|
/* The config is allowed to be NULL in which case we use defaults for everything. */
|
||||||
if (pConfig != NULL) {
|
if (pConfig != NULL) {
|
||||||
engineConfig = *pConfig;
|
engineConfig = *pConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user