Retrieves the settings of a recording input source.
Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
[DllImportAttribute("bass")] public static int BASS_RecordGetInput( int input, ref float volume )
Parameters
- input
- Type: SystemInt32
The input to get the settings of... 0 = first, -1 = master. - volume
- Type: SystemSingle
Reference to a variable to receive the current volume.
Return Value
Type: Int32If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code. If successful, then the settings are returned. The BASS_INPUT_OFF flag will be set if the input is disabled, otherwise the input is enabled. The type of input (see BASSInputType) is also indicated in the high 8-bits (use BASS_INPUT_TYPE_MASK to test) of the return value, and can be one of the following. If the volume is requested but not available, volume will receive -1.
BASS_INPUT_TYPE_DIGITAL | Digital input source, for example, a DAT or audio CD. |
BASS_INPUT_TYPE_LINE | Line-in. On some devices, "Line-in" may be combined with other analog sources into a single BASS_INPUT_TYPE_ANALOG input. |
BASS_INPUT_TYPE_MIC | Microphone. |
BASS_INPUT_TYPE_SYNTH | Internal MIDI synthesizer. |
BASS_INPUT_TYPE_CD | Analog audio CD. |
BASS_INPUT_TYPE_PHONE | Telephone. |
BASS_INPUT_TYPE_SPEAKER | PC speaker. |
BASS_INPUT_TYPE_WAVE | The device's WAVE/PCM output. |
BASS_INPUT_TYPE_AUX | Auxiliary. Like "Line-in", "Aux" may be combined with other analog sources into a single BASS_INPUT_TYPE_ANALOG input on some devices. |
BASS_INPUT_TYPE_ANALOG | Analog, typically a mix of all analog sources. |
BASS_INPUT_TYPE_UNDEF | Anything that is not covered by the other types. |
Remarks
ERROR CODE | Description |
---|---|
BASS_ERROR_INIT | BASS_RecordInit(Int32) has not been successfully called - there are no initialized. |
BASS_ERROR_ILLPARAM | input is invalid. |
BASS_ERROR_NOTAVAIL | A master input is not available. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Platform-specific
The input type information is only available on Windows. There is no "what you hear" type of input defined; if the device has one, it will typically come under BASS_INPUT_TYPE_ANALOG or BASS_INPUT_TYPE_UNDEF.
On OSX, there is no master input (-1), and only the currently enabled input has its volume setting available (if it has a volume control).
Examples
Bass.BASS_RecordInit(-1); // init the default device string name; for (int n = 0; (name = Bass.BASS_RecordGetInputName(n)) != null; n++) { float vol = 0f; int setting = Bass.BASS_RecordGetInput(n, ref vol); Console.WriteLine("{0} [{1} : {2}] - {3}", name, (BASSInputType)((int)BASSInputType.BASS_INPUT_TYPE_MASK & setting), vol, ((int)BASSInput.BASS_INPUT_OFF & setting) != 0 ? "Off" : "On"); }
Bass.BASS_RecordInit(-1); int mic = -1; int n = 0; int settings = 0; float vol = 0f; while (settings != -1) { // get the settings of that input settings = Bass.BASS_RecordGetInput(n, ref vol); if ( (settings & (int)BASSInputType.BASS_INPUT_TYPE_MASK) == (int)BASSInputType.BASS_INPUT_TYPE_MIC ) { // found the mic! mic = n; break; } n++; } if (mic != -1) Console.WriteLine( "Found a MIC at input {0}", mic ); else Console.WriteLine( "No MIC found!" );
See Also