Merge pull request #26 from AttorneyOnline/gbp-fixes
Remove BASS dependency
This commit is contained in:
commit
f726fddb67
@ -69,7 +69,6 @@ HEADERS += lobby.h \
|
|||||||
misc_functions.h \
|
misc_functions.h \
|
||||||
aocharmovie.h \
|
aocharmovie.h \
|
||||||
aoemotebutton.h \
|
aoemotebutton.h \
|
||||||
bass.h \
|
|
||||||
aosfxplayer.h \
|
aosfxplayer.h \
|
||||||
aomusicplayer.h \
|
aomusicplayer.h \
|
||||||
aoblipplayer.h \
|
aoblipplayer.h \
|
||||||
@ -81,15 +80,11 @@ HEADERS += lobby.h \
|
|||||||
discord_rich_presence.h \
|
discord_rich_presence.h \
|
||||||
discord-rpc.h
|
discord-rpc.h
|
||||||
|
|
||||||
# 1. You need to get BASS and put the x86 bass DLL/headers in the project root folder
|
# You need to compile the Discord Rich Presence SDK separately and add the lib/headers.
|
||||||
# AND the compilation output folder. If you want a static link, you'll probably
|
# Discord RPC uses CMake, which does not play nicely with QMake, so this step must be manual.
|
||||||
# need the .lib file too. MinGW-GCC is really finicky finding BASS, it seems.
|
|
||||||
# 2. You need to compile the Discord Rich Presence SDK separately and add the lib/headers
|
unix:LIBS += -L$$PWD -ldiscord-rpc
|
||||||
# in the same way as BASS. Discord RPC uses CMake, which does not play nicely with
|
win32:LIBS += -L$$PWD -ldiscord-rpc #"$$PWD/discord-rpc.dll"
|
||||||
# QMake, so this step must be manual.
|
|
||||||
unix:LIBS += -L$$PWD -lbass -ldiscord-rpc
|
|
||||||
win32:LIBS += -L$$PWD "$$PWD/bass.dll" -ldiscord-rpc #"$$PWD/discord-rpc.dll"
|
|
||||||
android:LIBS += -L$$PWD\android\libs\armeabi-v7a\ -lbass
|
|
||||||
|
|
||||||
CONFIG += c++11
|
CONFIG += c++11
|
||||||
|
|
||||||
|
@ -2,44 +2,32 @@
|
|||||||
|
|
||||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
{
|
{
|
||||||
|
m_sfxplayer = new QSoundEffect;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AOBlipPlayer::~AOBlipPlayer()
|
||||||
|
{
|
||||||
|
m_sfxplayer->stop();
|
||||||
|
m_sfxplayer->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::set_blips(QString p_sfx)
|
void AOBlipPlayer::set_blips(QString p_sfx)
|
||||||
{
|
{
|
||||||
|
m_sfxplayer->stop();
|
||||||
QString f_path = ao_app->get_sounds_path() + p_sfx.toLower();
|
QString f_path = ao_app->get_sounds_path() + p_sfx.toLower();
|
||||||
|
m_sfxplayer->setSource(QUrl::fromLocalFile(f_path));
|
||||||
for (int n_stream = 0 ; n_stream < BLIP_COUNT ; ++n_stream)
|
|
||||||
{
|
|
||||||
BASS_StreamFree(m_stream_list[n_stream]);
|
|
||||||
|
|
||||||
m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_volume(m_volume);
|
set_volume(m_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::blip_tick()
|
void AOBlipPlayer::blip_tick()
|
||||||
{
|
{
|
||||||
int f_cycle = m_cycle++;
|
m_sfxplayer->play();
|
||||||
|
|
||||||
if (m_cycle == BLIP_COUNT)
|
|
||||||
m_cycle = 0;
|
|
||||||
|
|
||||||
HSTREAM f_stream = m_stream_list[f_cycle];
|
|
||||||
|
|
||||||
BASS_ChannelPlay(f_stream, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume(int p_value)
|
void AOBlipPlayer::set_volume(int p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value;
|
m_volume = p_value;
|
||||||
|
m_sfxplayer->setVolume(p_value / 100.0);
|
||||||
float volume = p_value / 100.0f;
|
|
||||||
|
|
||||||
for (int n_stream = 0 ; n_stream < BLIP_COUNT ; ++n_stream)
|
|
||||||
{
|
|
||||||
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
#ifndef AOBLIPPLAYER_H
|
#ifndef AOBLIPPLAYER_H
|
||||||
#define AOBLIPPLAYER_H
|
#define AOBLIPPLAYER_H
|
||||||
|
|
||||||
#include "bass.h"
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QSoundEffect>
|
||||||
const int BLIP_COUNT = 5;
|
|
||||||
|
|
||||||
class AOBlipPlayer
|
class AOBlipPlayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
|
~AOBlipPlayer();
|
||||||
|
|
||||||
void set_blips(QString p_sfx);
|
void set_blips(QString p_sfx);
|
||||||
void blip_tick();
|
void blip_tick();
|
||||||
@ -24,9 +23,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
QSoundEffect *m_sfxplayer;
|
||||||
|
|
||||||
int m_volume;
|
int m_volume;
|
||||||
HSTREAM m_stream_list[BLIP_COUNT];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOBLIPPLAYER_H
|
#endif // AOBLIPPLAYER_H
|
||||||
|
@ -4,32 +4,24 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
|||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
m_player = new QMediaPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOMusicPlayer::~AOMusicPlayer()
|
AOMusicPlayer::~AOMusicPlayer()
|
||||||
{
|
{
|
||||||
BASS_ChannelStop(m_stream);
|
m_player->stop();
|
||||||
|
m_player->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMusicPlayer::play(QString p_song)
|
void AOMusicPlayer::play(QString p_song)
|
||||||
{
|
{
|
||||||
BASS_ChannelStop(m_stream);
|
m_player->setMedia(QUrl::fromLocalFile(ao_app->get_music_path(p_song)));
|
||||||
|
|
||||||
QString f_path = ao_app->get_music_path(p_song);
|
|
||||||
|
|
||||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
|
|
||||||
|
|
||||||
this->set_volume(m_volume);
|
this->set_volume(m_volume);
|
||||||
|
m_player->play();
|
||||||
BASS_ChannelPlay(m_stream, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMusicPlayer::set_volume(int p_value)
|
void AOMusicPlayer::set_volume(int p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value;
|
m_volume = p_value;
|
||||||
|
m_player->setVolume(p_value);
|
||||||
float volume = m_volume / 100.0f;
|
|
||||||
|
|
||||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#ifndef AOMUSICPLAYER_H
|
#ifndef AOMUSICPLAYER_H
|
||||||
#define AOMUSICPLAYER_H
|
#define AOMUSICPLAYER_H
|
||||||
|
|
||||||
#include "bass.h"
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QMediaPlayer>
|
||||||
|
|
||||||
class AOMusicPlayer
|
class AOMusicPlayer
|
||||||
{
|
{
|
||||||
@ -21,8 +21,8 @@ private:
|
|||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
|
QMediaPlayer *m_player;
|
||||||
int m_volume = 0;
|
int m_volume = 0;
|
||||||
HSTREAM m_stream;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOMUSICPLAYER_H
|
#endif // AOMUSICPLAYER_H
|
||||||
|
@ -2,41 +2,40 @@
|
|||||||
|
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
|
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
{
|
{
|
||||||
|
m_sfxplayer = new QSoundEffect;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AOSfxPlayer::~AOSfxPlayer()
|
||||||
|
{
|
||||||
|
m_sfxplayer->stop();
|
||||||
|
m_sfxplayer->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::play(QString p_sfx, QString p_char)
|
void AOSfxPlayer::play(QString p_sfx, QString p_char)
|
||||||
{
|
{
|
||||||
BASS_ChannelStop(m_stream);
|
m_sfxplayer->stop();
|
||||||
|
|
||||||
p_sfx = p_sfx.toLower();
|
p_sfx = p_sfx.toLower();
|
||||||
|
|
||||||
QString f_path;
|
QString f_path;
|
||||||
|
|
||||||
if (p_char != "")
|
if (p_char != "")
|
||||||
f_path = ao_app->get_character_path(p_char) + p_sfx;
|
f_path = ao_app->get_character_path(p_char) + p_sfx;
|
||||||
else
|
else
|
||||||
f_path = ao_app->get_sounds_path() + p_sfx;
|
f_path = ao_app->get_sounds_path() + p_sfx;
|
||||||
|
|
||||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
|
m_sfxplayer->setSource(QUrl::fromLocalFile(f_path));
|
||||||
|
|
||||||
set_volume(m_volume);
|
set_volume(m_volume);
|
||||||
|
|
||||||
BASS_ChannelPlay(m_stream, false);
|
m_sfxplayer->play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::stop()
|
void AOSfxPlayer::stop()
|
||||||
{
|
{
|
||||||
BASS_ChannelStop(m_stream);
|
m_sfxplayer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume(int p_value)
|
void AOSfxPlayer::set_volume(int p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value;
|
m_volume = p_value;
|
||||||
|
m_sfxplayer->setVolume(p_value / 100.0);
|
||||||
float volume = p_value / 100.0f;
|
|
||||||
|
|
||||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
#ifndef AOSFXPLAYER_H
|
#ifndef AOSFXPLAYER_H
|
||||||
#define AOSFXPLAYER_H
|
#define AOSFXPLAYER_H
|
||||||
|
|
||||||
#include "bass.h"
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QSoundEffect>
|
||||||
|
|
||||||
class AOSfxPlayer
|
class AOSfxPlayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
|
~AOSfxPlayer();
|
||||||
|
|
||||||
void play(QString p_sfx, QString p_char = "");
|
void play(QString p_sfx, QString p_char = "");
|
||||||
void stop();
|
void stop();
|
||||||
@ -20,9 +21,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
QSoundEffect *m_sfxplayer;
|
||||||
|
|
||||||
int m_volume = 0;
|
int m_volume = 0;
|
||||||
HSTREAM m_stream;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOSFXPLAYER_H
|
#endif // AOSFXPLAYER_H
|
||||||
|
@ -4,10 +4,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
//initializing sound device
|
|
||||||
BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL);
|
|
||||||
BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
|
|
||||||
|
|
||||||
keepalive_timer = new QTimer(this);
|
keepalive_timer = new QTimer(this);
|
||||||
keepalive_timer->start(60000);
|
keepalive_timer->start(60000);
|
||||||
|
|
||||||
|
@ -1,56 +1,7 @@
|
|||||||
//WELCOME TO THE EXTREMELY GHETTO HEX CONVERSION KLUDGE BECAUSE I COULDNT MAKE ANYTHING ELSE WORK
|
|
||||||
|
|
||||||
#include "hex_functions.h"
|
#include "hex_functions.h"
|
||||||
|
|
||||||
namespace omni
|
namespace omni
|
||||||
{
|
{
|
||||||
// This might be unused but I don't care to search the entire source code
|
|
||||||
// So it will remain here (lol)
|
|
||||||
// The actual int to hex conversion is now done properly
|
|
||||||
char halfword_to_hex_char(unsigned int input)
|
|
||||||
{
|
|
||||||
if (input > 127)
|
|
||||||
return 'F';
|
|
||||||
|
|
||||||
switch (input)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return '0';
|
|
||||||
case 1:
|
|
||||||
return '1';
|
|
||||||
case 2:
|
|
||||||
return '2';
|
|
||||||
case 3:
|
|
||||||
return '3';
|
|
||||||
case 4:
|
|
||||||
return '4';
|
|
||||||
case 5:
|
|
||||||
return '5';
|
|
||||||
case 6:
|
|
||||||
return '6';
|
|
||||||
case 7:
|
|
||||||
return '7';
|
|
||||||
case 8:
|
|
||||||
return '8';
|
|
||||||
case 9:
|
|
||||||
return '9';
|
|
||||||
case 10:
|
|
||||||
return 'A';
|
|
||||||
case 11:
|
|
||||||
return 'B';
|
|
||||||
case 12:
|
|
||||||
return 'C';
|
|
||||||
case 13:
|
|
||||||
return 'D';
|
|
||||||
case 14:
|
|
||||||
return 'E';
|
|
||||||
case 15:
|
|
||||||
return 'F';
|
|
||||||
default:
|
|
||||||
return 'F';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string int_to_hex(unsigned int input)
|
std::string int_to_hex(unsigned int input)
|
||||||
{
|
{
|
||||||
if (input > 255)
|
if (input > 255)
|
||||||
@ -64,4 +15,4 @@ namespace omni
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} //namespace omni
|
}
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace omni
|
namespace omni
|
||||||
{
|
{
|
||||||
char halfword_to_hex_char(unsigned int input);
|
|
||||||
std::string int_to_hex(unsigned int input);
|
std::string int_to_hex(unsigned int input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user