diff --git a/doc/lmms.1 b/doc/lmms.1 index bed99fd1d..b9c297caf 100644 --- a/doc/lmms.1 +++ b/doc/lmms.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH LMMS 1 "June 23, 2015" +.TH LMMS 1 "February 17, 2016" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -19,13 +19,58 @@ lmms \- software for easy music production .SH SYNOPSIS .B lmms +.RB "[ \--\fBallowroot\fP ]" +.br +.B lmms +.RB "[ \--\fBbitrate\fP \fIbitrate\fP ]" +.br +.B lmms +.RB "[ \--\fBconfig\fP \fIconfigfile\fP ]" +.br +.B lmms +.RB "[ \--\fBdump\fP \fIin\fP ]" +.br +.B lmms +.RB "[ \--\fBfloat\fP ]" +.br +.B lmms +.RB "[ \--\fBformat\fP \fIformat\fP ]" +.br +.B lmms +.RB "[ \--\fBgeometry\fP \fIgeometry\fP ]" +.br +.B lmms +.RB "[ \--\fBhelp\fP ]" +.br +.B lmms +.RB "[ \--\interpolation\fP \fImethod\fP ]" +.br +.B lmms +.RB "[ \--\fBimport\fP \fIin\fP [ \-e ] ]" +.br +.B lmms +.RB "[ \--\fBloop\fP ]" +.br +.B lmms +.RB "[ \--\fBoutput\fP \fIpath\fP ]" +.br +.B lmms +.RB "[ \--\fBoversampling\fP \fIvalue\fP ]" +.br +.B lmms +.RB "[ \--\fBprofile\fP \fIout\fP ]" +.br +.B lmms .RB "[ \--\fBrender\fP \fIfile\fP ] [options]" .br .B lmms +.RB "[ \--\fBsamplerate\fP \fIsamplerate\fP ]" +.br +.B lmms .RB "[ \--\fBupgrade\fP \fIin\fP \fIout\fP ]" .br .B lmms -.RB "[ \--\fBdump\fP \fIin\fP ]" +.RB "[ \--\fBversion\fP ]" .br .B lmms .RI "[ file ]" @@ -40,38 +85,54 @@ LMMS is a free cross-platform alternative to commercial programs like FL Studio LMMS features components such as a Song Editor, a Beat+Bassline Editor, a Piano Roll, an FX Mixer as well as many powerful instruments and effects. .SH OPTIONS -.IP "\fB\-r, --render\fP \fIproject-file\fP -Render given file to either a wav\- or ogg\-file. See \fB\-f\fP for details -.IP "\fB\-r, --rendertracks\fP \fIproject-file\fP -Render each track into a separate wav\- or ogg\-file. See \fB\-f\fP for details +.IP "\fB\-a, --float\fP +32bit float bit depth +.IP "\fB\-b, --bitrate\fP \fIbitrate\fP +Specify output bitrate in KBit/s (for OGG encoding only), default is 160 +.IP "\fB\-c, --config\fP \fIconfigfile\fP +Get the configuration from \fIconfigfile\fP instead of ~/.lmmsrc.xml (default) +.IP "\fB\-d, --dump\fP \fIin\fP +Dump XML of compressed file \fIin\fP (i.e. MMPZ-file) +.IP "\fB\-f, --format\fP \fIformat\fP +Specify format of render-output where \fIformat\fP is either 'wav' or 'ogg' +.IP "\fB\ --geometry\fP \fIgeometry\fP +Specify the prefered size and position of the main window +.br +\fIgeometry\fP syntax is <\fIxsize\fPx\fIysize\fP+\fIxoffset\fP+\fIyoffset\fP>. +.br +Default: full screen +.IP "\fB\-h, --help\fP +Show usage information and exit. +.IP "\fB\-i, --interpolation\fP \fImethod\fP +Specify interpolation method - possible values are \fIlinear\fP, \fIsincfastest\fP (default), \fIsincmedium\fP, \fIsincbest\fP +.IP "\fB\ --import\fP \fIin\fP \fB\-e\fP +Import MIDI file \fIin\fP +.br +If -e is specified lmms exits after importing the file. +.IP "\fB\-l, --loop +Render the given file as a loop, i.e. stop rendering at exactly the end of the song. Additional silence or reverb tails at the end of the song are not rendered. .IP "\fB\-o, --output\fP \fIpath\fP Render into \fIpath\fP .br For --render, this is interpreted as a file path. .br For --render-tracks, this is interpreted as a path to an existing directory. -.IP "\fB\-f, --format\fP \fIformat\fP -Specify format of render-output where \fIformat\fP is either 'wav' or 'ogg' +IP "\fB\-p, --profile\fP \fIout\fP +Dump profiling information to file \fIout\fP +.IP "\fB\-r, --render\fP \fIproject-file\fP +Render given file to either a wav\- or ogg\-file. See \fB\-f\fP for details +.IP "\fB\-r, --rendertracks\fP \fIproject-file\fP +Render each track into a separate wav\- or ogg\-file. See \fB\-f\fP for details .IP "\fB\-s, --samplerate\fP \fIsamplerate\fP Specify output samplerate in Hz - range is 44100 (default) to 192000 -.IP "\fB\-b, --bitrate\fP \fIbitrate\fP -Specify output bitrate in KBit/s (for OGG encoding only), default is 160 -.IP "\fB\-i, --interpolation\fP \fImethod\fP -Specify interpolation method - possible values are \fIlinear\fP, \fIsincfastest\fP (default), \fIsincmedium\fP, \fIsincbest\fP -.IP "\fB\-x, --oversampling\fP \fIvalue\fP -Specify oversampling, possible values: 1, 2 (default), 4, 8 -.IP "\fB\-l, --loop -Render the given file as a loop, i.e. stop rendering at exactly the end of the song. Additional silence or reverb tails at the end of the song are not rendered. .IP "\fB\-u, --upgrade\fP \fIin\fP \fIout\fP Upgrade file \fIin\fP and save as \fIout\fP -.IP "\fB\-d, --dump\fP \fIin\fP -Dump XML of compressed file \fIin\fP (i.e. MMPZ-file) .IP "\fB\-v, --version Show version information and exit. +.IP "\fB\-x, --oversampling\fP \fIvalue\fP +Specify oversampling, possible values: 1, 2 (default), 4, 8 .IP "\fB\ --allowroot Bypass root user startup check (use with caution). -.IP "\fB\-h, --help -Show usage information and exit. .SH SEE ALSO .BR https://lmms.io/ .BR https://lmms.io/documentation/ diff --git a/include/ConfigManager.h b/include/ConfigManager.h index 08224e990..b3b1b326d 100644 --- a/include/ConfigManager.h +++ b/include/ConfigManager.h @@ -230,7 +230,7 @@ public: const QString & value ); void deleteValue( const QString & cls, const QString & attribute); - void loadConfigFile(); + void loadConfigFile( const QString & configFile = "" ); void saveConfigFile(); @@ -260,7 +260,7 @@ private: void upgrade_1_1_90(); void upgrade(); - const QString m_lmmsRcFile; + QString m_lmmsRcFile; QString m_workingDir; QString m_dataDir; QString m_artworkDir; diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index b81bad200..819e67746 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -63,14 +63,16 @@ ConfigManager::ConfigManager() : if (! qgetenv("LMMS_DATA_DIR").isEmpty()) QDir::addSearchPath("data", QString::fromLocal8Bit(qgetenv("LMMS_DATA_DIR"))); - // If we're in development (lmms is not installed) let's get the source - // directory by reading the CMake Cache + // If we're in development (lmms is not installed) let's get the source and + // binary directories by reading the CMake Cache QFile cmakeCache(qApp->applicationDirPath() + "/CMakeCache.txt"); if (cmakeCache.exists()) { cmakeCache.open(QFile::ReadOnly); QTextStream stream(&cmakeCache); - // Find the line containing something like lmms_SOURCE_DIR:static= + // Find the lines containing something like lmms_SOURCE_DIR:static= + // and lmms_BINARY_DIR:static= + int done = 0; while(! stream.atEnd()) { QString line = stream.readLine(); @@ -78,6 +80,15 @@ ConfigManager::ConfigManager() : if (line.startsWith("lmms_SOURCE_DIR:")) { QString srcDir = line.section('=', -1).trimmed(); QDir::addSearchPath("data", srcDir + "/data/"); + done++; + } + if (line.startsWith("lmms_BINARY_DIR:")) { + m_lmmsRcFile = line.section('=', -1).trimmed() + QDir::separator() + + ".lmmsrc.xml"; + done++; + } + if (done == 2) + { break; } } @@ -331,9 +342,15 @@ void ConfigManager::deleteValue( const QString & cls, const QString & attribute) } -void ConfigManager::loadConfigFile() +void ConfigManager::loadConfigFile( const QString & configFile ) { // read the XML file and create DOM tree + // Allow configuration file override through --config commandline option + if ( !configFile.isEmpty() ) + { + m_lmmsRcFile = configFile; + } + QFile cfg_file( m_lmmsRcFile ); QDomDocument dom_tree; diff --git a/src/core/main.cpp b/src/core/main.cpp index 3faa80584..88c613a84 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -116,39 +116,58 @@ void printHelp() { printf( "LMMS %s\n" "Copyright (c) %s\n\n" - "Usage: lmms [ -r ] [ options ]\n" - " [ -u ]\n" + "Usage: lmms [ -a ]\n" + " [ -b ]\n" + " [ -c ]\n" " [ -d ]\n" + " [ -f ]\n" + " [ --geometry ]\n" " [ -h ]\n" + " [ -i ]\n" + " [ --import [-e]]\n" + " [ -l ]\n" + " [ -o ]\n" + " [ -p ]\n" + " [ -r ] [ options ]\n" + " [ -s ]\n" + " [ -u ]\n" + " [ -v ]\n" + " [ -x ]\n" " [ ]\n\n" - "-r, --render Render given project file\n" - " --rendertracks Render each track to a different file\n" - "-o, --output Render into \n" - " For --render, provide a file path\n" - " For --rendertracks, provide a directory path\n" - "-f, --format Specify format of render-output where\n" - " Format is either 'wav' or 'ogg'.\n" - "-s, --samplerate Specify output samplerate in Hz\n" - " Range: 44100 (default) to 192000\n" - "-b, --bitrate Specify output bitrate in KBit/s\n" - " Default: 160.\n" - "-i, --interpolation Specify interpolation method\n" - " Possible values:\n" - " - linear\n" - " - sincfastest (default)\n" - " - sincmedium\n" - " - sincbest\n" - "-x, --oversampling Specify oversampling\n" - " Possible values: 1, 2, 4, 8\n" - " Default: 2\n" - "-a, --float 32bit float bit depth\n" - "-l, --loop Render as a loop\n" - "-u, --upgrade [out] Upgrade file and save as \n" + "-a, --float 32bit float bit depth\n" + "-b, --bitrate Specify output bitrate in KBit/s\n" + " Default: 160.\n" + "-c, --config Get the configuration from \n" + "-d, --dump Dump XML of compressed file \n" + "-f, --format Specify format of render-output where\n" + " Format is either 'wav' or 'ogg'.\n" + " --geometry Specify the size and position of the main window\n" + " geometry is .\n" + "-h, --help Show this usage information and exit.\n" + "-i, --interpolation Specify interpolation method\n" + " Possible values:\n" + " - linear\n" + " - sincfastest (default)\n" + " - sincmedium\n" + " - sincbest\n" + " --import [-e] Import MIDI file .\n" + " If -e is specified lmms exits after importing the file.\n" + "-l, --loop Render as a loop\n" + "-o, --output Render into \n" + " For --render, provide a file path\n" + " For --rendertracks, provide a directory path\n" + "-p, --profile Dump profiling information to file \n" + "-r, --render Render given project file\n" + " --rendertracks Render each track to a different file\n" + "-s, --samplerate Specify output samplerate in Hz\n" + " Range: 44100 (default) to 192000\n" + "-u, --upgrade [out] Upgrade file and save as \n" " Standard out is used if no output file is specifed\n" - "-d, --dump Dump XML of compressed file \n" - "-v, --version Show version information and exit.\n" - " --allowroot Bypass root user startup check (use with caution).\n" - "-h, --help Show this usage information and exit.\n\n", + "-v, --version Show version information and exit.\n" + " --allowroot Bypass root user startup check (use with caution).\n" + "-x, --oversampling Specify oversampling\n" + " Possible values: 1, 2, 4, 8\n" + " Default: 2\n\n", LMMS_VERSION, LMMS_PROJECT_COPYRIGHT ); } @@ -172,7 +191,7 @@ int main( int argc, char * * argv ) bool allowRoot = false; bool renderLoop = false; bool renderTracks = false; - QString fileToLoad, fileToImport, renderOut, profilerOutputFile; + QString fileToLoad, fileToImport, renderOut, profilerOutputFile, configFile; // first of two command-line parsing stages for( int i = 1; i < argc; ++i ) @@ -194,8 +213,13 @@ int main( int argc, char * * argv ) { allowRoot = true; } - else if( arg == "-geometry" ) + else if( arg == "--geometry" || arg == "-geometry") { + if( arg == "--geometry" ) + { + // Delete the first "-" so Qt recognize the option + strcpy(argv[i], "-geometry"); + } // option -geometry is filtered by Qt later, // so we need to check its presence now to // determine, if the application should run in @@ -514,7 +538,20 @@ int main( int argc, char * * argv ) } - profilerOutputFile = QString::fromLocal8Bit( argv[1] ); + profilerOutputFile = QString::fromLocal8Bit( argv[i] ); + } + else if( arg == "--config" || arg == "-c" ) + { + ++i; + + if( i == argc ) + { + printf( "\nNo configuration file specified.\n\n" + "Try \"%s --help\" for more information.\n\n", argv[0] ); + return EXIT_FAILURE; + } + + configFile = QString::fromLocal8Bit( argv[i] ); } else { @@ -529,7 +566,7 @@ int main( int argc, char * * argv ) } - ConfigManager::inst()->loadConfigFile(); + ConfigManager::inst()->loadConfigFile(configFile); // set language QString pos = ConfigManager::inst()->value( "app", "language" );