-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds vt sequence DECPS
#735
Conversation
ad20f76
to
18c5b51
Compare
a360bdb
to
e142d4f
Compare
f8eacf8
to
645f05d
Compare
@Utkarsh-khambra with regards to the build failures when building using Qt6 (the one CI test), the I hope it's possible to Do we actually have any possibility to run Qt6 on Linux already (with what distro)? Hmm... |
Fedora has qt6 package in their repo. |
645f05d
to
d1e35cb
Compare
I think here the test should be sufficient if it's abstractr, not testing the actual audio but only if it's forwarded correctly to the event listener. |
11ec7ec
to
bd0a9a5
Compare
ff56184
to
ffec9ca
Compare
9ed82b3
to
24fffad
Compare
ce8430e
to
ab8ff70
Compare
@Utkarsh-khambra my modifications (squashed) diff --git a/src/contour/Audio.cpp b/src/contour/Audio.cpp
index d8050edb..01bd527d 100644
--- a/src/contour/Audio.cpp
+++ b/src/contour/Audio.cpp
@@ -42,6 +42,7 @@ Audio::Audio()
QAudioFormat f;
f.setSampleRate(44100);
f.setChannelCount(1);
+
#if QT_VERSION >= 0x060000
f.setSampleFormat(QAudioFormat::Int16);
QAudioDevice info(QMediaDevices::defaultAudioOutput());
@@ -51,24 +52,23 @@ Audio::Audio()
f.setByteOrder(QAudioFormat::LittleEndian);
f.setSampleType(QAudioFormat::SignedInt);
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
-
#endif
+
if (!info.isFormatSupported(f))
{
errorlog()("Default output device doesn't support 16 Bit signed integer PCM");
return;
}
-#if QT_VERSION >= 0x060000
- audio = std::make_unique<QAudioSink>(f);
-#else
- audio = std::make_unique<QAudioOutput>(f);
+
+#if QT_VERSION < 0x060000
+ using QAudioSink = QAudioOutput;
#endif
+
+ audio = std::make_unique<QAudioSink>(f);
+
audio->moveToThread(&soundThread_);
-#if QT_VERSION >= 0x060000
+
connect(audio.get(), &QAudioSink::stateChanged, this, &Audio::handleStateChanged);
-#else
- connect(audio.get(), &QAudioOutput::stateChanged, this, &Audio::handleStateChanged);
-#endif
qRegisterMetaType<std::vector<int>>();
connect(this, &Audio::play, this, &Audio::handlePlayback);
soundThread_.start();
@@ -80,17 +80,18 @@ Audio::~Audio()
soundThread_.wait();
}
-void Audio::fillBuffer(int volume, int duration, crispy::span<const int> notes)
+void Audio::fillBuffer(int volume, int duration, crispy::span<int const> notes)
{
- for (auto i: notes)
+ for (auto const i: notes)
{
auto b = createMusicalNote(volume, duration, i);
- byteArray_.append(reinterpret_cast<const char*>(b.data()), static_cast<int>(2 * b.size()));
+ byteArray_.append(reinterpret_cast<char const*>(b.data()), static_cast<int>(2 * b.size()));
}
}
void Audio::handlePlayback(int volume, int duration, std::vector<int> const& notes)
{
+ Require(audio);
if (audio->state() == QAudio::State::ActiveState)
{
fillBuffer(volume, duration, crispy::span(notes.data(), notes.size()));
@@ -99,8 +100,7 @@ void Audio::handlePlayback(int volume, int duration, std::vector<int> const& not
fillBuffer(volume, duration, crispy::span(notes.data(), notes.size()));
audioBuffer_.setBuffer(&byteArray_);
audioBuffer_.open(QIODevice::ReadWrite);
- if (audio)
- audio->start(&audioBuffer_);
+ audio->start(&audioBuffer_);
}
void Audio::handleStateChanged(QAudio::State state) |
ab8ff70
to
f7edc95
Compare
closes #237