BASS

BASS_RecordGetInput


Retrieves the current settings of a recording input source.

DWORD BASS_RecordGetInput(
    int input,
    float *volume
);

Parameters

inputThe input to get the settings of... 0 = first, -1 = master.
volumePointer to a variable to receive the volume... NULL = don't retrieve the volume.

Return value

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 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.

Error codes

BASS_ERROR_INITBASS_RecordInit has not been successfully called.
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).

Example

List all available input sources, with their current status.
int n;
char *name;
for (n=0; name=BASS_RecordGetInputName(n); n++) {
    float vol;
    int s=BASS_RecordGetInput(n, &vol;);
    printf("%s [%s : %g]\n", name, s&BASS;_INPUT_OFF?"off":"on", vol);
}

Find a microphone input.

int mic=-1, n, flags;
for (n=0; (flags=BASS_RecordGetInput(n, NULL))!=-1; n++) {
    if ((flags&BASS;_INPUT_TYPE_MASK)==BASS_INPUT_TYPE_MIC) { // found the mic!
        mic=n;
        break;
    }
}
if (mic!=-1) printf("Found a microphone at input %d\n", mic);
else printf("No microphone found\n");

See also

BASS_RecordGetInfo, BASS_RecordGetInputName, BASS_RecordSetInput