aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'qmidiplayer-desktop')
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.cpp26
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.hpp2
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp4
3 files changed, 31 insertions, 1 deletions
diff --git a/qmidiplayer-desktop/qmpmainwindow.cpp b/qmidiplayer-desktop/qmpmainwindow.cpp
index de15412..73724ec 100644
--- a/qmidiplayer-desktop/qmpmainwindow.cpp
+++ b/qmidiplayer-desktop/qmpmainwindow.cpp
@@ -425,7 +425,7 @@ void qmpMainWindow::on_hsTimer_sliderReleased()
}
else
{
- if(stopped){ui->hsTimer->setValue(0);}return;
+ if(stopped){ui->hsTimer->setValue(0);return;}
player->setTCeptr(player->getStamp(ui->hsTimer->value()),ui->hsTimer->value());
offset=ui->hsTimer->value()/100.*player->getFtime();
char ts[100];
@@ -434,6 +434,30 @@ void qmpMainWindow::on_hsTimer_sliderReleased()
}
}
+uint32_t qmpMainWindow::getPlaybackPercentage(){return ui->hsTimer->value();}
+void qmpMainWindow::playerSeek(uint32_t percentage)
+{
+ if(percentage>100)percentage=100;
+ if(percentage<0)percentage=0;
+ if(playing)
+ {
+ if(percentage==100){on_pbNext_clicked();return;}
+ player->setTCeptr(player->getStamp(percentage),percentage);
+ player->playerPanic();ui->hsTimer->setValue(percentage);
+ offset=percentage/100.*player->getFtime();
+ st=std::chrono::steady_clock::now();
+ }
+ else
+ {
+ if(stopped){ui->hsTimer->setValue(0);return;}
+ player->setTCeptr(player->getStamp(percentage),percentage);
+ offset=percentage/100.*player->getFtime();ui->hsTimer->setValue(percentage);
+ char ts[100];
+ sprintf(ts,"%02d:%02d",(int)(offset)/60,(int)(offset)%60);
+ ui->lbCurTime->setText(ts);
+ }
+}
+
void qmpMainWindow::on_vsMasterVol_valueChanged()
{
if(!stopped)player->setGain(ui->vsMasterVol->value()/250.);
diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp
index 9fc5d14..ef07798 100644
--- a/qmidiplayer-desktop/qmpmainwindow.hpp
+++ b/qmidiplayer-desktop/qmpmainwindow.hpp
@@ -64,6 +64,8 @@ class qmpMainWindow:public QMainWindow
QString getFileName();
std::string getTitle();
std::wstring getWTitle();
+ uint32_t getPlaybackPercentage();
+ void playerSeek(uint32_t percentage);
int pharseArgs();
int registerVisualizationIntf(qmpVisualizationIntf* intf);
void unregisterVisualizationIntf(int handle);
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 565bdf1..7d6f36e 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -128,6 +128,10 @@ uint32_t qmpPluginAPI::getMaxPolyphone()
{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getMaxPolyphone():0;}
uint32_t qmpPluginAPI::getCurrentTimeStamp()
{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getTick():0;}
+uint32_t qmpPluginAPI::getCurrentPlaybackPercentage()
+{return qmw?qmw->getPlaybackPercentage():0;}
+void qmpPluginAPI::playerSeek(uint32_t percentage)
+{if(qmw)qmw->playerSeek(percentage);}
double qmpPluginAPI::getPitchBend(int ch)
{return qmw&&qmw->getPlayer()?qmw->getPlayer()->getPitchBend(ch):0;}
bool qmpPluginAPI::getChannelMask(int ch)