LMMS
Loading...
Searching...
No Matches
AudioFileMP3.h
Go to the documentation of this file.
1/*
2 * AudioFileMP3.h - Audio-device which encodes a wave stream into
3 * an MP3 file. This is used for song export.
4 *
5 * Copyright (c) 2017 to present Michael Gregorius <michael.gregorius.git/at/arcor[dot]de>
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_FILE_MP3_H
27#define LMMS_AUDIO_FILE_MP3_H
28
29#include "lmmsconfig.h"
30
31#ifdef LMMS_HAVE_MP3LAME
32
33#include "AudioFileDevice.h"
34
35#include "lame/lame.h"
36
37namespace lmms
38{
39
41{
42public:
43 AudioFileMP3( OutputSettings const & outputSettings,
44 const ch_cnt_t _channels,
45 bool & successful,
46 const QString & _file,
48 ~AudioFileMP3() override;
49
50 static AudioFileDevice * getInst( const QString & outputFilename,
51 OutputSettings const & outputSettings,
52 const ch_cnt_t channels,
54 bool & successful )
55 {
56 return new AudioFileMP3( outputSettings, channels, successful,
57 outputFilename, audioEngine );
58 }
59
60protected:
61 void writeBuffer(const SampleFrame* /* _buf*/, const f_cnt_t /*_frames*/) override;
62
63private:
65 bool initEncoder();
66 void tearDownEncoder();
67
68private:
69 lame_t m_lame;
70};
71
72} // namespace lmms
73
74#endif // LMMS_HAVE_MP3LAME
75
76#endif // LMMS_AUDIO_FILE_MP3_H
AudioEngine * audioEngine()
Definition AudioDevice.h:121
ch_cnt_t channels() const
Definition AudioDevice.h:106
Definition AudioEngine.h:66
AudioFileDevice(OutputSettings const &outputSettings, const ch_cnt_t _channels, const QString &_file, AudioEngine *audioEngine)
Definition AudioFileDevice.cpp:35
void flushRemainingBuffers()
Definition AudioFileMP3.cpp:81
lame_t m_lame
Definition AudioFileMP3.h:69
bool initEncoder()
Definition AudioFileMP3.cpp:107
void tearDownEncoder()
Definition AudioFileMP3.cpp:129
void writeBuffer(const SampleFrame *, const f_cnt_t) override
Definition AudioFileMP3.cpp:58
~AudioFileMP3() override
Definition AudioFileMP3.cpp:52
AudioFileMP3(OutputSettings const &outputSettings, const ch_cnt_t _channels, bool &successful, const QString &_file, AudioEngine *audioEngine)
Definition AudioFileMP3.cpp:38
static AudioFileDevice * getInst(const QString &outputFilename, OutputSettings const &outputSettings, const ch_cnt_t channels, AudioEngine *audioEngine, bool &successful)
Definition AudioFileMP3.h:50
Definition OutputSettings.h:36
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