svapp
1.9
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2006 Chris Cannam. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _AUDIO_PORT_AUDIO_TARGET_H_ 00017 #define _AUDIO_PORT_AUDIO_TARGET_H_ 00018 00019 #ifdef HAVE_PORTAUDIO_2_0 00020 00021 // This code requires PortAudio v19 -- it won't work with v18. 00022 00023 #include <portaudio.h> 00024 00025 #include <QObject> 00026 00027 #include "AudioCallbackPlayTarget.h" 00028 00029 class AudioCallbackPlaySource; 00030 00031 class AudioPortAudioTarget : public AudioCallbackPlayTarget 00032 { 00033 Q_OBJECT 00034 00035 public: 00036 AudioPortAudioTarget(AudioCallbackPlaySource *source); 00037 virtual ~AudioPortAudioTarget(); 00038 00039 virtual void shutdown(); 00040 00041 virtual bool isOK() const; 00042 00043 virtual double getCurrentTime() const; 00044 00045 public slots: 00046 virtual void sourceModelReplaced(); 00047 00048 protected: 00049 int process(const void *input, void *output, int frames, 00050 const PaStreamCallbackTimeInfo *timeInfo, 00051 PaStreamCallbackFlags statusFlags); 00052 00053 static int processStatic(const void *, void *, unsigned long, 00054 const PaStreamCallbackTimeInfo *, 00055 PaStreamCallbackFlags, void *); 00056 00057 PaStream *m_stream; 00058 00059 int m_bufferSize; 00060 int m_sampleRate; 00061 int m_latency; 00062 bool m_prioritySet; 00063 bool m_done; 00064 }; 00065 00066 #endif /* HAVE_PORTAUDIO */ 00067 00068 #endif 00069