MCPcopy Create free account
hub / github.com/Soundux/Soundux / getOutputs

Method getOutputs

src/ui/ui.cpp:782–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

780 }
781#if defined(__linux__)
782 std::vector<std::shared_ptr<IconRecordingApp>> Window::getOutputs()
783 {
784 //* The frontend only uses the stream name and should only show multiple streams that belong to one application
785 //* once. The backend (gPulse.getRecordingStreams()) will work with multiple instances, so we need to filter out
786 //* duplicates here.
787
788 std::vector<std::shared_ptr<IconRecordingApp>> uniqueStreams;
789
790 if (Globals::gAudioBackend)
791 {
792 auto streams = Globals::gAudioBackend->getRecordingApps();
793 for (auto &stream : streams)
794 {
795 auto item = std::find_if(std::begin(uniqueStreams), std::end(uniqueStreams),
796 [&](const auto &_stream) { return stream->name == _stream->name; });
797 if (stream && item == std::end(uniqueStreams))
798 {
799 auto iconStream = std::make_shared<IconRecordingApp>(*stream);
800 if (Globals::gIcons)
801 {
802 if (auto pulseApp = std::dynamic_pointer_cast<PulseRecordingApp>(stream); pulseApp)
803 {
804 auto icon = Soundux::Globals::gIcons->getIcon(static_cast<int>(pulseApp->pid));
805 if (icon)
806 {
807 iconStream->appIcon = *icon;
808 }
809 }
810 else if (auto pipeWireApp = std::dynamic_pointer_cast<PipeWireRecordingApp>(stream);
811 pipeWireApp)
812 {
813 auto icon = Soundux::Globals::gIcons->getIcon(static_cast<int>(pipeWireApp->pid));
814 if (icon)
815 {
816 iconStream->appIcon = *icon;
817 }
818 }
819 }
820
821 uniqueStreams.emplace_back(iconStream);
822 }
823 }
824 }
825
826 return uniqueStreams;
827 }
828 std::vector<std::shared_ptr<IconPlaybackApp>> Window::getPlayback()
829 {
830 std::vector<std::shared_ptr<IconPlaybackApp>> uniqueStreams;

Callers

nothing calls this directly

Calls 3

getIconMethod · 0.80
getAudioDevicesMethod · 0.80
getRecordingAppsMethod · 0.45

Tested by

no test coverage detected