Allegro provides routines to capture sound from the sound card, be it digital samples or MIDI notes. Ideally this would allow you to create games where basic speech recognition could be implemented, or voice messages in multiplayer games over a network. However, many old sound cards are not full duplex. This means, that the sound device can only be playing or recording, but not both at the same time.
Any Windows 2000 or better machine comes with a full duplex sound card and updated drivers. All MacOS X machines allow full duplex recording. Under Unix your mileage may vary: you can have the right hardware for the task, but the drivers might not support this feature. Under DOS you should forget about full duplex altogether.
To find out if your system allows this feature, use the akaitest program, distributed along with Allegro, in the `tests' directory.
Return value: This function returns zero on success, and any other value if the machine or driver doesn't support sound recording.
See also: install_sound, start_sound_input, midi_recorder, Standard config variables, DIGI_*/DOS, DIGI_*/Windows, DIGI_*/Unix, DIGI_*/BeOS, DIGI_*/QNX, DIGI_*/MacOSX, MIDI_*/DOS, MIDI_*/Windows, MIDI_*/Unix, MIDI_*/BeOS, MIDI_*/QNX, MIDI_*/MacOSX.
See also: install_sound_input, remove_sound, allegro_exit.
Example:0 = audio input not supported 8 = eight bit audio input is supported 16 = sixteen bit audio input is supported 24 = both eight and sixteen bit audio input are supported
cap = get_sound_input_cap_bits(); if (cap == 0) { /* Ugh, no audio input supported? */ } else { if (cap & 8) { /* We have eight bit audio input. */ } if (cap & 16) { /* We have sixteen bit audio input. */ } }
See also: start_sound_input, get_sound_input_cap_parm, get_sound_input_cap_rate, get_sound_input_cap_stereo.
Return value: Returns non-zero if the driver is capable of stereo recording.
See also: start_sound_input, get_sound_input_cap_parm, get_sound_input_cap_bits, get_sound_input_cap_rate.
int max_freq; ... /* What frequency can we record 8 bits mono at? */ max_freq = get_sound_input_cap_rate(8, 0); if (max_freq > 22000) { /* Ok, 22KHz and above is good enough. */ }
See also: start_sound_input, get_sound_input_cap_parm, get_sound_input_cap_bits, get_sound_input_cap_stereo.
Return value: The function returns one of the following possible values:
0 = It is impossible to record in this format. 1 = Recording is possible, but audio output will be suspended. 2 = Recording is possible at the same time as playing other sounds (full duplex sound card). -n = Sampling rate not supported, but rate 'n' would work instead.
See also: start_sound_input, get_sound_input_cap_bits, get_sound_input_cap_rate, get_sound_input_cap_stereo.
SOUND_INPUT_MIC SOUND_INPUT_LINE SOUND_INPUT_CD
Return value: The function returns zero on success, or -1 if the hardware does not provide an input select register (ie. you have no control over the input source).
See also: start_sound_input.
Return value: Returns the buffer size in bytes if successful, or zero on error.
See also: install_sound_input, read_sound_input, stop_sound_input, digi_recorder, set_sound_input_source, get_sound_input_cap_parm, get_sound_input_cap_bits, get_sound_input_cap_rate, get_sound_input_cap_stereo.
See also: start_sound_input.
Note: many cards produce a click or popping sound when switching between record and playback modes, so it is often a good idea to discard the first buffer after you start a recording. The waveform is always stored in unsigned format, with stereo data consisting of alternate left/right samples.
Return value: The function will return non-zero if a buffer has been copied or zero if no new data is yet available (you were too fast checking the input).
See also: start_sound_input.
See also: install_sound_input, start_sound_input.
See also: install_sound_input, midi_out.