summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bf22453..adf515b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -70,35 +70,37 @@ static void updateActiveOutput()
printf(".--------------------------------------------.\n");
for (auto *sink : i->sinks()) {
- QString cardName = sink->cardIndex() < cards.size() ? cards.at(sink->cardIndex())->name() : QString();
+ PulseAudioQt::Card *card = nullptr;
+ if (sink->cardIndex() < cards.size()) {
+ card = cards.at(sink->cardIndex());
+ }
int portIndex = -1;
for (auto *port : sink->ports()) {
portIndex++;
//if (port->availability() == PulseAudioQt::Port::Unavailable)
// continue;
- bool active = (sink->isDefault() && portIndex == sink->activePortIndex());
+ bool portIsActive = portIndex == sink->activePortIndex();
+ bool defaultSinkAndPort = (sink->isDefault() && portIsActive);
qint64 volume = sink->volume();
printf("[%c] Output: '%s %s', volume: %d, mute: %d\n",
- active ? 'x' : ' ',
+ defaultSinkAndPort ? 'x' : ' ',
sink->description().toLocal8Bit().constData(), port->description().toLocal8Bit().constData(),
(int)volume, (int)sink->isMuted());
- QString id = cardName + sink->name() + port->name();
+ QString id = sink->name() + port->name();
// Only once, update port volume to be 100% if it's low
- if (active && !_donePorts.contains(id)) {
+ if (defaultSinkAndPort && !_donePorts.contains(id)) {
_donePorts.insert(id);
if (volume < 60000) {
volume = 65535;
sink->setVolume(volume);
}
}
- QString title = sink->description() + ", " + port->description();
- _mainWindow->getOutput(id, true, title)->updateOutput(title,
- active, sink->isMuted(), sink->isVolumeWritable() ? sink->volume() : -1, QString(), sink->name(), port->name());
+ _mainWindow->getDevice(card, sink, port)->updateDeviceAndPort(defaultSinkAndPort, sink->isMuted(),
+ (portIsActive && sink->isVolumeWritable()) ? sink->volume() : -1);
}
}
// Now find all the profiles from all cards that are not active and add an entry to the list for each one
for (auto *card : cards) {
- QString cardDescription = card->description();
int profIndex = -1;
for (auto *profile : card->profiles()) {
profIndex++;
@@ -110,10 +112,7 @@ static void updateActiveOutput()
continue;
printf("[ ] Output: '%s', sinks: %d\n",
profile->description().toLocal8Bit().constData(), profile->sinks());
- QString id = card->name() + profile->name();
- QString title = cardDescription + ", " + profile->description();
- _mainWindow->getOutput(id, false, title)->updateOutput(title,
- false, false, -1, card->name(), QString(), profile->name());
+ _mainWindow->getCardProfile(card, profile)->updateCardAndProfile();
}
}
printf("`--------------------------------------------ยด\n");
@@ -341,6 +340,9 @@ int main(int argc, char **argv)
for (auto *profile : card->profiles()) {
printf(" Profile: %s\n", profile->name().toLocal8Bit().constData());
}
+ for (auto *port : card->ports()) {
+ printf(" Port: %s\n", port->name().toLocal8Bit().constData());
+ }
}
for (auto *sink : i->sinks()) {
printf("Sink: %s (for card index %d)\n", sink->name().toLocal8Bit().constData(), sink->cardIndex());