Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/sounddevice.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           sounddevice.cpp
00003                              -------------------
00004     begin                : Sun Aug 12, 2007, past my bedtime
00005     copyright            : (C) 2007 Albert Santoni
00006     email                : gamegod \a\t users.sf.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SOUNDDEVICE_H
00019 #define SOUNDDEVICE_H
00020 
00021 #include "soundmanager.h"
00022 
00023 //Forward declarations
00025 class SoundDevice;
00026 class SoundManager;
00027 class AudioOutput;
00028 class AudioInput;
00029 
00030 enum SoundDeviceError {
00031     SOUNDDEVICE_ERROR_OK = OK,
00032     SOUNDDEVICE_ERROR_DUPLICATE_OUTPUT_CHANNEL,
00033     SOUNDDEVICE_ERROR_EXCESSIVE_OUTPUT_CHANNEL,
00034     SOUNDDEVICE_ERROR_EXCESSIVE_INPUT_CHANNEL,
00035 };
00036 
00037 class SoundDevice
00038 {
00039     public:
00040         SoundDevice(ConfigObject<ConfigValue> *config, SoundManager* sm);
00041         virtual ~SoundDevice();
00042         QString getInternalName() const;
00043         QString getDisplayName() const;
00044         QString getHostAPI() const;
00045         void setHostAPI(QString api);
00046         void setSampleRate(double sampleRate);
00047         void setFramesPerBuffer(unsigned int framesPerBuffer);
00048         virtual int open() = 0;
00049         virtual int close() = 0;
00050         virtual QString getError() const = 0;
00051         int getNumOutputChannels() const;     
00052         int getNumInputChannels() const;
00053         SoundDeviceError addOutput(const AudioOutput &out);
00054         SoundDeviceError addInput(const AudioInput &in);
00055         void clearOutputs();
00056         void clearInputs();
00057         bool operator==(const SoundDevice &other) const;
00058         bool operator==(const QString &other) const;
00059     protected:
00060         ConfigObject<ConfigValue> *m_pConfig;
00061         SoundManager *m_pSoundManager;      //Pointer to the SoundManager object which we'll request audio from.
00062         QString m_strInternalName;          //The name of the soundcard, used internally (may include the device ID)
00063         QString m_strDisplayName;           //The name of the soundcard, as displayed to the user 
00064         int m_iNumOutputChannels;           //The number of output channels that the soundcard has
00065         int m_iNumInputChannels;            //The number of input channels that the soundcard has
00066         double m_dSampleRate;               //The current samplerate for the sound device.
00067         QString m_hostAPI;                  //The name of the audio API used by this device.
00068         unsigned int m_framesPerBuffer;
00069         QList<AudioOutput> m_audioOutputs;
00070         QList<AudioInput> m_audioInputs;
00071 };
00072 
00073 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines