• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
About USB Audio Device's Volume
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About USB Audio Device's Volume


  • Subject: About USB Audio Device's Volume
  • From: "aizhimin" <email@hidden>
  • Date: Fri, 2 Dec 2005 09:04:57 +0800

Hi, listers:
   
    There is a USB audio device be pluged in Mac Mini(Mac OSX), and The system recognised this device with "Input/Output Name: Generic USB Audio Device". I want to control this device's volume, I wrote like this(In X-code, use Carbon):
 
//---------------------------------------------------------------------
 
 // Get & Set AudioDevice Output Volume
 ComponentDescription cdOutput = { kSoundOutputDeviceType, 0, 0, 0, 0 };
 
Component cOutput = 0;
 cOutput = FindNextComponent(cOutput, &cdOutput);
 Handle myName = NewHandleClear(128);
 GetComponentInfo(cOutput, &cdOutput, myName, nil, nil); // myName = "\0x16Generic USB Audio Device"
 
 long lOutputVolume = 0;
 ComponentResult cResult;
 ComponentInstance ciOutput = OpenComponent( cOutput );
 cResult = SoundComponentSetInfo( ciOutput, NULL, siHardwareVolume, 0x150015);// The Audio Device Output Volume was set to 0x150015 successfully
 CloseComponent( ciOutput );

 // Get AudioDevice Input Volume
 ComponentDescription cdInput = { kSoundInputDeviceType, 0, 0, 0, 0 };
 Component cInput = 0;
 cInput = FindNextComponent(cInput, &cdInput);
 GetComponentInfo(cInput, &cdInput, myName, nil, nil); // myName = "\DVUSB Audio Device"
 
 long lInputVolume = 0;
 ComponentInstance ciInput = OpenComponent( cInput );
 cResult = SoundComponentGetInfo(ciInput, NULL, siHardwareVolume, &lInputVolume);// Get Volume Error, Return By "cResult = -50"
 CloseComponent( ciInput );
 
//---------------------------------------------------
 
I don't know why I can't get the Input volume. Can you help me ? Any idea will be great help. Thanks a lot!
 _______________________________________________
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

  • Follow-Ups:
    • Re: About USB Audio Device's Volume
      • From: Jeff Moore <email@hidden>
  • Prev by Date: AUAudioFilePlayer cheat sheet
  • Next by Date: Re: About USB Audio Device's Volume
  • Previous by thread: Re: AudioDriver to User Application
  • Next by thread: Re: About USB Audio Device's Volume
  • Index(es):
    • Date
    • Thread