AudioPortAudioTarget.h

Go to the documentation of this file.
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
00020 
00021 // This code can be compiled for either PortAudio v18 or v19.
00022 // PortAudio v19 is the default.  If you want to use v18, define
00023 // the preprocessor symbol HAVE_PORTAUDIO_v18.
00024 
00025 #include <portaudio.h>
00026 #include <vector>
00027 
00028 #include "AudioCallbackPlayTarget.h"
00029 
00030 class AudioCallbackPlaySource;
00031 
00032 class AudioPortAudioTarget : public AudioCallbackPlayTarget
00033 {
00034     Q_OBJECT
00035 
00036 public:
00037     AudioPortAudioTarget(AudioCallbackPlaySource *source);
00038     virtual ~AudioPortAudioTarget();
00039 
00040     virtual void shutdown();
00041 
00042     virtual bool isOK() const;
00043 
00044     virtual double getCurrentTime() const;
00045 
00046 public slots:
00047     virtual void sourceModelReplaced();
00048 
00049 protected:
00050 #ifdef HAVE_PORTAUDIO_V18
00051 
00052     int process(void *input, void *output, unsigned long frames,
00053                 PaTimestamp outTime);
00054 
00055     static int processStatic(void *, void *, unsigned long,
00056                              PaTimestamp, void *);
00057 
00058     PortAudioStream *m_stream;
00059 
00060 #else
00061 
00062     int process(const void *input, void *output, unsigned long frames,
00063                 const PaStreamCallbackTimeInfo *timeInfo,
00064                 PaStreamCallbackFlags statusFlags);
00065 
00066     static int processStatic(const void *, void *, unsigned long,
00067                              const PaStreamCallbackTimeInfo *,
00068                              PaStreamCallbackFlags, void *);
00069 
00070     PaStream *m_stream;
00071 
00072 #endif
00073 
00074     int m_bufferSize;
00075     int m_sampleRate;
00076     int m_latency;
00077     bool m_done;
00078 };
00079 
00080 #endif /* HAVE_PORTAUDIO */
00081 
00082 #endif
00083 

Generated on Wed Feb 20 15:45:25 2008 for SonicVisualiser by  doxygen 1.5.1