ADC Home > Reference Library > Technical Q&As > Audio > Carbon >
Important: The information in this document is Not Recommended and should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Q How do I use the new siOSTypeInputSource
and siOSTypeInputAvailable selectors?A The siOSTypeInputSource selector
works just like the siInputSource
selector. It works with both SPBGetDeviceInfo
and SPBSetDeviceInfo . To use it, pass
a pointer to an OSType for the input
source you wish to select. For example:
inputSource = kCDSource; err = SPBSetDeviceInfo (soundRefNum, siOSTypeInputSource, &inputSource); or pass a pointer to an OSType inputSource; err = SPBGetDeviceInfo (soundRefNum, siOSTypeInputSource, &inputSource); The Here is a simple example of how to walk the returned handle
extracting each SErr GetSoundInputSourceOSTypes (long siRefNum) { OSErr err; SoundInfoList sourceTypes; long offset = 0; short numTypes; int i; char sourceType[5]; Handle OSTypes = nil; err = SPBGetDeviceInfo (siRefNum, siOSTypeInputAvailable, &sourceTypes); if (err != noErr) { printf ("\nGot error #%d from siOSTypeInputAvailable\n\n", err); } if (err == noErr) { printf ("\nThe sound input source OSTypes are:\n"); numTypes = sourceTypes.count; OSTypes = sourceTypes.infoHandle; for (i = 0; i < numTypes; i++) { BlockMoveData (&(*OSTypes)[offset], sourceType, 4); sourceType[4] = 0; printf (" %s\n", sourceType); offset += sizeof (OSType); } } if (OSTypes != nil) { DisposeHandle (OSTypes); } return err; } The input source constants are defined in Universal Headers 3.1 and later. Here are the currently defined constants: /* input source Types*/ enum { kNoSource = FOUR_CHAR_CODE('none'), /*no source selection*/ kCDSource = FOUR_CHAR_CODE('cd '), /*internal CD player input*/ kExtMicSource = FOUR_CHAR_CODE('emic'), /*external mic input*/ kRCAInSource = FOUR_CHAR_CODE('irca'), /*RCA jack input*/ kTVFMTunerSource = FOUR_CHAR_CODE('tvfm'), kDAVInSource = FOUR_CHAR_CODE('idav'), /*DAV analog input*/ kIntMicSource = FOUR_CHAR_CODE('imic'), /*internal mic input*/ kMediaBaySource = FOUR_CHAR_CODE('mbay'), /*media bay input*/ kModemSource = FOUR_CHAR_CODE('modm'), /*modem input*/ kZoomVideoSource = FOUR_CHAR_CODE('zvpc') /*zoom video input*/ }; siOSTypeInputSource = FOUR_CHAR_CODE('inpt'), /*input source by OSType*/ siOSTypeInputAvailable = FOUR_CHAR_CODE('inav'), /*list of available input source OSTypes*/ [Apr 12 1998] |
|