![]() |
Mixxx
|
00001 /*************************************************************************** 00002 sounddeviceportaudio.cpp 00003 ------------------- 00004 begin : Sun Aug 15, 2007 (Stardate -315378.5417935057) 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 SOUNDDEVICEPORTAUDIO_H 00019 #define SOUNDDEVICEPORTAUDIO_H 00020 00021 #include <portaudio.h> 00022 #include "sounddevice.h" 00023 00024 class SoundManager; 00025 00028 #define MIXXXPA_MAX_FRAME_SIZE 1024 00029 00033 typedef int (*EnableAlsaRT)(PaStream* s, int enable); 00034 00035 class SoundDevicePortAudio; 00036 00037 class SoundDevicePortAudio : public SoundDevice 00038 { 00039 public: 00040 SoundDevicePortAudio(ConfigObject<ConfigValue> *config, SoundManager *sm, const PaDeviceInfo *deviceInfo, unsigned int devIndex); 00041 ~SoundDevicePortAudio(); 00042 int open(); 00043 int close(); 00044 QString getError() const; 00045 int callbackProcess(unsigned long framesPerBuffer, float *output, short *in); 00046 private: 00048 PaStream *m_pStream; 00050 PaDeviceIndex m_devId; 00052 const PaDeviceInfo *m_deviceInfo; 00054 int m_iNumberOfBuffers; 00056 //int m_iNumActiveDevices; 00058 PaStreamParameters m_outputParams; 00060 PaStreamParameters m_inputParams; 00062 QString m_lastError; 00063 private: 00064 bool m_bSetThreadPriority; 00065 }; 00066 00067 00068 00069 int paV19Callback(const void *inputBuffer, void *outputBuffer, 00070 unsigned long framesPerBuffer, 00071 const PaStreamCallbackTimeInfo* timeInfo, 00072 PaStreamCallbackFlags statusFlags, 00073 void *soundDevice); 00074 00075 #endif