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 4187

Summary: No option to use 'record' from pulseaudio monitor sources
Product: SDL Reporter: Matthew <matthew>
Component: audioAssignee: Ryan C. Gordon <icculus>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: mischa
Version: 2.0.8   
Hardware: x86_64   
OS: Linux   

Description Matthew 2018-06-05 23:42:14 UTC
I've been trying to figure out how get the projectm-sdl example to capture music output (not just microphones).  Finally realized that SDL was explicitly dropping the monitor sources.  

SDL/src/audio/pulseaudio/SDL_pulseaudio.c in SourceInfoCallback()

Would it be possible to either make new driver or use an env variable to enable these source?  e.g.

+
+int include_monitor_sinks = -1;
+
 /* This is called when PulseAudio adds a capture ("source") device. */
 static void
 SourceInfoCallback(pa_context *c, const pa_source_info *i, int is_last, void *data)
 {
+    if (include_monitor_sinks == -1) {
+        const char *option = SDL_getenv("SDL_PULSEAUDIO_INCLUDE_MONITORS");    
+        include_monitor_sinks = (NULL != option && 0==strcmp(option,"true"));
+    }
+
     if (i) {
-        /* Skip "monitor" sources. These are just output from other sinks. */
-        if (i->monitor_of_sink == PA_INVALID_INDEX) {
+        if (include_monitor_sinks || i->monitor_of_sink == PA_INVALID_INDEX) {
             SDL_AddAudioDevice(SDL_TRUE, i->description, (void *) ((size_t) i->index+1));
         }
     }
Comment 1 cyber 2020-07-25 18:35:22 UTC
Upvoting! Need audio capture for music visualization software.