We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4184

Summary: [PATCH] jack audio driver fails in presence of midi ports
Product: SDL Reporter: Martin Širokov <shirokovMartin+SDL>
Component: audioAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: All   
Attachments: fix jack audio driver

Description Martin Širokov 2018-06-01 11:06:28 UTC
Created attachment 3254 [details]
fix jack audio driver

Launching an SDL application with SDL_AUDIODRIVER=jack, and then calling SDL_OpenAudioDevice() with whatever parameters fails with an error like this one:

SDL_OpenAudioDevice: Couldn't connect JACK ports: SDL:sdl_jack_output_0 => system:midi_playback_1

This happens because JACK_OpenDevice in src/audio/jack/SDL_jackaudio.c blindly tries to connect to all input ports without checking whether they are for audio or midi.

The fix is to check port types and ignore all non audio ports. Also I removed devports field from struct SDL_PrivateAudioData, because it's never really used and removing unused ports from it would be PITA.
Comment 1 Sam Lantinga 2018-06-02 02:44:18 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/94f3f018d3eb