annotate 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
rev   line source
Chris@476 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@476 2
Chris@476 3 /*
Chris@476 4 Sonic Visualiser
Chris@476 5 An audio file viewer and annotation editor.
Chris@476 6 Centre for Digital Music, Queen Mary, University of London.
Chris@476 7
Chris@476 8 This program is free software; you can redistribute it and/or
Chris@476 9 modify it under the terms of the GNU General Public License as
Chris@476 10 published by the Free Software Foundation; either version 2 of the
Chris@476 11 License, or (at your option) any later version. See the file
Chris@476 12 COPYING included with this distribution for more information.
Chris@476 13 */
Chris@476 14
Chris@574 15 #ifndef SV_AUDIO_CALLBACK_RECORD_TARGET_H
Chris@574 16 #define SV_AUDIO_CALLBACK_RECORD_TARGET_H
Chris@574 17
Chris@574 18 #include "base/AudioRecordTarget.h"
Chris@476 19
Chris@476 20 #include <bqaudioio/ApplicationRecordTarget.h>
Chris@476 21
Chris@476 22 #include <string>
Chris@476 23
Chris@476 24 #include <QObject>
Chris@476 25 #include <QMutex>
Chris@476 26
Chris@476 27 #include "base/BaseTypes.h"
Chris@476 28
Chris@476 29 class ViewManagerBase;
Chris@477 30 class WritableWaveFileModel;
Chris@476 31
Chris@574 32 class AudioCallbackRecordTarget : public QObject,
Chris@574 33 public AudioRecordTarget,
Chris@574 34 public breakfastquay::ApplicationRecordTarget
Chris@476 35 {
Chris@476 36 Q_OBJECT
Chris@476 37
Chris@476 38 public:
Chris@574 39 AudioCallbackRecordTarget(ViewManagerBase *, QString clientName);
Chris@574 40 virtual ~AudioCallbackRecordTarget();
Chris@476 41
Chris@559 42 virtual std::string getClientName() const override { return m_clientName; }
Chris@476 43
Chris@559 44 virtual int getApplicationSampleRate() const override;
Chris@559 45 virtual int getApplicationChannelCount() const override;
Chris@476 46
Chris@559 47 virtual void setSystemRecordBlockSize(int) override;
Chris@559 48 virtual void setSystemRecordSampleRate(int) override;
Chris@559 49 virtual void setSystemRecordLatency(int) override;
Chris@559 50 virtual void setSystemRecordChannelCount(int) override;
Chris@476 51
Chris@559 52 virtual void putSamples(const float *const *samples, int nchannels, int nframes) override;
Chris@476 53
Chris@559 54 virtual void setInputLevels(float peakLeft, float peakRight) override;
Chris@476 55
Chris@559 56 virtual void audioProcessingOverload() override { }
Chris@476 57
Chris@508 58 QString getRecordContainerFolder();
Chris@483 59 QString getRecordFolder();
Chris@483 60
Chris@574 61 virtual bool isRecording() const override { return m_recording; }
Chris@574 62 virtual sv_frame_t getRecordDuration() const override { return m_frameCount; }
Chris@574 63
Chris@574 64 virtual bool getInputLevels(float &left, float &right) override;
Chris@574 65
Chris@574 66 WritableWaveFileModel *startRecording(); // caller takes ownership of model
Chris@476 67 void stopRecording();
Chris@477 68
Chris@477 69 signals:
Chris@477 70 void recordStatusChanged(bool recording);
Chris@485 71 void recordDurationChanged(sv_frame_t, sv_samplerate_t); // emitted occasionally
Chris@497 72 void recordCompleted();
Chris@477 73
Chris@477 74 protected slots:
Chris@477 75 void modelAboutToBeDeleted();
Chris@476 76
Chris@476 77 private:
Chris@476 78 ViewManagerBase *m_viewManager;
Chris@476 79 std::string m_clientName;
Chris@476 80 bool m_recording;
Chris@476 81 sv_samplerate_t m_recordSampleRate;
Chris@546 82 int m_recordChannelCount;
Chris@485 83 sv_frame_t m_frameCount;
Chris@476 84 QString m_audioFileName;
Chris@477 85 WritableWaveFileModel *m_model;
Chris@574 86 float m_inputLeft;
Chris@574 87 float m_inputRight;
Chris@476 88 QMutex m_mutex;
Chris@476 89 };
Chris@476 90
Chris@476 91 #endif