Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,32 @@ Current version: v1.4.1

Qt5.15 C++17

## Command-line options

Pass `--server` to enable the Remote API server automatically when Open Sound Meter
starts. This is equivalent to turning on **Server** in the Remote API panel and is
useful for login/startup shortcuts:

```powershell
# Windows (from the installation directory)
.\OpenSoundMeter.exe --server
```

```sh
# macOS
open -a OpenSoundMeter --args --server

# Linux
./OpenSoundMeter --server
```

The application still opens its normal graphical interface and requires a desktop
session. The option applies only to this launch; without it, the server remains
off at startup. The Server switch can still be used to stop and restart it.
Remote generator control remains a separate option in the Remote API panel.

Use `--help` to list options or `--version` to print the application version.


## SAST Tools

Expand Down
13 changes: 13 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QApplication>
#include <QCommandLineParser>
#include <QQmlApplicationEngine>
#include <QtQuick/QQuickView>
#include <QQuickStyle>
Expand Down Expand Up @@ -84,6 +85,14 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("opensoundmeter");
QCoreApplication::setOrganizationDomain("opensoundmeter.com");

QCommandLineParser parser;
parser.setApplicationDescription("Sound measurement software for tuning sound systems.");
parser.addHelpOption();
parser.addVersionOption();
const QCommandLineOption serverOption("server", "Start the Remote API server with the application.");
parser.addOption(serverOption);
parser.process(app);

Settings settings;
Appearance appearence(&settings);
audio::Client::getInstance();
Expand Down Expand Up @@ -141,5 +150,9 @@ int main(int argc, char *argv[])
if (engine.rootObjects().isEmpty())
return -1;

if (parser.isSet(serverOption)) {
server.setActive(true);
}

return QApplication::exec();
}