summaryrefslogtreecommitdiffstats
path: root/app/pacontrolmodel.h
diff options
context:
space:
mode:
authorMatt Porter <mporter@konsulko.com>2017-04-15 09:18:25 -0400
committerMatt Porter <mporter@konsulko.com>2017-04-20 22:00:09 -0400
commit3fd71f4b6bc026f2f9054140f7bf612855e45d7d (patch)
tree202cb27d30a55843e44d828b9f8043dd9697eddf /app/pacontrolmodel.h
parent392effc544e3d94b82f806378d4ac1d11a185422 (diff)
Rewrite PulseAudio backend into a threaded class
Converts the Mixer PulseAudio backend from a C library to a PaClient class which runs in its own QThread. This faciliates isolation of PaControlModel updates to the QML thread where they belong. It also provides the foundation for runtime updates of the model and reuse of the PaClient class in other apps. AGL-Bug: SPEC-548 Change-Id: I13c4c220fde2fd4bc4aea2e04f39152a963b5fa0 Signed-off-by: Matt Porter <mporter@konsulko.com>
Diffstat (limited to 'app/pacontrolmodel.h')
-rw-r--r--app/pacontrolmodel.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/pacontrolmodel.h b/app/pacontrolmodel.h
index aa34a79..475f7ce 100644
--- a/app/pacontrolmodel.h
+++ b/app/pacontrolmodel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Konsulko Group
+ * Copyright (C) 2016,2017 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,8 @@
#include <pulse/pulseaudio.h>
-#ifndef __cplusplus
-extern void add_one_control(void *ctx, int, const char *, int, int, const char *, int);
-#else
-extern "C" void add_one_control(void *ctx, int, const char *, int, int, const char *, int);
-
-#include <QAbstractListModel>
-#include <QStringList>
+#include <QtCore/QAbstractListModel>
+#include <QtCore/QList>
class PaControlModel;
@@ -42,7 +37,7 @@ class PaControl
void setType(const QVariant&);
void setChannel(const QVariant&);
void setCDesc(const QVariant&);
- void setVolume(pa_context *, const QVariant&);
+ void setVolume(PaControlModel *, const QVariant&);
private:
quint32 m_cindex;
@@ -78,10 +73,15 @@ class PaControlModel : public QAbstractListModel
Qt::ItemFlags flags(const QModelIndex &index) const;
+ public slots:
+ void addOneControl(int cindex, QString desc, int type, int channel, const char *cdesc, int volume);
+
+ signals:
+ void volumeChanged(uint32_t type, uint32_t index, uint32_t channel, uint32_t volume);
+
protected:
QHash<int, QByteArray> roleNames() const;
private:
QList<PaControl> m_controls;
pa_context *pa_ctx;
};
-#endif // __cplusplus