Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

Commit

Permalink
Added MP4 playback on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
3vi1 committed Mar 8, 2017
1 parent 66b0dc9 commit c17bf9f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 6 deletions.
Binary file removed data/audio/info/1 dont kn0w.wav
Binary file not shown.
20 changes: 20 additions & 0 deletions src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,23 @@ void ImpAudio::setVolume(int i)
qDebug() << "Volume changed to " << QString::number(volume, 'g', 2);
}

void ImpAudio::playLocalMedia(const QString& fileName)
{
QString path = appFilesPath() + "/audio/" + fileName;

qDebug() << "Playing " << path;

player = new QMediaPlayer;
//connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
player->setMedia(QUrl::fromLocalFile(path));
player->setVolume(50);
player->play();
}

void ImpAudio::stopMusic()
{
if(player != NULL && player->state() == player->PlayingState)
{
player->stop();
}
}
7 changes: 7 additions & 0 deletions src/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <QFile>
#include <QObject>
#include <QMediaPlayer>
#include <QSoundEffect>

class ImpAudio : public QObject
Expand All @@ -32,6 +33,10 @@ class ImpAudio : public QObject
explicit ImpAudio(QObject *parent = 0);

QSoundEffect* playLocalFile(const QString& fileName);

void playLocalMedia(const QString& fileName);
void stopMusic();

void setVolume(int i);

signals:
Expand All @@ -41,6 +46,8 @@ public slots:

private:
qreal volume = 1.0f;

QMediaPlayer* player;
};

#endif // AUDIO_H
2 changes: 1 addition & 1 deletion src/imp.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = imp
TEMPLATE = app

VERSION = 0.6.0
VERSION = 0.6.1
QMAKE_TARGET_COMPANY = EternalDusk
QMAKE_TARGET_DESCRIPTION = Eve Online Intelligence Management Program
QMAKE_TARGET_COPYRIGHT = (c) Copyright 2016-2017 Jesse Litton
Expand Down
14 changes: 10 additions & 4 deletions src/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,23 @@ Info::~Info()
void Info::on_okayButton_accepted()
{
hide();
music->stop();
//music->stop();
if(m_audio != NULL)
m_audio->stopMusic();
}

void Info::reject()
{
hide();
music->stop();
//music->stop();
if(m_audio != NULL)
m_audio->stopMusic();
}

void Info::startMusic(ImpAudio *audio)
{
music = audio->playLocalFile("info/1 dont kn0w.wav");
music->setLoopCount(QSoundEffect::Infinite);
m_audio = audio;
//music =
audio->playLocalMedia("info/1 dont kn0w.m4a");
//music->setLoopCount(QSoundEffect::Infinite);
}
1 change: 1 addition & 0 deletions src/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private slots:
Ui::Info *ui;

QSoundEffect* music;
ImpAudio* m_audio = NULL;
};

#endif // INFO_H
2 changes: 1 addition & 1 deletion src/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

static const struct Version
{
QString release = "v0.6.0";
QString release = "v0.6.1";
QString name = "Vrykolokas Osmosis";

QString styleHeader1 = "<span style=\" color:#0000ff;\">";
Expand Down

0 comments on commit c17bf9f

Please sign in to comment.