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

Progress value invalid for formats with indeterminate length #55

Closed
nfranke opened this issue Jan 3, 2014 · 1 comment
Closed

Progress value invalid for formats with indeterminate length #55

nfranke opened this issue Jan 3, 2014 · 1 comment

Comments

@nfranke
Copy link

nfranke commented Jan 3, 2014

If you try to play a file format for which the length cannot be calculated from the header, e.g. Sun AU, this call:

AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_AudioDataByteCount, &byteCountSize, &audioDataByteCount);

doesn't produce an error, but it does set audioDataByteCount to 0xffffffff (i.e. a 32-bit -1 converted unsigned to 64-bit.) This makes the progress bar invalid since it thinks the duration is incredibly large.

You can change audioDataByteCount to a UInt32 and you still get back the same value as a UInt32.

Although it's a bit of a hack, this fixes the problem:

        error = AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_AudioDataByteCount, &byteCountSize, &audioDataByteCount);

        if (!error && audioDataByteCount != 0xffffffff)
            currentlyReadingEntry->audioDataByteCount = audioDataByteCount;
@tumtumtum
Copy link
Owner

Will probably need to add a progress that's in seconds rather than percentage of the duration since that'll be impossible to get for these type of streams.

johnboiles added a commit to johnboiles/StreamingKit that referenced this issue Jan 21, 2014
This results in finer detail, more accurate progress information. Should fix tumtumtum#52 and possibly tumtumtum#55.
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

No branches or pull requests

2 participants