Skip to content
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 MP3 import #6750

Merged
merged 12 commits into from
Nov 1, 2023
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ SET(QT_QTTEST_LIBRARY Qt5::Test)

# check for libsndfile
FIND_PACKAGE(SndFile REQUIRED)
IF(NOT SNDFILE_FOUND)
IF(SNDFILE_FOUND)
IF(SndFile_VERSION VERSION_GREATER_EQUAL "1.1.0")
SET(LMMS_HAVE_SNDFILE_MP3 TRUE)
ELSE()
MESSAGE("libsndfile version is < 1.1.0; MP3 import disabled")
SET(LMMS_HAVE_SNDFILE_MP3 FALSE)
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "LMMS requires libsndfile1 and libsndfile1-dev >= 1.0.18 - please install, remove CMakeCache.txt and try again!")
ENDIF()
# check if we can use SFC_SET_COMPRESSION_LEVEL
Expand Down
6 changes: 5 additions & 1 deletion plugins/AudioFileProcessor/AudioFileProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ Plugin::Descriptor PLUGIN_EXPORT audiofileprocessor_plugin_descriptor =
0x0100,
Plugin::Type::Instrument,
new PluginPixmapLoader( "logo" ),
"wav,ogg,ds,spx,au,voc,aif,aiff,flac,raw",
"wav,ogg,ds,spx,au,voc,aif,aiff,flac,raw"
#ifdef LMMS_HAVE_SNDFILE_MP3
",mp3"
#endif
,
nullptr,
} ;

Expand Down
7 changes: 5 additions & 2 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,11 @@ bool DataFile::validate( QString extension )
{
return true;
}
if( extension == "wav" || extension == "ogg" ||
extension == "ds" )
if( extension == "wav" || extension == "ogg" || extension == "ds"
#ifdef LMMS_HAVE_SNDFILE_MP3
|| extension == "mp3"
#endif
)
{
return true;
}
Expand Down
10 changes: 8 additions & 2 deletions src/core/SampleBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,14 +1185,20 @@ QString SampleBuffer::openAudioFile() const

// set filters
QStringList types;
types << tr("All Audio-Files (*.wav *.ogg *.ds *.flac *.spx *.voc "
types << tr("All Audio-Files (*.wav *.ogg "
#ifdef LMMS_HAVE_SNDFILE_MP3
"*.mp3 "
#endif
"*.ds *.flac *.spx *.voc "
"*.aif *.aiff *.au *.raw)")
<< tr("Wave-Files (*.wav)")
<< tr("OGG-Files (*.ogg)")
#ifdef LMMS_HAVE_SNDFILE_MP3
<< tr("MP3-Files (*.mp3)")
#endif
<< tr("DrumSynth-Files (*.ds)")
<< tr("FLAC-Files (*.flac)")
<< tr("SPEEX-Files (*.spx)")
//<< tr("MP3-Files (*.mp3)")
//<< tr("MIDI-Files (*.mid)")
<< tr("VOC-Files (*.voc)")
<< tr("AIFF-Files (*.aif *.aiff)")
Expand Down
1 change: 1 addition & 0 deletions src/lmmsconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#cmakedefine LMMS_HAVE_LV2
#cmakedefine LMMS_HAVE_SUIL
#cmakedefine LMMS_HAVE_MP3LAME
#cmakedefine LMMS_HAVE_SNDFILE_MP3
#cmakedefine LMMS_HAVE_OGGVORBIS
#cmakedefine LMMS_HAVE_OSS
#cmakedefine LMMS_HAVE_SNDIO
Expand Down