Skip to content

[MIDIPlay] Add option to switch different audio backends #312

Description

@WUGqnwvMQPzl

Since commit acd361e, the midi play utility adds audio backend for ALSA, though it also disables SDL audio backend for unix systems.

In typical Linux desktop setup, most users don't use bare ALSA for audio, but paired with PulseAudio or Pipewire, which blocks lower level PCM devices, results adlmidiplay couldn't play the midi and exits:

%  adlmidiplay CANYON.MID 
==========================================
         libADLMIDI demo utility
==========================================

 - Library version 1.6.2
 - Nuked OPL3 (v 1.8) Emulator in use
 - Number of chips 4
 - Number of four-ops 0
 - Track count: 1
 - Volume model: Audio Interface Library (AIL)
 - Channel allocation mode: <auto>
 - Gain level: 2
 - Automatic arpeggio is turned OFF
 - File [CANYON.MID] opened!
 - Loop is turned ON

==========================================
Playing... Hit Ctrl+C to quit!

ERROR: Couldn't open audio: ALSA ERROR: Can't open "default" PCM device. Device or resource busy

currently a workaround is install ALSA configuration package for PulseAudio or Pipewire, and pass ALSAPCM=pulse or ALSAPCM=pipewire environment variable to adlmidiplay.

But the SDL audio backend, to me, it just works, and I like to have an option to switch different audio backends, and have ability to fallback to other working audio backend, if possible.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions