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 - No option to use 'record' from pulseaudio monitor sources
Summary: No option to use 'record' from pulseaudio monitor sources
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 2.0.8
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-05 23:42 UTC by Matthew
Modified: 2020-07-25 18:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.