Changeset View
Changeset View
Standalone View
Standalone View
src/source.cpp
Show All 16 Lines | 1 | /* | |||
---|---|---|---|---|---|
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "source.h" | 21 | #include "source.h" | ||
22 | 22 | | |||
23 | #include "context.h" | 23 | #include "context.h" | ||
24 | #include "server.h" | 24 | #include "server.h" | ||
25 | #include "sourceoutput.h" | ||||
25 | 26 | | |||
26 | namespace QPulseAudio | 27 | namespace QPulseAudio | ||
27 | { | 28 | { | ||
28 | 29 | | |||
29 | Source::Source(QObject *parent) | 30 | Source::Source(QObject *parent) | ||
30 | : Device(parent) | 31 | : Device(parent) | ||
31 | { | 32 | { | ||
32 | connect(context()->server(), &Server::defaultSourceChanged, this, &Source::defaultChanged); | 33 | connect(context()->server(), &Server::defaultSourceChanged, this, &Source::defaultChanged); | ||
Show All 36 Lines | |||||
69 | 70 | | |||
70 | void Source::setDefault(bool enable) | 71 | void Source::setDefault(bool enable) | ||
71 | { | 72 | { | ||
72 | if (!isDefault() && enable) { | 73 | if (!isDefault() && enable) { | ||
73 | context()->server()->setDefaultSource(this); | 74 | context()->server()->setDefaultSource(this); | ||
74 | } | 75 | } | ||
75 | } | 76 | } | ||
76 | 77 | | |||
78 | void Source::switchStreams() | ||||
79 | { | ||||
80 | auto data = context()->sourceOutputs().data(); | ||||
81 | std::for_each(data.begin(), data.end(), [this](SourceOutput* paObj) { | ||||
82 | paObj->setDeviceIndex(m_index); | ||||
83 | }); | ||||
84 | } | ||||
85 | | ||||
77 | } // QPulseAudio | 86 | } // QPulseAudio |