示例#1
0
int main(int argc, char **argv)
{
    const QString errorstr = "Fatal error from the ALSA sequencer. "
        "This usually happens when the kernel doesn't have ALSA support, "
        "or the device node (/dev/snd/seq) doesn't exists, "
        "or the kernel module (snd_seq) is not loaded. "
        "Please check your ALSA/MIDI configuration.";

    CmdLineArgs args;
    signal(SIGINT, signalHandler);
    signal(SIGTERM, signalHandler);

    args.setUsage("[options] port [bpm]");
    args.addRequiredArgument("port", "Destination, MIDI port identifier");
    args.addOptionalArgument("bpm", "Tempo, in beats per minute (default=120)");
    args.parse(argc, argv);

    try {
        metronome = new Metronome();
        QVariant port = args.getArgument("port");
        if (!port.isNull())
            metronome->subscribe(port.toString());
        QVariant bpm = args.getArgument("bpm");
        metronome->play(bpm.toString());
    } catch (const SequencerError& ex) {
        cerr << errorstr + " Returned error was: " + ex.qstrError() << endl;
    } catch (...) {
        cerr << errorstr << endl;
    }
    delete metronome;
    return 0;
}
示例#2
0
int main(int argc, char **argv)
{
    const QString errorstr = "Fatal error from the ALSA sequencer. "
        "This usually happens when the kernel doesn't have ALSA support, "
        "or the device node (/dev/snd/seq) doesn't exists, "
        "or the kernel module (snd_seq) is not loaded. "
        "Please check your ALSA/MIDI configuration.";

    CmdLineArgs args;
    args.setUsage("[port]");
    args.addOptionalArgument("port", "Source MIDI port");
    args.parse(argc, argv);
    try {
        test = new QDumpMIDI();
        signal(SIGINT, signalHandler);
        signal(SIGTERM, signalHandler);
        QVariant portName = args.getArgument("port");
        if (!portName.isNull())
            test->subscribe(portName.toString());
        test->run();
    } catch (const SequencerError& ex) {
        cerr << errorstr + " Returned error was: " + ex.qstrError() << endl;
    } catch (...) {
        cerr << errorstr << endl;
    }
    delete test;
    return 0;
}
示例#3
0
int main(int argc, char *argv[])
{
    QSpyWrk spy;
    CmdLineArgs args;
    args.setUsage("[options] file");
    args.addOption('v', "verbose", "Verbose output");
    args.addRequiredArgument("file", "Input WRK file name");
    args.parse(argc, argv);

    QVariant verbose = args.getOption("verbose");
    if (!verbose.isNull())
        spy.setVerbosity(true);

    QVariantList files = args.getArguments("file");
    QStringList fileNames;
    foreach(const QVariant& a, files) {
        QFileInfo f(a.toString());
        if (f.exists())
            fileNames += f.canonicalFilePath();
        else
            cout << "File not found: " << a.toString() << endl;
    }