From 977c9c1db85c0ddecc7d67b307e40f326d540754 Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Fri, 25 Nov 2011 13:19:53 +0200 Subject: Implement the attributes method to create a new QALAttributes instance --- src/qalcontext.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 -- cgit v1.2.3