comparison audioio/AudioPortAudioTarget.h @ 43:3c5756fb6a68

* Move some things around to facilitate plundering libraries for other applications without needing to duplicate so much code. sv/osc -> data/osc sv/audioio -> audioio sv/transform -> plugin/transform sv/document -> document (will rename to framework in next commit)
author Chris Cannam
date Wed, 24 Oct 2007 16:34:31 +0000
parents
children 716e9d2f91c7 89a689720ee9
comparison
equal deleted inserted replaced
42:0619006a1ee3 43:3c5756fb6a68
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _AUDIO_PORT_AUDIO_TARGET_H_
17 #define _AUDIO_PORT_AUDIO_TARGET_H_
18
19 #ifdef HAVE_PORTAUDIO
20
21 // This code can be compiled for either PortAudio v18 or v19.
22 // PortAudio v19 is the default. If you want to use v18, define
23 // the preprocessor symbol HAVE_PORTAUDIO_v18.
24
25 #include <portaudio.h>
26 #include <vector>
27
28 #include "AudioCallbackPlayTarget.h"
29
30 class AudioCallbackPlaySource;
31
32 class AudioPortAudioTarget : public AudioCallbackPlayTarget
33 {
34 Q_OBJECT
35
36 public:
37 AudioPortAudioTarget(AudioCallbackPlaySource *source);
38 virtual ~AudioPortAudioTarget();
39
40 virtual bool isOK() const;
41
42 public slots:
43 virtual void sourceModelReplaced();
44
45 protected:
46 #ifdef HAVE_PORTAUDIO_V18
47
48 int process(void *input, void *output, unsigned long frames,
49 PaTimestamp outTime);
50
51 static int processStatic(void *, void *, unsigned long,
52 PaTimestamp, void *);
53
54 PortAudioStream *m_stream;
55
56 #else
57
58 int process(const void *input, void *output, unsigned long frames,
59 const PaStreamCallbackTimeInfo *timeInfo,
60 PaStreamCallbackFlags statusFlags);
61
62 static int processStatic(const void *, void *, unsigned long,
63 const PaStreamCallbackTimeInfo *,
64 PaStreamCallbackFlags, void *);
65
66 PaStream *m_stream;
67
68 #endif
69
70 int m_bufferSize;
71 int m_sampleRate;
72 int m_latency;
73 };
74
75 #endif /* HAVE_PORTAUDIO */
76
77 #endif
78