Mercurial > hg > svapp
comparison audio/AudioCallbackRecordTarget.h @ 574:b3c35447ef31 3.0-integration
Wire up record monitoring
author | Chris Cannam |
---|---|
date | Wed, 04 Jan 2017 16:03:12 +0000 |
parents | audio/AudioRecordTarget.h@7b115a6505b8 |
children | c2e27ad7f408 |
comparison
equal
deleted
inserted
replaced
573:9fb190c6521b | 574:b3c35447ef31 |
---|---|
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 SV_AUDIO_CALLBACK_RECORD_TARGET_H | |
16 #define SV_AUDIO_CALLBACK_RECORD_TARGET_H | |
17 | |
18 #include "base/AudioRecordTarget.h" | |
19 | |
20 #include <bqaudioio/ApplicationRecordTarget.h> | |
21 | |
22 #include <string> | |
23 | |
24 #include <QObject> | |
25 #include <QMutex> | |
26 | |
27 #include "base/BaseTypes.h" | |
28 | |
29 class ViewManagerBase; | |
30 class WritableWaveFileModel; | |
31 | |
32 class AudioCallbackRecordTarget : public QObject, | |
33 public AudioRecordTarget, | |
34 public breakfastquay::ApplicationRecordTarget | |
35 { | |
36 Q_OBJECT | |
37 | |
38 public: | |
39 AudioCallbackRecordTarget(ViewManagerBase *, QString clientName); | |
40 virtual ~AudioCallbackRecordTarget(); | |
41 | |
42 virtual std::string getClientName() const override { return m_clientName; } | |
43 | |
44 virtual int getApplicationSampleRate() const override; | |
45 virtual int getApplicationChannelCount() const override; | |
46 | |
47 virtual void setSystemRecordBlockSize(int) override; | |
48 virtual void setSystemRecordSampleRate(int) override; | |
49 virtual void setSystemRecordLatency(int) override; | |
50 virtual void setSystemRecordChannelCount(int) override; | |
51 | |
52 virtual void putSamples(const float *const *samples, int nchannels, int nframes) override; | |
53 | |
54 virtual void setInputLevels(float peakLeft, float peakRight) override; | |
55 | |
56 virtual void audioProcessingOverload() override { } | |
57 | |
58 QString getRecordContainerFolder(); | |
59 QString getRecordFolder(); | |
60 | |
61 virtual bool isRecording() const override { return m_recording; } | |
62 virtual sv_frame_t getRecordDuration() const override { return m_frameCount; } | |
63 | |
64 virtual bool getInputLevels(float &left, float &right) override; | |
65 | |
66 WritableWaveFileModel *startRecording(); // caller takes ownership of model | |
67 void stopRecording(); | |
68 | |
69 signals: | |
70 void recordStatusChanged(bool recording); | |
71 void recordDurationChanged(sv_frame_t, sv_samplerate_t); // emitted occasionally | |
72 void recordCompleted(); | |
73 | |
74 protected slots: | |
75 void modelAboutToBeDeleted(); | |
76 | |
77 private: | |
78 ViewManagerBase *m_viewManager; | |
79 std::string m_clientName; | |
80 bool m_recording; | |
81 sv_samplerate_t m_recordSampleRate; | |
82 int m_recordChannelCount; | |
83 sv_frame_t m_frameCount; | |
84 QString m_audioFileName; | |
85 WritableWaveFileModel *m_model; | |
86 float m_inputLeft; | |
87 float m_inputRight; | |
88 QMutex m_mutex; | |
89 }; | |
90 | |
91 #endif |