00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (C) 2009 Guillaume Martres <smarter@ubuntu.com> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #include "device_p.h" 00021 00022 #ifdef Q_WS_X11 00023 #include <AL/al.h> 00024 #endif 00025 #ifdef Q_WS_MAC 00026 #include <OpenAL/al.h> 00027 #endif 00028 00029 using namespace GluonAudio; 00030 00031 Device::Device( ALCdevice* device ) 00032 : m_device( device ) 00033 { 00034 } 00035 00036 Device::~Device() 00037 { 00038 alcCloseDevice( m_device ); 00039 } 00040 00041 bool Device::isExtensionPresent( const QString& extension ) 00042 { 00043 return alcIsExtensionPresent( 0, extension.toUtf8() ); 00044 } 00045 00046 QStringList Device::contextOption( int option ) 00047 { 00048 const ALCchar* alcList = alcGetString( 0, option ); 00049 00050 // alcGetString returns a list of devices separated by a null char (the list itself ends with a double null char) 00051 // So we can't pass it directly to QStringList 00052 QStringList optionList; 00053 if( alcList ) 00054 { 00055 while( strlen( alcList ) > 0 ) 00056 { 00057 optionList << QString( alcList ); 00058 alcList += strlen( alcList ) + 1; 00059 } 00060 } 00061 return optionList; 00062 }