Hi there, I’m making a simple audio studio with fmodex – I’m hitting a slight wall here I can’t get the audio recordings to synch up with playing back audio..
I’ve nearly got it (I bastardised a few of the c++ examples). However, always seems I’m slightly out.
I’m not new to coding, but new to c++ and fmod 😮 – so sorry if this is obvious, or can be resolved with standard patterns, etc – however I doubt it. Anyone got any tips?
Code examples would be magic, pseudo code gladly appreciated, but even a pointer in the right direciton in terms of theory would be greatfully received.
- infrid asked 11 years ago
Let’s see if I get this: You’re trying to play and record at the same time, and you want the playback to be in sync with the recording? The problem you’re probably having is latency: when you play a sound, it never starts playing immediately, but is delayed while the mixer fills its buffers. Recording is not subject to this because there’s no buffer to fill: the recording itself fills the buffer!
So in order to keep playback and recording in sync, you have to take latency into account. So if you have, say, 100ms latency, you have to delay starting recording for 100ms. The hard part is determining the exact latency…
- fatcerberus1 answered 11 years ago
that’s interesting. At the moment, I’m trying to set the posititions of all of my tracks to 0, to match the recording, but perhaps, best of all is to measure the latency then and add that to the start of the recording?
not really sure the best way to go about it, as I see it:
- Mesaure latency to start all tracks playing, subtract this from start of wav,
- Start recording once all tracks have initialised (as in started playing) then add the required blanks space to start of wav,
- Start recording, and set all tracks to 0 (experimenting with this now, but it seems a bit like a cop out).
I forgot to mention that for peroformance reasons, the sounds I’m playing are streams, ultimately, I’m hoping to record everything into mp2/ogg (haven’t decided whcih format yet).
Thanks for your advice though, that’s food for thought..
perhaps there are some callbacks, or something I can invoke to check when all tracks are actually playing? I saw some stuff about using FMOD_SOFTWARE tracks, and also about the lockdsp..
I’ve got a lot to learn!!!
- infrid answered 11 years ago
Please login first to submit.