Implement command line export for MP3 (#3641)
Add the option 'mp3' to the format switch (-f / --format) if LMMS is compiled with MP3 support. Add the new switch 'mode' which can be used to set the stereo mode used for the MP3 export. Adjust the man page for the new options.
This commit is contained in:
committed by
Oskar Wallgren
parent
fc6d844a92
commit
842c7194b0
@@ -124,6 +124,7 @@ void printHelp()
|
||||
" [ -i <method> ]\n"
|
||||
" [ --import <in> [-e]]\n"
|
||||
" [ -l ]\n"
|
||||
" [ -m <mode>]\n"
|
||||
" [ -o <path> ]\n"
|
||||
" [ -p <out> ]\n"
|
||||
" [ -r <project file> ] [ options ]\n"
|
||||
@@ -138,7 +139,7 @@ void printHelp()
|
||||
"-c, --config <configfile> Get the configuration from <configfile>\n"
|
||||
"-d, --dump <in> Dump XML of compressed file <in>\n"
|
||||
"-f, --format <format> Specify format of render-output where\n"
|
||||
" Format is either 'wav' or 'ogg'.\n"
|
||||
" Format is either 'wav', 'ogg' or 'mp3'.\n"
|
||||
" --geometry <geometry> Specify the size and position of the main window\n"
|
||||
" geometry is <xsizexysize+xoffset+yoffsety>.\n"
|
||||
"-h, --help Show this usage information and exit.\n"
|
||||
@@ -151,6 +152,12 @@ void printHelp()
|
||||
" --import <in> [-e] Import MIDI file <in>.\n"
|
||||
" If -e is specified lmms exits after importing the file.\n"
|
||||
"-l, --loop Render as a loop\n"
|
||||
"-m, --mode Stereo mode used for MP3 export\n"
|
||||
" Possible values: s, j, m\n"
|
||||
" s: Stereo\n"
|
||||
" j: Joint Stereo\n"
|
||||
" m: Mono\n"
|
||||
" Default: j\n"
|
||||
"-o, --output <path> Render into <path>\n"
|
||||
" For --render, provide a file path\n"
|
||||
" For --rendertracks, provide a directory path\n"
|
||||
@@ -260,7 +267,7 @@ int main( int argc, char * * argv )
|
||||
new MainApplication( argc, argv );
|
||||
|
||||
Mixer::qualitySettings qs( Mixer::qualitySettings::Mode_HighQuality );
|
||||
OutputSettings os( 44100, OutputSettings::BitRateSettings(160, false), OutputSettings::Depth_16Bit );
|
||||
OutputSettings os( 44100, OutputSettings::BitRateSettings(160, false), OutputSettings::Depth_16Bit, OutputSettings::StereoMode_JointStereo );
|
||||
ProjectRenderer::ExportFileFormats eff = ProjectRenderer::WaveFile;
|
||||
|
||||
// second of two command-line parsing stages
|
||||
@@ -391,6 +398,12 @@ int main( int argc, char * * argv )
|
||||
{
|
||||
eff = ProjectRenderer::OggFile;
|
||||
}
|
||||
#endif
|
||||
#ifdef LMMS_HAVE_MP3LAME
|
||||
else if( ext == "mp3" )
|
||||
{
|
||||
eff = ProjectRenderer::MP3File;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
@@ -446,6 +459,38 @@ int main( int argc, char * * argv )
|
||||
else
|
||||
{
|
||||
printf( "\nInvalid bitrate %s.\n\n"
|
||||
"Try \"%s --help\" for more information.\n\n", argv[i], argv[0] );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
else if( arg == "--mode" || arg == "-m" )
|
||||
{
|
||||
++i;
|
||||
|
||||
if( i == argc )
|
||||
{
|
||||
printf( "\nNo stereo mode specified.\n\n"
|
||||
"Try \"%s --help\" for more information.\n\n", argv[0] );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
QString const mode( argv[i] );
|
||||
|
||||
if( mode == "s" )
|
||||
{
|
||||
os.setStereoMode(OutputSettings::StereoMode_Stereo);
|
||||
}
|
||||
else if( mode == "j" )
|
||||
{
|
||||
os.setStereoMode(OutputSettings::StereoMode_JointStereo);
|
||||
}
|
||||
else if( mode == "m" )
|
||||
{
|
||||
os.setStereoMode(OutputSettings::StereoMode_Mono);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "\nInvalid stereo mode %s.\n\n"
|
||||
"Try \"%s --help\" for more information.\n\n", argv[i], argv[0] );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user