ADC Home > Reference Library > Technical Q&As > QuickTime > Movie Creation >

Setting Sequence Grabber Sound Input Device Driver Parameters


Q: We are using the Sequence Grabber to capture audio from a microphone and save it to a QuickTime movie. However, we are not able to control the volume level of the microphone. Calling the SGSetChannelVolume function has no effect whatsoever. How do we go about setting the volume for the microphone?

A: You'll need to first use the SGGetSoundInputDriver function to find the sound input driver that is being used by the Sequence Grabber for the selected sound input device (microphone), and then set the input gain parameter (not the volume) for the device using the Sound Manager SPBSetDeviceInfo function.

The SGSetChannelVolume function will only affect the volume setting during playback - it will not affect the record level or the volume of the track in the recorded movie.

Listing 1 below shows how this is done.

long sndInputDriverRef;


sndInputDriverRef = SGGetSoundInputDriver(yourSoundChannel);
if (sndInputDriverRef != 0)
{
    OSErr result;
    Fixed newGainValue = Long2Fix(1.5);     /* input gain may range from 0.5 - 1.5 */
    result = SPBSetDeviceInfo(sndInputDriverRef,
                              siInputGain,
                              (void *)newGainValue);
}

Listing 1. Setting the input gain value


Note that in the future, QuickTime on Mac OS X will move away from using the Sound Manager and will instead use Core Audio. When this happens, there will be a new API for manipulating Core Audio parameters. Therefore, it's important you check the error code (0 result) above when calling the SGGetSoundInputDriver function.

Note also the recent QuickTime 6.0.2 update fixes a bug in the Sound Driver which will cause certain hardware to report itself as "not being connected" which will in turn give you a 0 result from SGGetSoundInputDriver. Be aware of this problem, because you may see it if your code is run on a system without the QuickTime 6.0.2 update. If you do, you will of course not be able to perform recording with the Sequence Grabber either.

 


[Oct 25 2002]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.