summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2011-11-25 13:19:53 +0200
committerLaszlo Papp <ext-laszlo.papp@nokia.com>2011-11-25 13:19:53 +0200
commit977c9c1db85c0ddecc7d67b307e40f326d540754 (patch)
tree0bcf960b57e33ea0eb501e556dea726c8126749c
parent06bb8fbaf2c608e471167e47bfcf2ffa9e0cfcfb (diff)
Implement the attributes method to create a new QALAttributes instance
-rw-r--r--src/qalcontext.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/qalcontext.cpp b/src/qalcontext.cpp
index 3689ee4..37a9c3f 100644
--- a/src/qalcontext.cpp
+++ b/src/qalcontext.cpp
@@ -84,6 +84,37 @@ QALContext::setRequestedAttributes(const QALAttributes &attributes)
QALAttributes
QALContext::attributes() const
{
+ ALCenum error;
+
+ if ((error = alcGetError(d->alcDevice)) != ALC_NO_ERROR) {
+ qWarning() << "Error before trying to create attributes:" << alcGetString(d->alcDevice, error);
+ };
+
+ QALAttributes attributes = QALAttributes::defaultAttributes();
+
+ if (isValid() == false)
+ return attributes;
+
+ attributes.setDeviceSpecifier(alcGetString(d->alcDevice, ALC_DEVICE_SPECIFIER));
+
+ ALCint tmp;
+
+ alcGetIntegerv(d->alcDevice, ALC_FREQUENCY, 1, &tmp);
+ attributes.setFrequency(tmp);
+
+ alcGetIntegerv(d->alcDevice, ALC_REFRESH, 1, &tmp);
+ attributes.setRefresh(tmp);
+
+ alcGetIntegerv(d->alcDevice, ALC_SYNC, 1, &tmp);
+ attributes.setSync(tmp);
+
+ alcGetIntegerv(d->alcDevice, ALC_MONO_SOURCES, 1, &tmp);
+ attributes.setMonoSources(tmp);
+
+ alcGetIntegerv(d->alcDevice, ALC_STEREO_SOURCES, 1, &tmp);
+ attributes.setStereoSources(tmp);
+
+ return attributes;
}
bool