Replies: 3 comments 5 replies
-
Can't help you much with this one. No idea what's going on there, but considering you were encountering the issue even after restarts of the program it seems highly doubtful that it's a miniaudio issue. Sounds like something is up on the system level, but I've no idea what that could be. What do you mean by "sounds were not starting at the right time"? Do you mean there was an excessive amount of latency when playing sounds? |
Beta Was this translation helpful? Give feedback.
-
Not in the data callback, but It's being called via user input via keyboard: 'w'. The Data callback is below: void data_callback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
{
MA_ASSERT(pDevice->capture.format == pDevice->playback.format);
MA_ASSERT(pDevice->capture.channels == pDevice->playback.channels);
//get data into encoder
ma_encoder* pEncoder = (ma_encoder*)pDevice->pUserData;
MA_ASSERT(pEncoder != NULL);
ma_audio_buffer_ref_set_data(&g_exciteData, pInput, frameCount);
if(isDoing){
ma_audio_buffer_ref_set_data(&soundBuffer, pInput, frameCount);
}
if(!isWriting){
ma_engine_read_pcm_frames(&g_engine, pOutput, frameCount,NULL);
}
if(isRecording){
ma_encoder_write_pcm_frames(pEncoder, pInput, frameCount, NULL);
}
}
|
Beta Was this translation helpful? Give feedback.
-
Just re-reading your As for the timing issue, I don't have a satisfying answer for you on this one. I haven't had other reports about timing being affecting due to the system not being restarted after ages, and to be honest I find it highly unlikely to be an error in miniaudio. I was going to suggest that you ensure you don't call Also, your |
Beta Was this translation helpful? Give feedback.
-
Timing issues that I spent all day trying to figure out resolved themselves when I restarted my system.
Background:
I discovered miniaudio around January 2022 as a C and audio novice (still). I was immensely encouraged by the library and community and was able to get some great things done that seemed previously unimaginable. I'm working on a huge and complex project with multiple programming paradigms throughout the entire stack, which makes context switching painful. I left the C/miniaudio world in late January to dive in another realm of the app, I've just come back to miniaudio and started looking over my notes, testing code and trying to reacquaint myself with C and the nuances of miniaudio.
Problem:
Timing issues related to iterating through a lists for structs that reference ma_sounds and their meta info like start_time, initializing sounds, reading frames from the engine into a ma_audio_buffer_ref, writing the buffer to a wav file via an encoder. I knew this worked flawlessly when I developed it in January because I made a happy post here about it, but today the sounds were not starting at the right time. I couldn't find anything wrong or changed. I restarted Xcode a couple of times to no avail. After hours of frustration, I restarted my system in a last ditch effort to try and fix the problem. It worked. I probably haven't restarted my system in months.
Question:
Why? What could've made it work? I'm using a Mac and Xcode. Is there some general piece of knowledge that I'm missing. Not looking to get into the weeds of code, but just from a high level, why would a system restart fix things when restarting Xcode did not? Could it be because of faulty memory management on my part? Is it a C thing, a miniaudio thing or a Mac system/hardware thing? Just wondering...
Beta Was this translation helpful? Give feedback.
All reactions