AAE 1.5 AEAudioPlayer latency
After upgrading to AAE 1.5 I'm getting latency when moving to a new position in the audio (forwards and backwards). 1.4.8 didn't have this issue and I haven't changed anything in my app. I have noticed that the memory usage is dramatically reduced so I'm guessing the audio file is no longer loaded into memory. Is it possible to skip to a position in the audio without delay or possible to force the entire song into memory?
Comments
If you need in-memory playback, try the new AEMemoryBufferPlayer class I just added.
Awesome. Thanks Michael!
Is there going to be a new pod release with this change?
Yup, I just don't want to rush a release without a little due diligence testing. If you'd like to help, I'd love some feedback on it, whether it's all working correctly.
I haven't managed to get it working yet. Do you have an example of how to use AEMemoryBufferPlayer?
Do I need to load the entire file into an audioBufferList and if so, how? I think I have the audioDescription right.
Nope, you just need to use the factory initialiser and it'll load the file for you. http://theamazingaudioengine.com/doc/interface_a_e_memory_buffer_player.html#a74a20507c772437142c012437da71b64
Ahh right. I totally missed that initialiser.
I've not got it kinda working, however I have two files I'm trying to load (a left and right channel). Its seems that the second file gets corrupt when it loads. Its output is static. The first file always plays fine as I've tried swapping my loading order.
Sure, a pull request would be cool, @mgill404!
@launch: Would you hook me up with a little sample app?
I've created a test project and added two of the files my app generates. It sometimes plays audio.. most of the time its crashing: https://www.dropbox.com/s/vipc4fk5v5ss931/testAAE.zip?dl=0
Ah! Thanks for that - you were using it in a way that I'd (stupidly) not anticipated, with an AudioStreamBasicDescription != the AEAudioController's audioDescription. I've just committed a change which will facilitate that kind of usage, and the sample no longer crashes.
ahhh, that might be me not knowing what I'm doing.
Should I just use self.audioController.audioDescription instead of my own audioDescription?
Thanks thats working well.
No no, it's totally a valid use case. But if it doesn't specifically matter to you (e.g. you're not directly interacting with the frames coming out of the player), it's most efficient to use AEAudioController's audioDescription so that it doesn't have to run a converter.
Thanks. One last question.. is there a way to cancel the loading before its completed?
Not with the built-in factory method, but you could take a look at the implementation and make your own version.
I need this memory-saving feature, cause I use large/long audiofiles in parallel. (With older iPods and iPhone 4S my app does not work due to memory problems, plus the audio-file-loading takes long ) The title of your post says "AEAudioPlayer" but is there such a class ? @launch, Which player exactly did you use at that time?
Or what do you recommend in my case?
Hi @Bergerac, I ended up switching audio engines to superpowered as it solved all my issues.
I'll have a look. But for now it's easier to stick to TAAE. Which player did you use where you realised " the memory usage is dramatically reduced" ?
Thanks for responding!
It was using TAAE once I implemented the AEMemoryBufferPlayer class.