ios - Redirection playback output of avplayer item -
what want take output samples of avasset corresponding audio file (no video involved) , send them audio effect class takes in block of samples, , want able in real time.
i looking @ avfoundation class reference , programming guide, can't see way of redirect output of player item , send effect class, , there, send transformed samples audio output (using avassetreaderaudiomixoutput?) , hear there. see avassetreader class gives me way block of samples using
[myavassetreader addoutput:myavassetreadertrackoutput]; [myavassetreadertrackoutput copynextsamplebuffer];
but apple documentation specifies avassetreader class not made , should not used real-time situations. have suggestion on look, or if having right approach?
the mtaudioprocessingtap perfect this. leveraging avplayer, can avoid having block samples avassetreaderoutput , render them in audio queue or audio unit.
instead, attach mtaudioprocessingtap inputparameters of avasset's audiomix, , you'll given samples in blocks easy throw effect unit.
another benefit work avassets derived urls can't opened other apple apis (like audio file services), such user's ipod library. additionally, of functionality tolerance of audio interruptions avplayer provides free, otherwise have implement hand if went avassetreader solution.
to set tap have set callbacks system invokes appropriate during playback. full code such processing can found @ this tutorial here.
Comments
Post a Comment