LMMS
Loading...
Searching...
No Matches
AudioSampleRecorder.h
Go to the documentation of this file.
1/*
2 * AudioSampleRecorder.h - device-class that implements recording
3 * audio-buffers into RAM
4 *
5 * Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_AUDIO_SAMPLE_RECORDER_H
27#define LMMS_AUDIO_SAMPLE_RECORDER_H
28
29#include <QList>
30#include <QPair>
31#include <memory>
32
33#include "AudioDevice.h"
34
35namespace lmms
36{
37
38class SampleBuffer;
39
40
42{
43public:
44 AudioSampleRecorder( const ch_cnt_t _channels, bool & _success_ful, AudioEngine* audioEngine );
45 ~AudioSampleRecorder() override;
46
47 f_cnt_t framesRecorded() const;
48 std::shared_ptr<const SampleBuffer> createSampleBuffer();
49
50private:
51 void writeBuffer(const SampleFrame* _ab, const f_cnt_t _frames) override;
52
53 using BufferList = QList<QPair<SampleFrame*, f_cnt_t>>;
55
56} ;
57
58} // namespace lmms
59
60#endif // LMMS_AUDIO_SAMPLE_RECORDER_H
AudioEngine * audioEngine()
Definition AudioDevice.h:121
AudioDevice(const ch_cnt_t _channels, AudioEngine *audioEngine)
Definition AudioDevice.cpp:33
Definition AudioEngine.h:66
AudioSampleRecorder(const ch_cnt_t _channels, bool &_success_ful, AudioEngine *audioEngine)
Definition AudioSampleRecorder.cpp:35
BufferList m_buffers
Definition AudioSampleRecorder.h:54
std::shared_ptr< const SampleBuffer > createSampleBuffer()
Definition AudioSampleRecorder.cpp:69
QList< QPair< SampleFrame *, f_cnt_t > > BufferList
Definition AudioSampleRecorder.h:53
~AudioSampleRecorder() override
Definition AudioSampleRecorder.cpp:47
void writeBuffer(const SampleFrame *_ab, const f_cnt_t _frames) override
Definition AudioSampleRecorder.cpp:87
f_cnt_t framesRecorded() const
Definition AudioSampleRecorder.cpp:59
Definition SampleBuffer.h:39
Definition SampleFrame.h:41
Definition AudioAlsa.cpp:35
std::uint16_t ch_cnt_t
Definition LmmsTypes.h:44
std::uint64_t f_cnt_t
Definition LmmsTypes.h:43