BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_RecordGetInput Method (Int32, Single)BASS.NET API for the Un4seen BASS Audio Library
Retrieves the settings of a recording input source.

Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

[DllImportAttribute("bass.dll", CharSet = CharSet.Unicode)]
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: Int32
If 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_DIGITALDigital input source, for example, a DAT or audio CD.
BASS_INPUT_TYPE_LINELine-in. On some devices, "Line-in" may be combined with other analog sources into a single BASS_INPUT_TYPE_ANALOG input.
BASS_INPUT_TYPE_MICMicrophone.
BASS_INPUT_TYPE_SYNTHInternal MIDI synthesizer.
BASS_INPUT_TYPE_CDAnalog audio CD.
BASS_INPUT_TYPE_PHONETelephone.
BASS_INPUT_TYPE_SPEAKERPC speaker.
BASS_INPUT_TYPE_WAVEThe device's WAVE/PCM output.
BASS_INPUT_TYPE_AUXAuxiliary. 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_ANALOGAnalog, typically a mix of all analog sources.
BASS_INPUT_TYPE_UNDEFAnything that is not covered by the other types.
Remarks

ERROR CODEDescription
BASS_ERROR_INITBASS_RecordInit(Int32) has not been successfully called - there are no initialized.
BASS_ERROR_ILLPARAMinput is invalid.
BASS_ERROR_NOTAVAILA master input is not available.
BASS_ERROR_UNKNOWNSome 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

List all available input sources, with their current status:
VB
Bass.BASS_RecordInit(-1) ' init the default device
Dim n As Integer = 0
Dim name As String = ""
While Not (name Is Nothing)
  name = Bass.BASS_RecordGetInputName(n)
  n += 1
  If Not (name Is Nothing) Then
    Dim vol As Single = 0F
    Dim setting As Integer = Bass.BASS_RecordGetInput(n, vol)
    Console.WriteLine("{0} [{1} : {2}] - {3}", 
                      name, 
                      CType(CInt(BASSInputType.BASS_INPUT_TYPE_MASK) And setting, BASSInputType), 
                      vol,
                      CStr(IIf(CInt(BASSInput.BASS_INPUT_OFF) And setting <> 0, "Off", "On")))
  End If
End While
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");
}
Find a microphone input:
VB
Bass.BASS_RecordInit(-1)
Dim mic As Integer = -1
Dim n As Integer = 0
Dim settings As Integer = 0
Dim vol As Single = 0F
While settings <> -1
  ' get the settings of that input
  settings = Bass.BASS_RecordGetInput(n, vol)
  If (settings And CInt(BASSInputType.BASS_INPUT_TYPE_MASK)) = CInt(BASSInputType.BASS_INPUT_TYPE_MIC) Then
    ' found the mic!
    mic = n
    Exit While
  End If
  n += 1
End While
If mic <> -1 Then
  Console.WriteLine("Found a MIC at input {0}", mic)
Else
  Console.WriteLine("No MIC found!")
End If
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

Reference