Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AEAudioFileStreamer class, which serves the same purpose as AEA… #163

Closed
wants to merge 3 commits into from

Conversation

jeremywhuff
Copy link

…udioFilePlayer, but it streams the audio data from disk instead of preloading it all into active memory.

Jeremy Huff added 3 commits July 28, 2015 16:09
…udioFilePlayer, but it streams the audio data from disk instead of preloading it all into active memory.
// MARK: Getters and Setters
-(NSTimeInterval)duration {
return (double)_lengthInFrames / (double)_audioDescription.mSampleRate;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration can be incorrect because _lengthInFrames will be zero until the channel is added to a controller.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the easiest fix is to move the _lengthInFrames calculation out of setupURL:error: and into the initializer.

I've never run into this issue because I always add a channel immediately after creating it. Then set channelIsPlaying (or call the play function on this class) when ready to play. Is there any reason not to add a channel immediately? Should there be a TAAE best practice regarding this?

@jeremywhuff
Copy link
Author

While I don't believe that setting of region.mStartFrame is done incorrectly, it appears that region.mFramesToPlay is set incorrectly when the audio controller's sample rate doesn't match the file's. Perhaps _lengthInFrames is calculated incorrectly in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants