Add MP3 import (#6750)

This commit is contained in:
Lost Robot
2023-11-01 15:37:56 -07:00
committed by GitHub
parent 7b99c58926
commit fccbe5d517
5 changed files with 27 additions and 6 deletions

View File

@@ -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

View File

@@ -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,
} ;

View File

@@ -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;
}

View File

@@ -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)")

View File

@@ -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