-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove audio engine from exporting code #7452
Draft
szeli1
wants to merge
70
commits into
LMMS:master
Choose a base branch
from
szeli1:remove_AudioEngine_from_exporting
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
2ac8a9c
AudioEngine_adding_new_export_classes
szeli1 d4d19d7
AudioFileDevice_removing_AudioEngine_and_AudioDevice
szeli1 9bb6b5e
AudioFileFlac_updating_constructors_part_1
szeli1 377e3f4
AudioFileMP3_updating_constructors_part_1
szeli1 738e0ba
AudioFileOgg_updating_constructors_part_1
szeli1 092e9cd
AudioFileWave_updating_constructors_part_1
szeli1 22f162e
AudioDevice_audiobuffering_made_static
szeli1 1d6d47f
ProjectRenderer_updating_m_FileDev_constructor
szeli1 ccab40a
AudioEngine_moving_processing_function
szeli1 a5b44f1
AudioFileDevice_removing_processNextBuffer_function
szeli1 d5c6efd
AudioFileFlac_updating_constructor_part_2
szeli1 7733c47
AudioFileMP3_updating_constructor_part_2
szeli1 934571d
AudioFileOgg_updating_constructor_part_2
szeli1 f5436f8
AudioFileWave_updating_constructor_part_2
szeli1 80f9dd6
ProjectRenderer_removing_Project_code
szeli1 d78d614
RenderManager_adding_project_code
szeli1 3ad71bb
RenderManager_fixing_endRendering_function
szeli1 4e56afa
AudioAlsa_updating_convertToS16
szeli1 85e7a1e
AudioOss_updating_convertToS16
szeli1 2813474
AudioPulseAudio_updating_convertToS16
szeli1 f7a8173
AudioSndio_updating_convertToS16
szeli1 8788800
ExportProjcetDialog_replacing_ProjectRenderer
szeli1 b7fd2d6
ProjectRenderer_renaming_to_ActiveRenderer
szeli1 b6cc6f5
ActiveRenderer_renaming_ProjectRenderer
szeli1 3dfbfa1
RenderManager_renaming_ProjectRenderer
szeli1 7f9ab91
AudioEngine_renaming_ProjectRenderer
szeli1 183b2fb
CMakeLists_renaming_ProjectRenderer
szeli1 5c80787
main_renaming_ProjecRenderer
szeli1 e3d7fe1
MainWindow_renaming_ProjectRenderer
szeli1 866108a
AciveRenderer_RenderManager_AudioFileDevice_AudioFileFlac_removing_qD…
szeli1 65daca0
RenderManager_updating_comments
szeli1 141cb23
RenderManager_replacing_memcpy
szeli1 6dbea74
main_rename_ProjectRenderer
szeli1 025fdef
MainWindow_rename_ProjectRenderer
szeli1 cba148b
ExportProjectDialog_rename_ProjectRenderer
szeli1 ca9b374
RenderManager_rename_ProjectRenderer
szeli1 05aba7c
CMakeLists_rename_ProjectRenderer
szeli1 f48664a
ActiveRenderer_renamed_to_ProjectRenderer
szeli1 5d13640
ProjectRenderer_renamed_ActiveRenderer
szeli1 53a2a44
CMakeLists_adding_new_file
szeli1 c873d01
LmmsExporter_adding_files
szeli1 dba5dd1
LmmsExporter_implementing_functions
szeli1 35b1d23
LmmsExporter_implementing_functions_2
szeli1 0207f38
ProjectRenderer_reset_file
szeli1 cc1094a
RenderManager_reset_file
szeli1 73ee235
RenderManager_implement_LmmsExporter
szeli1 ef3807e
ProjectRenderer_implement_LmmsExporter
szeli1 67858ca
AudioEngine_friend_class_ProjectRenderer
szeli1 639cdc6
ExportProjectDialog_implement_LmmsExporter
szeli1 9313778
LmmsExporter_fix_errors
szeli1 502b287
main_implement_LmmsExporter
szeli1 61a0639
MainWindow_implement_LmmsExporter
szeli1 f548f74
AudioAlsa_reset
szeli1 821130d
AudioSndio_reset
szeli1 a0ff26d
AudioOss_reset
szeli1 8abbfd2
AudioPulseAudio_reset
szeli1 57db1ee
AudioDevice_channel_count_set_to_2_in_static
szeli1 1ecffa6
AudioFileDevice_remove_channel_count
szeli1 ec51c9a
AudioFileFlac_remove_channel_count
szeli1 d3fb596
AudioFileMP3_remove_channel_count
szeli1 061235f
AudioFileOgg_remove_channel_count
szeli1 ca9f6da
AudioFileWave_remove_channel_count
szeli1 a8071e3
LmmsExporter_remove_channel_count_from_AudioFileDevice
szeli1 1ac6c93
AudioDevice_format_changes
szeli1 a15b34e
AudioFileFlac_fromat_changes
szeli1 c61209c
AudioFileDevice_format_changes
szeli1 db7e52d
AudioFileMP3_format_changes
szeli1 ffdb807
AudioFileOgg_format_changes
szeli1 f0cf93d
AudioFileWave_format_changes
szeli1 ff0c79f
LmmsExporter_format_changes
szeli1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -40,20 +40,24 @@ namespace lmms | |||||
class AudioFileOgg : public AudioFileDevice | ||||||
{ | ||||||
public: | ||||||
AudioFileOgg( OutputSettings const & outputSettings, | ||||||
const ch_cnt_t _channels, | ||||||
bool & _success_ful, | ||||||
const QString & _file, | ||||||
AudioEngine* audioEngine ); | ||||||
AudioFileOgg(OutputSettings const& outputSettings, | ||||||
bool& successful, | ||||||
const QString& file, | ||||||
const fpp_t defaultBufferSize); | ||||||
~AudioFileOgg() override; | ||||||
|
||||||
static AudioFileDevice * getInst( const QString & outputFilename, | ||||||
OutputSettings const & outputSettings, | ||||||
const ch_cnt_t channels, | ||||||
AudioEngine* audioEngine, | ||||||
bool & successful ) | ||||||
static AudioFileDevice* getInst( | ||||||
OutputSettings const &outputSettings, | ||||||
bool &successful, | ||||||
const QString & outputFilename, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
const fpp_t defaultBufferSize) | ||||||
{ | ||||||
return new AudioFileOgg( outputSettings, channels, successful, outputFilename, audioEngine ); | ||||||
return new AudioFileOgg( | ||||||
outputSettings, | ||||||
successful, | ||||||
outputFilename, | ||||||
defaultBufferSize | ||||||
); | ||||||
} | ||||||
|
||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -37,21 +37,24 @@ namespace lmms | |||||
class AudioFileWave : public AudioFileDevice | ||||||
{ | ||||||
public: | ||||||
AudioFileWave( OutputSettings const & outputSettings, | ||||||
const ch_cnt_t channels, | ||||||
bool & successful, | ||||||
const QString & file, | ||||||
AudioEngine* audioEngine ); | ||||||
AudioFileWave(OutputSettings const& outputSettings, | ||||||
bool& successful, | ||||||
const QString& file, | ||||||
const fpp_t defaultBufferSize); | ||||||
~AudioFileWave() override; | ||||||
|
||||||
static AudioFileDevice * getInst( const QString & outputFilename, | ||||||
OutputSettings const & outputSettings, | ||||||
const ch_cnt_t channels, | ||||||
AudioEngine* audioEngine, | ||||||
bool & successful ) | ||||||
static AudioFileDevice* getInst( | ||||||
OutputSettings const &outputSettings, | ||||||
bool &successful, | ||||||
const QString & outputFilename, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
const fpp_t defaultBufferSize) | ||||||
{ | ||||||
return new AudioFileWave( outputSettings, channels, successful, | ||||||
outputFilename, audioEngine ); | ||||||
return new AudioFileWave( | ||||||
outputSettings, | ||||||
successful, | ||||||
outputFilename, | ||||||
defaultBufferSize | ||||||
); | ||||||
} | ||||||
|
||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* LmmsExporter.h - exporting files (currently only audio files), TODO rename class when things change | ||
* | ||
* Copyright (c) 2024 szeli1 <TODO/at/gmail/dot.com> | ||
* | ||
* This file is part of LMMS - https://lmms.io | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program (see COPYING); if not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA. | ||
* | ||
*/ | ||
|
||
#ifndef LMMS_LMMS_EXPORTER_H | ||
#define LMMS_LMMS_EXPORTER_H | ||
|
||
#include <functional> | ||
#include <thread> | ||
#include <vector> | ||
|
||
#include "AudioFileDevice.h" | ||
#include "SampleFrame.h" | ||
|
||
namespace lmms | ||
{ | ||
class LmmsExporter | ||
{ | ||
public: | ||
using BufferFn = std::function<void(std::vector<SampleFrame>*, void*)>; | ||
using EndFn = std::function<void(void*)>; | ||
|
||
enum class ExportAudioFileFormat : int | ||
{ | ||
Wave, | ||
Flac, | ||
Ogg, | ||
MP3, | ||
Count | ||
}; | ||
// in the future more types can be added | ||
enum class ExportFileType | ||
{ | ||
Audio | ||
}; | ||
|
||
constexpr static auto NumFileFormats = static_cast<std::size_t>(ExportAudioFileFormat::Count); | ||
|
||
struct FileEncodeDevice | ||
{ | ||
bool isAvailable() const { return m_getDevInst != nullptr; } | ||
|
||
ExportAudioFileFormat m_fileFormat; | ||
const char* m_description; | ||
const char* m_extension; | ||
AudioFileDeviceInstantiaton m_getDevInst; | ||
}; | ||
|
||
LmmsExporter(const ExportFileType fileType, | ||
const QString& outputLocationAndName); | ||
~LmmsExporter(); | ||
|
||
void setupAudioRendering( | ||
const OutputSettings& outputSettings, | ||
ExportAudioFileFormat fileFormat, | ||
const fpp_t defaultFrameCount, | ||
SampleFrame* exportBuffer, | ||
const fpp_t exportBufferFrameCount); | ||
void setupAudioRendering( | ||
const OutputSettings& outputSettings, | ||
ExportAudioFileFormat fileFormat, | ||
const fpp_t defaultFrameCount, | ||
BufferFn getBufferFunction, | ||
EndFn endFunction, | ||
void* getBufferData); | ||
bool canExportAutioFile() const; | ||
|
||
static ExportAudioFileFormat getAudioFileFormatFromFileName(const QString& fileName); | ||
static ExportAudioFileFormat getAudioFileFormatFromExtension(const QString& extenisonString); | ||
static QString getAudioFileExtensionFromFormat(ExportAudioFileFormat fmt); | ||
|
||
static const std::array<FileEncodeDevice, 5> s_fileEncodeDevices; | ||
|
||
void startExporting(); | ||
void stopExporting(); | ||
|
||
private: | ||
static void processExportingAudioFile(LmmsExporter* thisExporter); | ||
|
||
// audio exporting | ||
bool processNextBuffer(); | ||
bool processThisBuffer(SampleFrame* frameBuffer, const fpp_t frameCount); | ||
void setupAudioRenderingInternal( | ||
const OutputSettings& outputSettings, | ||
ExportAudioFileFormat fileFormat, | ||
const fpp_t defaultFrameCount); | ||
|
||
|
||
|
||
ExportFileType m_exportFileType; | ||
QString m_outputFile; | ||
|
||
volatile bool m_abort; | ||
|
||
// called if not nullptr | ||
// while run() | ||
// if returned buffer.size() <= 0 then break; end | ||
BufferFn m_getBufferFunction; | ||
// called at the end of run(), can be nullptr | ||
EndFn m_endFunction; | ||
void* m_getBufferData; | ||
|
||
AudioFileDevice* m_fileDev; | ||
std::vector<SampleFrame> m_buffer; | ||
std::unique_ptr<std::thread> m_thread; | ||
}; | ||
|
||
} // namespace lmms | ||
|
||
#endif // LMMS_LMMS_EXPORTER_H |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.