-
-
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
Add FLAC export and related options #3731
Conversation
This symbol is defined if libsndfile is available in version >= 1.0.26 and thus has the command SF_SET_COMPRESSION_LEVEL.
The code related to compression is only generated if LMMS_HAVE_SF_COMPLEVEL is defined. Otherwise, the UI element for it will exist in the mockup, but stay hidden, and the underlying functionality is not available at all.
… condition in GUI and FLAC-renderer.
src/core/audio/AudioFileFlac.cpp
Outdated
|
||
m_sf = sf_open( | ||
#ifdef LMMS_BUILD_WIN32 | ||
outputFile().toLocal8bit().constData(), |
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.
toLocal8bit()
-> toLocal8Bit()
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.
Lol, and here I was wondering why travis exploded. Thanks!
The QT5 builds are failing. When I tested it locally by running cmake with -DWANT_QT5=ON, compilation terminated on the file plugins/sf2_player/ui_patches_dialog.h. The offending line is |
Edit: A blanket 'wrong' on my latest contribution, deleted... |
src/gui/ExportProjectDialog.cpp
Outdated
QString info=""; | ||
if (i==0){ info = tr("(fastest)", nullptr, QApplication::UnicodeUTF8); } | ||
if (i==4){ info = tr("(default)", nullptr, QApplication::UnicodeUTF8); } | ||
if (i==MAX_LEVEL){ info = tr("(smallest)", nullptr, QApplication::UnicodeUTF8); } |
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.
@irrenhaus3 I suggest using tr("(something)")
without additional variable(s).
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.
Here fails Qt5 build, too. As far as I know, QAppliction::UnicodeUTF8
is deprecated.
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.
Good catch, thank you. The symbol was removed in the newest commit.
My bad about that autogenerated SF2player GUI header. Turns out I didn't properly clean up my build directory and that particular header was left over from a previous QT4 build. Oops... |
include/AudioFileFlac.h
Outdated
@@ -0,0 +1,48 @@ | |||
/* | |||
* AudioFileFlac.h - Audio device which encodes a wave stream into a FLAC file. | |||
*/ |
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.
You should put the copyright information here.
@@ -0,0 +1,95 @@ | |||
#include <memory> |
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.
Here, too.
You need text for |
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.
One thing about release()
: it releases pointer, not deletes it.
http://www.cplusplus.com/reference/memory/unique_ptr/release/
How about using reset()
without any argument?
I tested it with both 1.0.25 and 1.0.28, the rest things work great. |
I found one more bug just now: It breaks "Export tracks" path setting. If I choose directory '/foo/bar', it tries to export tracks to '/foo/bar.mp3/1_asdf.mp3'. |
One more request: please add WANT_FLAC option to CMakeLists.txt and let the code be built with libsndfile 1.0.11~1.0.17 without flac export. |
No, please do not recommend this. As stated in the PR, |
@tresf Quite true. |
Why? |
@tresf Both OGG and MP3 have such things, so user can enable/disable such features manually. |
Because they are (or were) separate libraries. Don't add a toggle for historical purposes please. Instead, remove OGG toggle. |
Yes.
I don't agree. They were added because of historical purposes, but I think they are still useful.
I agree that it should be, if FLAC toggle is not added, for consistency. |
@PhysSong: I agree with @tresf on this one. I really can't picture a use-case where a post-1.2 LMMS end user would want to disable FLAC, but keep WAV, especially since they're both implemented in terms of the same library. While I agree that it might make some sense in development and testing, this particular feature doesn't noticably increase build times or interfere with unrelated system components. |
@irrenhaus3 Then could you wait for other developers' opinion for CMakeLists.txt issue? |
Removing the ogg toggle option is better than adding a flac toggle. Keep it simple. |
src/core/ProjectRenderer.cpp
Outdated
@@ -42,6 +43,11 @@ const ProjectRenderer::FileEncodeDevice ProjectRenderer::fileEncodeDevices[] = | |||
{ ProjectRenderer::WaveFile, | |||
QT_TRANSLATE_NOOP( "ProjectRenderer", "WAV-File (*.wav)" ), | |||
".wav", &AudioFileWave::getInst }, | |||
{ ProjectRenderer::FlacFile, |
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.
@irrenhaus3 this needs formatting, spaces versus tabs. :)
A follow-up task to merging this should be to update the required |
@irrenhaus3 Then could you remove WANT_OGG toggle and related flags? |
Update for the interested reader not on the LMMS Discord server: |
src/core/audio/AudioFileFlac.cpp
Outdated
&m_sfinfo | ||
); | ||
|
||
sf_command(m_sf,SFC_SET_CLIPPING,nullptr,SF_TRUE); |
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.
It is conventional to put spaces between parameters.
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.
Like foo(b, a, r);
.
I recommend adding a status message for FLAC, like WAV one. It's not necessary, but I think having this will be better. |
Great! Now everything looks fine. |
I'm probably being a dumb but I'm not seeing this in the front end options on lmms 1.2.0-rc7 running on Arch or the lmms-git version 1.2.0-rc7.11. Am I understanding correctly from the above that I have to build from source and tweak out a bit in order to use this enhancement? |
It's because this has been added to master and will be in lmms-1.3.
You either build |
* Add FLAC export, based on WAV renderer * Depend on sndfile>=1.0.18 (previously >=1.0.11) * Add compression option to FLAC export, if available. The code related to compression is only generated if LMMS_HAVE_SF_COMPLEVEL is defined(libsndfile>=1.0.26). * Save into the correct file extension upon single-export. * Use unique_ptr in FLAC renderer and be more expressive about involved types. * Use unique_ptr and remove manual memory management in ExportProjectDialog * Add 'flac' format info to --help and manpage
Implements #3679 by adding a FLAC rendering device to LMMS' Project renderer and related GUI configuration widgets in the export window.
The renderer is implemented in terms of libsndfile and hardens the dependency on it, requiring a minimal version of 1.0.18.
Additionally, since the FLAC compression level settings was not supported in libsndfile until version 1.0.26, a new CPP flag is added, called LMMS_HAVE_SF_COMPLEVEL. It is undefined if the sndfile version is less than 1.0.26. The "Compression Level" GUI element is only visible (and the setting received from it is only respected in the renderer) if LMMS_HAVE_SF_COMPLEVEL is defined.
Unrelated to this new feature, this PR also introduces a minor bug fix regarding the output file extension. If the output format doesn't match the file extension set by the user before the export dialog window opens, the extension will automatically be adjusted when the rendering process starts.