mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Fix an off by error
This commit is contained in:
parent
8d6c7649e0
commit
c393740b0a
@ -112,10 +112,10 @@ public:
|
|||||||
sink_.setNotifyInterval (notify_interval);
|
sink_.setNotifyInterval (notify_interval);
|
||||||
connect (&sink_, &QAudioOutput::notify, this, &Playback::notify);
|
connect (&sink_, &QAudioOutput::notify, this, &Playback::notify);
|
||||||
}
|
}
|
||||||
|
connect (&sink_, &QAudioOutput::stateChanged, this, &Playback::sink_state_changed);
|
||||||
if (start == -1)
|
if (start == -1)
|
||||||
{
|
{
|
||||||
start_playback ();
|
start_playback ();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -136,7 +136,6 @@ private:
|
|||||||
qtout << "started playback at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC") << endl;
|
qtout << "started playback at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC") << endl;
|
||||||
sink_.start (input_);
|
sink_.start (input_);
|
||||||
qtout << QString {"buffer size used is: %1 (%2 frames)"}.arg (sink_.bufferSize ()).arg (sink_.format ().framesForBytes (sink_.bufferSize ())) << endl;
|
qtout << QString {"buffer size used is: %1 (%2 frames)"}.arg (sink_.bufferSize ()).arg (sink_.format ().framesForBytes (sink_.bufferSize ())) << endl;
|
||||||
connect (&sink_, &QAudioOutput::stateChanged, this, &Playback::sink_state_changed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SLOT void notify ()
|
Q_SLOT void notify ()
|
||||||
@ -160,6 +159,7 @@ private:
|
|||||||
break;
|
break;
|
||||||
case QAudio::IdleState:
|
case QAudio::IdleState:
|
||||||
stop_playback ();
|
stop_playback ();
|
||||||
|
qtout << "\naudio output state changed to idle\n";
|
||||||
break;
|
break;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 10, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK (5, 10, 0)
|
||||||
case QAudio::InterruptedState:
|
case QAudio::InterruptedState:
|
||||||
@ -276,6 +276,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
start = parser.value ("s").toInt (&ok);
|
start = parser.value ("s").toInt (&ok);
|
||||||
if (!ok) throw std::invalid_argument {"start time not a number"};
|
if (!ok) throw std::invalid_argument {"start time not a number"};
|
||||||
|
if (0 > start || start > 59) throw std::invalid_argument {"0 > start > 59"};
|
||||||
}
|
}
|
||||||
int sample_rate {48000};
|
int sample_rate {48000};
|
||||||
if (parser.isSet ("r"))
|
if (parser.isSet ("r"))
|
||||||
@ -344,7 +345,7 @@ int main(int argc, char *argv[])
|
|||||||
audio_format.setSampleType (QAudioFormat::SignedInt);
|
audio_format.setSampleType (QAudioFormat::SignedInt);
|
||||||
audio_format.setCodec ("audio/pcm");
|
audio_format.setCodec ("audio/pcm");
|
||||||
|
|
||||||
auto source = input_device ? input_devices[input_device] : QAudioDeviceInfo::defaultInputDevice ();
|
auto source = input_device ? input_devices[input_device - 1] : QAudioDeviceInfo::defaultInputDevice ();
|
||||||
if (!source.isFormatSupported (audio_format))
|
if (!source.isFormatSupported (audio_format))
|
||||||
{
|
{
|
||||||
qtout << "warning, requested format not supported, using nearest" << endl;
|
qtout << "warning, requested format not supported, using nearest" << endl;
|
||||||
@ -367,7 +368,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
BWFFile input_file {audio_format, ifi.filePath ()};
|
BWFFile input_file {audio_format, ifi.filePath ()};
|
||||||
if (!input_file.open (BWFFile::ReadOnly)) throw std::invalid_argument {QString {"cannot open input file \"%1\""}.arg (ifi.filePath ()).toStdString ()};
|
if (!input_file.open (BWFFile::ReadOnly)) throw std::invalid_argument {QString {"cannot open input file \"%1\""}.arg (ifi.filePath ()).toStdString ()};
|
||||||
auto sink = output_device ? output_devices[output_device] : QAudioDeviceInfo::defaultOutputDevice ();
|
auto sink = output_device ? output_devices[output_device - 1] : QAudioDeviceInfo::defaultOutputDevice ();
|
||||||
if (!sink.isFormatSupported (input_file.format ()))
|
if (!sink.isFormatSupported (input_file.format ()))
|
||||||
{
|
{
|
||||||
throw std::invalid_argument {"audio output device does not support input file audio format"};
|
throw std::invalid_argument {"audio output device does not support input file audio format"};
|
||||||
|
Loading…
Reference in New Issue
Block a user