Closed admsyn closed 10 years ago
Can setting a position in the audio track (in ms or samples) be added to this issue?
Sure can :)
The implementation for this is more tricky than it'd seem at first. There's some low level concerns RE: host times and scheduled play back times and sample frame times and blah blah blah to be navigated, which is proving to be a bit tricky.
I've got the gist of it working on this branch (fileplayer-pause-resume). It seems to work just fine for the initial pause / resume, but subsequent attempts end up resuming at the wrong point in the file. This post on the core audio mailing list makes it sound like that's more-or-less expected behaviour, since it sounds like the code needs to take the host time into account when setting the kAudioUnitProperty_ScheduledFileRegion
property, and apply the timestamp.mSampleTime
offset to that.
Or something.
Audio Units, man.
Also, pinging @sebleedelisle :)
If you were waiting on file player pause / resume, there's an initial implementation in the fileplayer-pause-resume branch, though it stumbles on multiple pause / resumes due to the issues I mentioned in the post up there ^
I'm certainly open to someone taking a stab at the last mile here, as it's probably just a one-liner that needs to be taken into account when setting the playhead in play()
. It might also have something to do with using kAudioTimeStampSampleTimeValid
instead of kAudioTimeStampHostTimeValid
like I am now
Hey, I'm in final stretch of SfPC so I doubt I'll have the time to take a stab before December, but keep the updates coming, and I'll dive in when a moment arises.
Ah cool thanks for letting me know. I'll take a look next time I start to update the audio playback system in PixelPyros. Thanks!
Can setting a position in the audio track (in ms or samples) be added to this issue? I'd be glad to help if you could point me at some good examples/resources. Thanks