Re: QuickTime and CoreAudio (again)
Re: QuickTime and CoreAudio (again)
- Subject: Re: QuickTime and CoreAudio (again)
- From: Arthur Clemens <email@hidden>
- Date: Fri, 26 Jul 2002 15:29:27 +0200
- Resent-date: Fri, 26 Jul 2002 18:14:19 +0200
- Resent-from: Arthur Clemens <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: <email@hidden>
I am using the ring buffer code, too.
In the function fillSoundConverterBuffer you get at some point:
currentMediaTime = sourceReturnedTime + (durationPerSample *
numberOfSamples);
then I can get the percentage played:
{
float l = (float)(1.0 / mediaDuration) * currentMediaTime;
printf("perc: %f\n", l);
}
As output I get:
perc: 0.003649
perc: 0.007298
perc: 0.010947
perc: 0.014595
perc: 0.018244
perc: 0.021893
perc: 0.025542
perc: 0.029191
perc: 0.032840
perc: 0.036488
perc: 0.040137
perc: 0.043786
perc: 0.047435
perc: 0.051084
perc: 0.054733
To me that is fine enough. I am using a buffer size of (64 * 1024).
Arthur
On Friday, July 26, 2002, at 02:59 PM, Lieven Dekeyser wrote:
Hi!
I'm trying to play audio using the QuickTime SoundConverter sending the
output to an AudioUnit's input callback. This works fine thanks to some
sample code you guys posted here (ringbuffer stuff etc), but now I'm
trying to show the current movie time to the user (with a slider), and I
bumped into the following problem: I can't find a way to indicate at
which
point in the movie the AudioUnit currently is playing. I can show the
converter's current time, but that results in a not so smooth
progression
because of the size of the conversion buffer. I can't lower the buffer
size, because that would result in skipping sound...
Any ideas?
this is what I'd like:
@interface QTSoundPlayer
{
// ...
}
// installs an input callback which sends the converted samples to unit
- (void)connectToInput:(int)input ofAudioUnit:(AudioUnit)unit;
- (Movie)movie;
- (void)setMovie:(Movie)mov;
// the usual QuickTime stuff
- (void)play;
- (void)pause;
- (void)goToBeginningOfMovie;
- (UInt32)duration;
- (UInt32)currentTime; // should be smooth
- (UInt32)timeScale;
@end
I guess this is a fairly common thing, so there must be somebody out
there
that has allready written something similar, no?
thanks,
--Lieven
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.