comparison audio/AudioRecordTarget.h @ 548:baa11365ebdd bqaudioio

Merge from branch bqresample
author Chris Cannam
date Wed, 07 Dec 2016 11:51:42 +0000
parents b84d9b512dbd
children 4de547a5905c
comparison
equal deleted inserted replaced
547:82d7e5cf7517 548:baa11365ebdd
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 WritableWaveFileModel;
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 getRecordContainerFolder();
55 QString getRecordFolder();
56
57 bool isRecording() const { return m_recording; }
58 WritableWaveFileModel *startRecording(); // caller takes ownership
59 void stopRecording();
60
61 signals:
62 void recordStatusChanged(bool recording);
63 void recordDurationChanged(sv_frame_t, sv_samplerate_t); // emitted occasionally
64 void recordCompleted();
65
66 protected slots:
67 void modelAboutToBeDeleted();
68
69 private:
70 ViewManagerBase *m_viewManager;
71 std::string m_clientName;
72 bool m_recording;
73 sv_samplerate_t m_recordSampleRate;
74 sv_frame_t m_frameCount;
75 QString m_audioFileName;
76 WritableWaveFileModel *m_model;
77 QMutex m_mutex;
78 };
79
80 #endif