I am trying to include a VU meter in my application to display the
level of the audio coming in through the mic.
I went through wakedTV sample code and pulled what i think i need to
get it to work (see end of message) but when it is time to ask for
kQTSGAudioPropertyID_AveragePowerLevels i always get the error
kQTPropertyAskLaterErr. no matter how long i wait this is what i get.
Obviously, when i run wackedTV everything works fine:-)
Anybody has any idea of what is wrong or a sample code of how to do
this?
Thanks
- (void)setUpdateAudioLevelTimer:(NSTimer *)anUpdateAudioLevelTimer
{
//NSLog(@"in -setUpdateAudioLevelTimer:, old value of
updateAudioLevelTimer: %@, changed to: %@", updateAudioLevelTimer,
anUpdateAudioLevelTimer);
- (void)setVolumeLevelValue:(float)aVolumeLevelValue
{
//NSLog(@"in -setVolumeLevelValue, old value of volumeLevelValue: %
i, changed to: %i", volumeLevelValue, aVolumeLevelValue);
- (void)setSequenceGrabberAudio:(SGAudio *)aSequenceGrabberAudio
{
//NSLog(@"in -setSequenceGrabberAudio:, old value of
sequenceGrabberAudio: %@, changed to: %@", sequenceGrabberAudio,
aSequenceGrabberAudio);
for (int i = 0; i < size/sizeof(SInt32); i++)
{
if (mChannelNumber == map[i])
{
mMyIndex = i;
mLevelsArraySize = size; // SInt32 and Float32 are the
same size
mLevelsArray = (Float32*)malloc(mLevelsArraySize);
break;
}
}
free(map);
}
}
if (mLevelsArray) // paranoia
{
// get the avg power level
OSStatus error= [myAudi
getPropertyWithClass:kQTPropertyClass_SGAudioRecordDevice
id:kQTSGAudioPropertyID_AveragePowerLevels
size:mLevelsArraySize
address:mLevelsArray
sizeUsed:NULL];
if (noErr == error)
{
amps = mLevelsArray[mMyIndex];
}
}
@implementation recorderWindowController
(MTCoreAudioHardwarePropertyNotifications)
- (void) audioHardwareDeviceListDidChange
{
...
if ([devices count] 0)
{
//start the time to update the mic level indicator
//
[self setUpdateAudioLevelTimer: [NSTimer
scheduledTimerWithTimeInterval: 1./20
target: self
selector: @selector(updateLevelIndicator:)
userInfo: nil
r
epeats: YES]];
}
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-api/email@hidden