1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Fixes processing cap and attempts full-rate video output.

Audio now seems to be present, though hugely stuttered.
This commit is contained in:
Thomas Harte 2020-06-06 19:47:35 -04:00
parent 378ff39e5e
commit fe1b6812f1
3 changed files with 17 additions and 2 deletions

View File

@ -181,6 +181,8 @@ void MainWindow::launchMachine() {
audioOutput = std::make_unique<QAudioOutput>(idealFormat, this); audioOutput = std::make_unique<QAudioOutput>(idealFormat, this);
audioOutput->setBufferSize(samplesPerBuffer * (audioIsStereo ? 2 : 1) * (audioIs8bit ? 1 : 2)); audioOutput->setBufferSize(samplesPerBuffer * (audioIsStereo ? 2 : 1) * (audioIs8bit ? 1 : 2));
qDebug() << idealFormat;
// Start the output. // Start the output.
speaker->set_delegate(this); speaker->set_delegate(this);
audioIODevice = audioOutput->start(); audioIODevice = audioOutput->start();

View File

@ -4,12 +4,16 @@
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QTimer> #include <QTimer>
#include "../../ClockReceiver/TimeTypes.hpp"
ScanTargetWidget::ScanTargetWidget(QWidget *parent) : QOpenGLWidget(parent) {} ScanTargetWidget::ScanTargetWidget(QWidget *parent) : QOpenGLWidget(parent) {}
ScanTargetWidget::~ScanTargetWidget() {} ScanTargetWidget::~ScanTargetWidget() {}
void ScanTargetWidget::initializeGL() { void ScanTargetWidget::initializeGL() {
glClearColor(0.5, 0.5, 1.0, 1.0); glClearColor(0.5, 0.5, 1.0, 1.0);
// Follow each swapped frame with an additional update.
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
// qDebug() << "share context: " << bool(context()->shareGroup()); // qDebug() << "share context: " << bool(context()->shareGroup());
} }
@ -18,7 +22,15 @@ void ScanTargetWidget::paintGL() {
if(scanTarget) { if(scanTarget) {
scanTarget->update(width(), height()); scanTarget->update(width(), height());
scanTarget->draw(width(), height()); scanTarget->draw(width(), height());
QTimer::singleShot(500, this, SLOT(update())); // TODO: obviously this is nonsense.
// static int64_t start = 0;
// static int frames = 0;
// if(!start) start = Time::nanos_now();
// else {
// ++frames;
// const int64_t now = Time::nanos_now();
// qDebug() << double(frames) * 1e9 / double(now - start);
// }
} }
} }

View File

@ -14,7 +14,8 @@ void Timer::setMachine(MachineTypes::TimedMachine *machine, std::mutex *machineM
void Timer::tick() { void Timer::tick() {
const auto now = Time::nanos_now(); const auto now = Time::nanos_now();
const auto duration = std::min(now - lastTickNanos, int64_t(500'000)); const auto duration = std::min(now - lastTickNanos, int64_t(500'000'000));
// qDebug() << duration << " [not " << now - lastTickNanos << "]";
lastTickNanos = now; lastTickNanos = now;
std::lock_guard lock_guard(*machineMutex); std::lock_guard lock_guard(*machineMutex);