---
name: "detect_midi_driver"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/detect_midi_driver/3alleg4"
---

# detect\_midi\_driver(3alleg4)

Detects whether the specified MIDI sound device is available. Allegro game programming library.

## NAME

detect\_midi\_driver - Detects whether the specified MIDI sound device is available. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**int detect\_midi\_driver(int driver\_id);**

## DESCRIPTION

Detects whether the specified MIDI sound device is available. This function must be called \_before\_ install\_sound().

## RETURN VALUE

Returns the maximum number of voices that the driver can provide, or zero if the hardware is not present.

There are two special-case return values that you should watch out for: if this function returns -1 it is a note-stealing driver (eg. DIGMID) that shares voices with the current digital sound driver, and if it returns 0xFFFF it is an external device like an MPU-401 where there is no way to determine how many voices are available.

## SEE ALSO

**install\_sound**(3alleg4), **reserve\_voices**(3alleg4)
