Refactor supportedFileExts from AudioFileProcessor

Refactor supported file extensions from AudioFileProcessor to
sampleBuffer, where the magic really happens. Change the hard-
coded MessageBox explaining supported formats to the real deal.
Also added modelines and switched spaces to tabs in the files
affected.
This commit is contained in:
Andrew Kelley
2009-07-16 04:34:11 -07:00
parent c7205351c2
commit 2aae228af4
8 changed files with 57 additions and 21 deletions

View File

@@ -180,4 +180,4 @@ bool LameLibrary::isLoaded()
return m_lameLib != NULL;
}
/* vim: set tw=0 expandtab: */
/* vim: set tw=0 noexpandtab: */

View File

@@ -155,10 +155,10 @@ int main( int argc, char * * argv )
printf( "\nLinux MultiMedia Studio %s\n"
"Copyright (c) 2004-2008 LMMS developers.\n\n"
"usage: lmms [ -r <project file> ] [ options ]\n"
" [ -u <in> <out> ]\n"
" [ -d <in> ]\n"
" [ -h ]\n"
" [ <file to load> ]\n\n"
" [ -u <in> <out> ]\n"
" [ -d <in> ]\n"
" [ -h ]\n"
" [ <file to load> ]\n\n"
"-r, --render <project file> render given project file\n"
"-o, --output <file> render into <file>\n"
"-f, --output-format <format> specify format of render-output where\n"
@@ -227,10 +227,10 @@ int main( int argc, char * * argv )
eff = projectRenderer::OggFile;
}
#endif
else if( ext == "mp3" )
{
eff = projectRenderer::Mp3File;
}
else if( ext == "mp3" )
{
eff = projectRenderer::Mp3File;
}
else
{
printf( "\nInvalid output format %s.\n\n"
@@ -522,3 +522,5 @@ int main( int argc, char * * argv )
#endif
/* vim: set tw=0 noexpandtab: */

View File

@@ -66,6 +66,21 @@
#include "lame_library.h"
const char * sampleBuffer::supportedExts[] = {
"wav",
"ogg",
"ds",
"spx",
"au",
"voc",
"aif",
"aiff",
"flac",
"raw",
"mp3",
NULL
};
sampleBuffer::sampleBuffer( const QString & _audio_file,
bool _is_base64_data ) :
m_audioFile( ( _is_base64_data == true ) ? "" : _audio_file ),
@@ -260,7 +275,8 @@ void sampleBuffer::update( bool _keep_settings )
m_loopStartFrame = m_startFrame = 0;
m_loopEndFrame = m_endFrame = 1;
QString decoders = tr( "wav, ogg, mp3" );
// TODO: this list probably shouldn't be hardcoded
QString decoders = niceListOfExts();
QMessageBox::information( NULL,
QObject::tr( "Unrecognized audio format" ),
QObject::tr( "None of the available audio decoders "
@@ -292,10 +308,22 @@ void sampleBuffer::update( bool _keep_settings )
}
QString sampleBuffer::niceListOfExts() const
{
QString ret = "";
for( const char * * i = supportedExts; *i; ++i )
{
ret.append(*i);
if( *(i+1) )
ret.append(", ");
}
return ret;
}
void sampleBuffer::normalizeSampleRate( const sample_rate_t _src_sr,
bool _keep_settings )
bool _keep_settings )
{
// do samplerate-conversion to our default-samplerate
if( _src_sr != engine::getMixer()->baseSampleRate() )
@@ -1328,4 +1356,4 @@ sampleBuffer::handleState::~handleState()
#endif
/* vim: set tw=0 expandtab: */
/* vim: set tw=0 noexpandtab: */