Skip to content
Snippets Groups Projects
Commit 1f8cf700 authored by Yann Boucher's avatar Yann Boucher
Browse files

bad apple linux fix

parent ec64f451
No related branches found
No related tags found
No related merge requests found
Pipeline #79776 passed
......@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
<string>Cellulut</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="sizePolicy">
......
......@@ -720,9 +720,8 @@ void MainWindow::play_bad_apple()
static bool bad_apple_connected;
#ifdef BAD_APPLE_AUDIO
static QMediaPlayer bad_apple_player;
#else
static QElapsedTimer bad_apple_elapsed;
#endif
static QElapsedTimer bad_apple_elapsed;
QFile f("extras/bad_apple.json");
if (!f.open(QFile::ReadOnly | QFile::Text))
......@@ -744,7 +743,11 @@ void MainWindow::play_bad_apple()
bad_apple_timer.callOnTimeout([this]
{
#ifdef BAD_APPLE_AUDIO
unsigned frame_idx = bad_apple_player.position()/(1000.f/30);
unsigned frame_idx;
if (bad_apple_player.state() == QMediaPlayer::PlayingState)
frame_idx = bad_apple_player.position()/(1000.f/30);
else
frame_idx = bad_apple_elapsed.elapsed()/(1000.f/30);
#else
unsigned frame_idx = bad_apple_elapsed.elapsed()/(1000.f/30);
#endif
......@@ -786,9 +789,9 @@ void MainWindow::play_bad_apple()
bad_apple_player.play();
#else
QMessageBox::information(this, "", "Music functionnality is only available with Qt 5");
bad_apple_elapsed.start();
#endif
bad_apple_elapsed.start();
bad_apple_timer.start(11);
statusBar()->showMessage("Original : \"Bad Apple!!\" feat. Nomico by Alstroemeria Records", 60000);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment