comparison audio/AudioRecordTarget.h @ 476:f4d1fa41b94b recording

Basic recording stuff
author Chris Cannam
date Tue, 18 Aug 2015 15:00:34 +0100
parents
children 411e019474e5
comparison
equal deleted inserted replaced
475:f93820d36cb0 476:f4d1fa41b94b
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
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #ifndef AUDIO_RECORD_TARGET_H
16 #define AUDIO_RECORD_TARGET_H
17
18 #include <bqaudioio/ApplicationRecordTarget.h>
19
20 #include <string>
21
22 #include <QObject>
23 #include <QMutex>
24
25 #include "base/BaseTypes.h"
26
27 class ViewManagerBase;
28 class WavFileWriter;
29
30 class AudioRecordTarget : public QObject,
31 public breakfastquay::ApplicationRecordTarget
32 {
33 Q_OBJECT
34
35 public:
36 AudioRecordTarget(ViewManagerBase *, QString clientName);
37 virtual ~AudioRecordTarget();
38
39 virtual std::string getClientName() const { return m_clientName; }
40
41 virtual int getApplicationSampleRate() const { return 0; } // don't care
42 virtual int getApplicationChannelCount() const { return 2; }
43
44 virtual void setSystemRecordBlockSize(int);
45 virtual void setSystemRecordSampleRate(int);
46 virtual void setSystemRecordLatency(int);
47
48 virtual void putSamples(int nframes, float **samples);
49
50 virtual void setInputLevels(float peakLeft, float peakRight);
51
52 virtual void audioProcessingOverload() { }
53
54 QString startRecording(); // and return the audio filename
55 void stopRecording();
56
57 private:
58 ViewManagerBase *m_viewManager;
59 std::string m_clientName;
60 bool m_recording;
61 sv_samplerate_t m_recordSampleRate;
62 QString m_audioFileName;
63 WavFileWriter *m_writer;
64 QMutex m_mutex;
65 };
66
67 #endif