AAdded audio o/p category to playback options

This commit is contained in:
Bill Somerville 2019-05-11 16:43:48 +01:00
parent ab1454a24c
commit 350391d66e
1 changed files with 6 additions and 2 deletions

View File

@ -101,12 +101,13 @@ class Playback final
Q_OBJECT; Q_OBJECT;
public: public:
Playback (int start, BWFFile * input, QAudioDeviceInfo const& sink_device, int notify_interval, int buffer_size) Playback (int start, BWFFile * input, QAudioDeviceInfo const& sink_device, int notify_interval, int buffer_size, QString const& category)
: input_ {input} : input_ {input}
, sink_ {sink_device, input->format ()} , sink_ {sink_device, input->format ()}
, notify_interval_ {notify_interval} , notify_interval_ {notify_interval}
{ {
if (buffer_size) sink_.setBufferSize (input_->format ().bytesForFrames (buffer_size)); if (buffer_size) sink_.setBufferSize (input_->format ().bytesForFrames (buffer_size));
if (category.size ()) sink_.setCategory (category);
if (notify_interval_) if (notify_interval_)
{ {
sink_.setNotifyInterval (notify_interval); sink_.setNotifyInterval (notify_interval);
@ -239,6 +240,9 @@ int main(int argc, char *argv[])
{{"P", "playback-device-number"}, {{"P", "playback-device-number"},
app.translate ("main", "Playback to <device-number>"), app.translate ("main", "Playback to <device-number>"),
app.translate ("main", "device-number")}, app.translate ("main", "device-number")},
{{"C", "category"},
app.translate ("main", "Playback <category-name>"),
app.translate ("main", "category-name")},
{{"n", "notify-interval"}, {{"n", "notify-interval"},
app.translate ("main", "use notify signals every <interval> milliseconds, zero to use a timer"), app.translate ("main", "use notify signals every <interval> milliseconds, zero to use a timer"),
app.translate ("main", "interval")}, app.translate ("main", "interval")},
@ -375,7 +379,7 @@ int main(int argc, char *argv[])
} }
// run the application // run the application
Playback play {start, &input_file, sink, notify_interval, buffer_size}; Playback play {start, &input_file, sink, notify_interval, buffer_size, parser.value ("category")};
QObject::connect (&play, &Playback::done, &app, &QCoreApplication::quit); QObject::connect (&play, &Playback::done, &app, &QCoreApplication::quit);
return app.exec(); return app.exec();
} }