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