Re: Mute/Unmute audio device
Re: Mute/Unmute audio device
- Subject: Re: Mute/Unmute audio device
- From: Jean-Daniel Dupas <email@hidden>
- Date: Thu, 12 Nov 2009 10:46:44 +0100
Yes, or use the kAudioDevicePropertyMute property.
Le 12 nov. 2009 à 10:27, email@hidden a écrit :
> you could set the volume to 0.0 to mute and just store the state elsewhere for the unmute...
>
> volume is at 0.7
> call mute
> mute stores 0.7
> set volume 0.0
> call unmute
> unmute sets volume to 0.7 (from stored value)
>
>
> On , Symadept <email@hidden> wrote:
> > Hi,
> >
> > I am using core audio to Set/Get the Audio device volume. With reference to the following code
> >
> >
> > + (float)volume:(NSString*)deviceName isInput:(BOOL)isInput{
> >
> > float b_vol;
> >
> > OSStatus err;
> >
> > UInt32 size;
> >
> > UInt32 channels[2];
> >
> > float volume[2];
> >
> >
> >
> > AudioDeviceID device = [AudioUtils DeviceIdFor:deviceName isInput:isInput];
> >
> > NSLog(@"Device:[%x] IsInput:[%d]", device, isInput);
> > //Assume here I am getting the device id of the devices with the specific name.
> >
> >
> >
> > // try set master volume (channel 0)
> > size = sizeof( b_vol);
> > err = AudioDeviceGetProperty(device, 0, isInput, kAudioDevicePropertyVolumeScalar, &size, &b_vol);
> >
> > NSLog(@"Volume:[%f]", b_vol);
> >
> > if(noErr==err) return b_vol;
> >
> >
> > // otherwise, try seperate channels
> > // get channel numbers
> > size = sizeof(channels);
> > err = AudioDeviceGetProperty(device, 0, isInput,kAudioDevicePropertyPreferredChannelsForStereo, &size,&channels);
> >
> > if(err!=noErr) NSLog(@"error getting channel-numbers");
> >
> >
> > size = sizeof(float);
> >
> > err = AudioDeviceGetProperty(device, channels[0], isInput, kAudioDevicePropertyVolumeScalar, &size, &volume[0]);
> >
> > if(noErr!=err) NSLog(@"error getting volume of channel %d",channels[0]);
> >
> > err = AudioDeviceGetProperty(device, channels[1], isInput, kAudioDevicePropertyVolumeScalar, &size, &volume[1]);
> >
> > if(noErr!=err) NSLog(@"error getting volume of channel %d",channels[1]);
> >
> >
> > b_vol = (volume[0]+volume[1])/2.00;
> >
> > NSLog(@"Volumes:V1[%f] V2[%f] Final:[%f]", volume[0], volume[1], b_vol);
> >
> >
> > return b_vol;
> > }
> >
> > This code works fine for getting volume. Similarly can I set the audio device to Mute/Unmute.
> >
> >
> >
> > Any pointers highly appreciable.
> > Regards
> > Mustafa
> >
> >
> >
> > On Thu, Nov 12, 2009 at 12:58 PM, email@hidden> wrote:
> >
> > which technology are you asking about?
> >
> >
> > On Nov 12, 2009 2:47pm, Symadept email@hidden> wrote:
> > > Hi,
> > >
> >
> > > How to Mute/Unmute audio device.
> > >
> > > Regards
> > > Mustafa
> > >
> >
> >
> >
> >
> > _______________________________________________
> 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
-- Jean-Daniel
_______________________________________________
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