diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-01-18 07:14:42 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2017-01-18 07:14:42 +0000 |
| commit | 63223b02008d1979cb8b05ec2c7db903682b576c (patch) | |
| tree | 087ddcd957232a73cbb8d482f512ca587af9cac0 /src/plugins/Visual/projectm/projectmplugin.cpp | |
| parent | c60c6025069c3f9a4590a1742682564b61c2c1a1 (diff) | |
| download | qmmp-63223b02008d1979cb8b05ec2c7db903682b576c.tar.gz qmmp-63223b02008d1979cb8b05ec2c7db903682b576c.tar.bz2 qmmp-63223b02008d1979cb8b05ec2c7db903682b576c.zip | |
projectm: fixed build
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@6992 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Visual/projectm/projectmplugin.cpp')
| -rw-r--r-- | src/plugins/Visual/projectm/projectmplugin.cpp | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/src/plugins/Visual/projectm/projectmplugin.cpp b/src/plugins/Visual/projectm/projectmplugin.cpp index a3efab8e1..e691dd89f 100644 --- a/src/plugins/Visual/projectm/projectmplugin.cpp +++ b/src/plugins/Visual/projectm/projectmplugin.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009-2015 by Ilya Kotov * + * Copyright (C) 2009-2017 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -37,6 +37,7 @@ ProjectMPlugin::ProjectMPlugin (QWidget *parent) : Visual (parent, Qt::Window | Qt::MSWindowsOwnDC) { + m_running = false; setlocale(LC_NUMERIC, "C"); //fixes problem with none-english locales setWindowTitle(tr("ProjectM")); setWindowIcon(parent->windowIcon()); @@ -62,51 +63,55 @@ ProjectMPlugin::ProjectMPlugin (QWidget *parent) restoreGeometry(settings.value("ProjectM/geometry").toByteArray()); m_splitter->setSizes(QList<int>() << 300 << 300); m_splitter->restoreState(settings.value("ProjectM/splitter_sizes").toByteArray()); + + m_timer = new QTimer(this); + m_timer->setInterval(0); + connect(m_timer, SIGNAL(timeout()), SLOT(onTimeout())); } ProjectMPlugin::~ProjectMPlugin() {} -void ProjectMPlugin::clear() +void ProjectMPlugin::start() { - update(); + m_running = true; + if(isVisible()) + m_timer->start(); } -void ProjectMPlugin::setFullScreen(bool yes) +void ProjectMPlugin::stop() { - if(yes) - setWindowState(windowState() | Qt::WindowFullScreen); - else - setWindowState(windowState() & ~Qt::WindowFullScreen); + m_timer->stop(); + m_running = false; + update(); } -void ProjectMPlugin::add (float *data, size_t samples, int chan) +void ProjectMPlugin::onTimeout() { projectM *instance = m_projectMWidget->projectMInstance(); if (!instance) return; - size_t frames = qMin(samples / chan, (size_t)512); - - if(chan == 1) + if(takeData(m_left, m_right)) { - for(size_t i = 0; i < frames; i++) + for(size_t i = 0; i < 512; i++) { - m_buf[0][i] = data[i*chan] * 32767.0; - m_buf[1][i] = data[i*chan] * 32767.0; + m_buf[0][i] = m_left[i] * 32767.0; + m_buf[1][i] = m_right[i] * 32767.0; } - } - else - { - for(size_t i = 0; i < frames; i++) - { - m_buf[0][i] = data[i*chan] * 32767.0; - m_buf[1][i] = data[i*chan+1] * 32767.0; - } + m_projectMWidget->projectMInstance()->pcm()->addPCM16(m_buf); } - m_projectMWidget->projectMInstance()->pcm()->addPCM16(m_buf); + m_projectMWidget->updateGL(); +} + +void ProjectMPlugin::setFullScreen(bool yes) +{ + if(yes) + setWindowState(windowState() | Qt::WindowFullScreen); + else + setWindowState(windowState() & ~Qt::WindowFullScreen); } void ProjectMPlugin::closeEvent (QCloseEvent *event) @@ -117,3 +122,13 @@ void ProjectMPlugin::closeEvent (QCloseEvent *event) settings.setValue("ProjectM/splitter_sizes", m_splitter->saveState()); Visual::closeEvent(event); //removes visualization object } + +void ProjectMPlugin::showEvent(QShowEvent *) +{ + m_timer->start(); +} + +void ProjectMPlugin::hideEvent(QHideEvent *) +{ + m_timer->stop(); +} |
