Merge branch 'bass-optional' into 'master'
Bass+discord optional See merge request AttorneyOnline/AO2-Client!59
This commit is contained in:
		
						commit
						e0c49ceb07
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -8,6 +8,7 @@ base_override.h
 | 
				
			|||||||
.DS_Store
 | 
					.DS_Store
 | 
				
			||||||
 | 
					
 | 
				
			||||||
base-full/
 | 
					base-full/
 | 
				
			||||||
 | 
					base/
 | 
				
			||||||
bass.lib
 | 
					bass.lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bin/
 | 
					bin/
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
QT += core gui widgets multimedia network
 | 
					QT += core gui widgets network
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TARGET = Attorney_Online
 | 
					TARGET = Attorney_Online
 | 
				
			||||||
TEMPLATE = app
 | 
					TEMPLATE = app
 | 
				
			||||||
@ -12,9 +12,31 @@ MOC_DIR = $$PWD/build
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
SOURCES += $$files($$PWD/src/*.cpp)
 | 
					SOURCES += $$files($$PWD/src/*.cpp)
 | 
				
			||||||
HEADERS += $$files($$PWD/include/*.h)
 | 
					HEADERS += $$files($$PWD/include/*.h)
 | 
				
			||||||
LIBS += -L$$PWD/lib -lbass -ldiscord-rpc
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBS += -L$$PWD/lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DEFINES += DISCORD
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					contains(DEFINES, DISCORD) {
 | 
				
			||||||
 | 
					LIBS += -ldiscord-rpc
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DEFINES += BASSAUDIO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					contains(DEFINES, BASSAUDIO) {
 | 
				
			||||||
 | 
					LIBS += -lbass
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#DEFINES += QTAUDIO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					contains(DEFINES, QTAUDIO) {
 | 
				
			||||||
 | 
					QT += multimedia
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices
 | 
					macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CONFIG += c++14
 | 
					CONFIG += c++14
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RESOURCES += resources.qrc
 | 
					RESOURCES += resources.qrc
 | 
				
			||||||
 | 
				
			|||||||
@ -95,9 +95,9 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  //////////////////versioning///////////////
 | 
					  //////////////////versioning///////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int get_release() const { return RELEASE; }
 | 
					  const int get_release() const { return RELEASE; }
 | 
				
			||||||
  int get_major_version() const { return MAJOR_VERSION; }
 | 
					  const int get_major_version() const { return MAJOR_VERSION; }
 | 
				
			||||||
  int get_minor_version() const { return MINOR_VERSION; }
 | 
					  const int get_minor_version() const { return MINOR_VERSION; }
 | 
				
			||||||
  QString get_version_string();
 | 
					  QString get_version_string();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ///////////////////////////////////////////
 | 
					  ///////////////////////////////////////////
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,19 @@
 | 
				
			|||||||
#ifndef AOBLIPPLAYER_H
 | 
					#ifndef AOBLIPPLAYER_H
 | 
				
			||||||
#define AOBLIPPLAYER_H
 | 
					#define AOBLIPPLAYER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO)
 | 
				
			||||||
#include "bass.h"
 | 
					#include "bass.h"
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					#include <QSoundEffect>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "aoapplication.h"
 | 
					#include "aoapplication.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QWidget>
 | 
					#include <QWidget>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AOBlipPlayer
 | 
					class AOBlipPlayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@ -24,7 +30,11 @@ private:
 | 
				
			|||||||
  AOApplication *ao_app;
 | 
					  AOApplication *ao_app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int m_volume;
 | 
					  int m_volume;
 | 
				
			||||||
 | 
					  #if defined(BASSAUDIO)
 | 
				
			||||||
  HSTREAM m_stream_list[5];
 | 
					  HSTREAM m_stream_list[5];
 | 
				
			||||||
 | 
					  #elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					  QSoundEffect m_blips;
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // AOBLIPPLAYER_H
 | 
					#endif // AOBLIPPLAYER_H
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,18 @@
 | 
				
			|||||||
#ifndef AOMUSICPLAYER_H
 | 
					#ifndef AOMUSICPLAYER_H
 | 
				
			||||||
#define AOMUSICPLAYER_H
 | 
					#define AOMUSICPLAYER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO)
 | 
				
			||||||
#include "bass.h"
 | 
					#include "bass.h"
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					#include <QMediaPlayer>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
#include "aoapplication.h"
 | 
					#include "aoapplication.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QWidget>
 | 
					#include <QWidget>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO)
 | 
				
			||||||
class AOMusicPlayer
 | 
					class AOMusicPlayer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@ -24,5 +29,37 @@ private:
 | 
				
			|||||||
  int m_volume = 0;
 | 
					  int m_volume = 0;
 | 
				
			||||||
  HSTREAM m_stream;
 | 
					  HSTREAM m_stream;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					class AOMusicPlayer
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
				
			||||||
 | 
					  ~AOMusicPlayer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void play(QString p_song);
 | 
				
			||||||
 | 
					  void set_volume(int p_value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					  QMediaPlayer m_player;
 | 
				
			||||||
 | 
					  QWidget *m_parent;
 | 
				
			||||||
 | 
					  AOApplication *ao_app;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  int m_volume = 0;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					class AOMusicPlayer
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
				
			||||||
 | 
					  ~AOMusicPlayer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  void play(QString p_song);
 | 
				
			||||||
 | 
					  void set_volume(int p_value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					  QWidget *m_parent;
 | 
				
			||||||
 | 
					  AOApplication *ao_app;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // AOMUSICPLAYER_H
 | 
					#endif // AOMUSICPLAYER_H
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,12 @@
 | 
				
			|||||||
#ifndef AOSFXPLAYER_H
 | 
					#ifndef AOSFXPLAYER_H
 | 
				
			||||||
#define AOSFXPLAYER_H
 | 
					#define AOSFXPLAYER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO)
 | 
				
			||||||
#include "bass.h"
 | 
					#include "bass.h"
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					#include <QSoundEffect>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "aoapplication.h"
 | 
					#include "aoapplication.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QWidget>
 | 
					#include <QWidget>
 | 
				
			||||||
@ -20,9 +25,12 @@ public:
 | 
				
			|||||||
private:
 | 
					private:
 | 
				
			||||||
  QWidget *m_parent;
 | 
					  QWidget *m_parent;
 | 
				
			||||||
  AOApplication *ao_app;
 | 
					  AOApplication *ao_app;
 | 
				
			||||||
 | 
					  #if defined(BASSAUDIO)
 | 
				
			||||||
  int m_volume = 0;
 | 
					 | 
				
			||||||
  HSTREAM m_stream;
 | 
					  HSTREAM m_stream;
 | 
				
			||||||
 | 
					  #elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					  QSoundEffect m_sfx;
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
 | 
					  int m_volume = 0;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // AOSFXPLAYER_H
 | 
					#endif // AOSFXPLAYER_H
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
#include "aoblipplayer.h"
 | 
					#include "aoblipplayer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO) //Using bass.dll for the blips
 | 
				
			||||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
					AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_parent = parent;
 | 
					  m_parent = parent;
 | 
				
			||||||
@ -28,7 +29,6 @@ void AOBlipPlayer::blip_tick()
 | 
				
			|||||||
    m_cycle = 0;
 | 
					    m_cycle = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
					  HSTREAM f_stream = m_stream_list[f_cycle];
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (ao_app->get_audio_output_device() != "default")
 | 
					  if (ao_app->get_audio_output_device() != "default")
 | 
				
			||||||
    BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
					    BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
 | 
				
			||||||
  BASS_ChannelPlay(f_stream, false);
 | 
					  BASS_ChannelPlay(f_stream, false);
 | 
				
			||||||
@ -45,3 +45,59 @@ void AOBlipPlayer::set_volume(int p_value)
 | 
				
			|||||||
    BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
 | 
					    BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
 | 
				
			||||||
 | 
					AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_parent = parent;
 | 
				
			||||||
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOBlipPlayer::set_blips(QString p_sfx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  QString f_path = ao_app->get_sounds_path(p_sfx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    m_blips.setSource(QUrl::fromLocalFile(f_path));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  set_volume(m_volume);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOBlipPlayer::blip_tick()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  int f_cycle = m_cycle++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (m_cycle == 5)
 | 
				
			||||||
 | 
					    m_cycle = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  m_blips.play();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOBlipPlayer::set_volume(int p_value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_volume = p_value;
 | 
				
			||||||
 | 
					  m_blips.setVolume(m_volume);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#else //No audio
 | 
				
			||||||
 | 
					AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_parent = parent;
 | 
				
			||||||
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOBlipPlayer::set_blips(QString p_sfx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOBlipPlayer::blip_tick()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOBlipPlayer::set_volume(int p_value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
#include "aomusicplayer.h"
 | 
					#include "aomusicplayer.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO)
 | 
				
			||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
					AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_parent = parent;
 | 
					  m_parent = parent;
 | 
				
			||||||
@ -32,3 +33,55 @@ void AOMusicPlayer::set_volume(int p_value)
 | 
				
			|||||||
  float volume = m_volume / 100.0f;
 | 
					  float volume = m_volume / 100.0f;
 | 
				
			||||||
  BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
					  BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO)
 | 
				
			||||||
 | 
					AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_parent = parent;
 | 
				
			||||||
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AOMusicPlayer::~AOMusicPlayer()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_player.stop();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOMusicPlayer::play(QString p_song)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_player.stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString f_path = ao_app->get_music_path(p_song);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  m_player.setMedia(QUrl::fromLocalFile(f_path));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  this->set_volume(m_volume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  m_player.play();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOMusicPlayer::set_volume(int p_value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_volume = p_value;
 | 
				
			||||||
 | 
					  m_player.setVolume(m_volume);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_parent = parent;
 | 
				
			||||||
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AOMusicPlayer::~AOMusicPlayer()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOMusicPlayer::play(QString p_song)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOMusicPlayer::set_volume(int p_value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -199,6 +199,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
 | 
				
			|||||||
    ui_callwords_layout->addWidget(ui_callwords_explain_lbl);
 | 
					    ui_callwords_layout->addWidget(ui_callwords_explain_lbl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // The audio tab.
 | 
					    // The audio tab.
 | 
				
			||||||
 | 
					    #ifdef BASSAUDIO
 | 
				
			||||||
    ui_audio_tab = new QWidget();
 | 
					    ui_audio_tab = new QWidget();
 | 
				
			||||||
    ui_settings_tabs->addTab(ui_audio_tab, tr("Audio"));
 | 
					    ui_settings_tabs->addTab(ui_audio_tab, tr("Audio"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -218,7 +219,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ui_audio_device_combobox = new QComboBox(ui_audio_widget);
 | 
					    ui_audio_device_combobox = new QComboBox(ui_audio_widget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Let's fill out the combobox with the available audio devices.
 | 
					    // Let's fill out the combobox with the available audio devices. Or don't if there is no audio
 | 
				
			||||||
    int a = 0;
 | 
					    int a = 0;
 | 
				
			||||||
    BASS_DEVICEINFO info;
 | 
					    BASS_DEVICEINFO info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -311,6 +312,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
 | 
				
			|||||||
    ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip());
 | 
					    ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb);
 | 
					    ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb);
 | 
				
			||||||
 | 
					    #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // The casing tab!
 | 
					    // The casing tab!
 | 
				
			||||||
    ui_casing_tab = new QWidget();
 | 
					    ui_casing_tab = new QWidget();
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
#include "aosfxplayer.h"
 | 
					#include "aosfxplayer.h"
 | 
				
			||||||
#include "file_functions.h"
 | 
					#include "file_functions.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(BASSAUDIO) //Using bass.dll for sfx
 | 
				
			||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
					AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  m_parent = parent;
 | 
					  m_parent = parent;
 | 
				
			||||||
@ -49,3 +50,74 @@ void AOSfxPlayer::set_volume(int p_value)
 | 
				
			|||||||
  float volume = p_value / 100.0f;
 | 
					  float volume = p_value / 100.0f;
 | 
				
			||||||
  BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
					  BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
 | 
				
			||||||
 | 
					AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_parent = parent;
 | 
				
			||||||
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_sfx.stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString misc_path = "";
 | 
				
			||||||
 | 
					  QString char_path = "";
 | 
				
			||||||
 | 
					  QString sound_path = ao_app->get_sounds_path(p_sfx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (shout != "")
 | 
				
			||||||
 | 
					    misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx;
 | 
				
			||||||
 | 
					  if (p_char != "")
 | 
				
			||||||
 | 
					    char_path = ao_app->get_character_path(p_char, p_sfx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString f_path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (file_exists(char_path))
 | 
				
			||||||
 | 
					      f_path = char_path;
 | 
				
			||||||
 | 
					  else if (file_exists(misc_path))
 | 
				
			||||||
 | 
					    f_path = misc_path;
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    f_path = sound_path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (file_exists(f_path)) //if its missing, it will glitch out
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					  m_sfx.setSource(QUrl::fromLocalFile(f_path));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  set_volume(m_volume);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  m_sfx.play();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOSfxPlayer::stop()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_sfx.stop();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOSfxPlayer::set_volume(int p_value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_volume = p_value;
 | 
				
			||||||
 | 
					  m_sfx.setVolume(m_volume);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  m_parent = parent;
 | 
				
			||||||
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOSfxPlayer::stop()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AOSfxPlayer::set_volume(int p_value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@
 | 
				
			|||||||
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
					Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ao_app = p_ao_app;
 | 
					  ao_app = p_ao_app;
 | 
				
			||||||
 | 
					  #ifdef BASSAUDIO
 | 
				
			||||||
  // Change the default audio output device to be the one the user has given
 | 
					  // Change the default audio output device to be the one the user has given
 | 
				
			||||||
  // in his config.ini file for now.
 | 
					  // in his config.ini file for now.
 | 
				
			||||||
  unsigned int a = 0;
 | 
					  unsigned int a = 0;
 | 
				
			||||||
@ -28,6 +28,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  keepalive_timer = new QTimer(this);
 | 
					  keepalive_timer = new QTimer(this);
 | 
				
			||||||
  keepalive_timer->start(60000);
 | 
					  keepalive_timer->start(60000);
 | 
				
			||||||
@ -3568,23 +3569,29 @@ Courtroom::~Courtroom()
 | 
				
			|||||||
  delete blip_player;
 | 
					  delete blip_player;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if (defined (_WIN32) || defined (_WIN64))
 | 
					#if (defined (_WIN32) || defined (_WIN64))
 | 
				
			||||||
void Courtroom::load_bass_opus_plugin()
 | 
					void Courtroom::load_bass_opus_plugin()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  #ifdef BASSAUDIO
 | 
				
			||||||
  BASS_PluginLoad("bassopus.dll", 0);
 | 
					  BASS_PluginLoad("bassopus.dll", 0);
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#elif (defined (LINUX) || defined (__linux__))
 | 
					#elif (defined (LINUX) || defined (__linux__))
 | 
				
			||||||
void Courtroom::load_bass_opus_plugin()
 | 
					void Courtroom::load_bass_opus_plugin()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  #ifdef BASSAUDIO
 | 
				
			||||||
  BASS_PluginLoad("libbassopus.so", 0);
 | 
					  BASS_PluginLoad("libbassopus.so", 0);
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#elif defined __APPLE__
 | 
					#elif defined __APPLE__
 | 
				
			||||||
void Courtroom::load_bass_opus_plugin()
 | 
					void Courtroom::load_bass_opus_plugin()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib";
 | 
					  QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib";
 | 
				
			||||||
  QByteArray ba = libpath.toLocal8Bit();
 | 
					  QByteArray ba = libpath.toLocal8Bit();
 | 
				
			||||||
 | 
					  #ifdef BASSAUDIO
 | 
				
			||||||
  BASS_PluginLoad(ba.data(), 0);
 | 
					  BASS_PluginLoad(ba.data(), 0);
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#error This operating system is unsupported for bass plugins.
 | 
					#error This operating system is unsupported for bass plugins.
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace AttorneyOnline {
 | 
					namespace AttorneyOnline {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef DISCORD
 | 
				
			||||||
Discord::Discord()
 | 
					Discord::Discord()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  DiscordEventHandlers handlers;
 | 
					  DiscordEventHandlers handlers;
 | 
				
			||||||
@ -99,5 +100,36 @@ void Discord::state_spectate()
 | 
				
			|||||||
  presence.state = "Spectating";
 | 
					  presence.state = "Spectating";
 | 
				
			||||||
  Discord_UpdatePresence(&presence);
 | 
					  Discord_UpdatePresence(&presence);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					Discord::Discord()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Discord::~Discord()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Discord::state_lobby()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Discord::state_server(std::string name, std::string server_id)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  qDebug() << "Discord RPC: Setting server state";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Discord::state_character(std::string name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  qDebug() << "Discord RPC: Setting character state";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Discord::state_spectate()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  qDebug() << "Discord RPC: Setting specator state";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -453,8 +453,9 @@ QString AOApplication::get_chat(QString p_char)
 | 
				
			|||||||
QString AOApplication::get_char_shouts(QString p_char)
 | 
					QString AOApplication::get_char_shouts(QString p_char)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  QString f_result = read_char_ini(p_char, "shouts", "Options");
 | 
					  QString f_result = read_char_ini(p_char, "shouts", "Options");
 | 
				
			||||||
 | 
					  if (f_result == "")
 | 
				
			||||||
  return f_result;
 | 
					    return "default";
 | 
				
			||||||
 | 
					  else return f_result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
 | 
					int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user