QT streams and AudioConverter questions
QT streams and AudioConverter questions
- Subject: QT streams and AudioConverter questions
- From: Ethan Funk <email@hidden>
- Date: Sat, 15 Jan 2005 19:14:00 -0700
First an announcement, then some questions:
I have been slowly working on getting multiple output devices working with my software. I know a bunch of folks have also been working on or wanting this too, so I figured I would share my approach with those interested even thought I am still developing the software. The program (audioengine) is a command line utility that plays audio files and input device audio through 8 players tied in to an 8 output bus mixer simulating a radio broadcast mixer (buses for cue, monitor, program audition). Input and output devices, are defined, players are loaded and controlled, and a master playlist is managed either directly from the command line or from a telnet session to the application on port 9550. The idea is for an external GUI application (the next version of AudioRack) to control it. At this stage, things are not documented well, but I do have the matrix mixer connected to MULTIPLE output devices, and this is what others here on the list might be interested in seeing. The project is open source (GPL) and can be found at http://studio475.com/audiorack/
ae-alpha.zip Please keep in mind that this is a work in progress!
General principle of operation for the multiple outputs:
One of the output devices are designated as MASTER. This output device will have the lowest latency. The MASTER device pulls on the MatrixMixer and associated AUs through a render callback that also takes the samples and stashes them in a ring buffer.
SLAVE output devices get there samples from this master output ring buffer during there render call backs, not from the MatrixMixer itself, with added latency of course since the samples will not be in sync. The SLAVE render will also insert or remove an extra sample here and there as required to keep the average latency between the MSATER filling timestamp and the SLAVE reading timestamp constant. This will compensate for any small clock error between the output devices, similar to Apples example code for input play thought. The main difference is I inset or remove the samples using a random dither approach so the location of the insert or remove in the render buffer is different each time render is called. The dither approach spreads the artifacts resulting from the interpolation/decimation all across the audio spectrum rather than having it be periodic... a.k.a. I could hear clicks in the Apple Approach. I also allow only one sample to be inserted or removed per render buffer. This limits the maximum clock error that can be kept in sync to around 1% (fine since most crystals have a frequency spec better than 100 ppm).
Now for the questions:
1. I am having trouble with an AudioConverter used in my recording code. I create the Converters, convert samples using AudioConverterFillComplexBuffer, stop it by letting the buffer run dry (it calls the callback five more times after even with zero samples returned) and all is well. Then I reset the AudioConverter and restart everything. AudioConverterFillComplexBuffer now returns error -50, just as if it had not been reset. It doesn't even try calling the callback to get samples. So I tried to destroy the converter and make a new one before restarting. Same thing. I'm confused!
2. Is there any example code for recording to an AAC file out there? I'm not sure how to configure the stream format.
3. I'm trying to use QT to play streaming media through core-audio. Currently I am using GetMediaSamples to play files. I can use the same approach to open a movie from a URL, only I get an error when I go to get samples using GetMediaSample from the movie. Is there some other way to get sample data from an RTSP or MP3 stream using quicktime?
4. Maybe slightly off subject: Reading AAC/mp4 meta data- QT GetUserData routines don't read it. Is it hidden in some other QT atom?
Thanks so much for the help.
Ethan...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden