LIDL Soundboard  1.9.0
A simple soundboard, yet better than EXP Soundboard forsenE
soundwrapper.h
Go to the documentation of this file.
1 #ifndef SOUNDWRAPPER_H
2 #define SOUNDWRAPPER_H
3 #pragma once
4 //#include <QDebug>
5 
6 #include <QObject>
7 #include <QFile>
8 #include <QVector>
9 #include <QShortcut>
10 #include <QKeySequence>
11 #include <QString>
12 #include <QListWidget>
13 #include <QListWidgetItem>
14 #include <QString>
15 #include <QFileInfo>
16 #include <QList>
17 #include <QStandardItem>
18 
19 #include "CustomPlayer.h"
20 #include "EnumsAndStructs.h"
21 #include "CustomListWidget.h"
22 #include "CustomListWidgetItem.h"
23 #include "CustomSoundFile.h"
24 
35 class SoundWrapper : public QObject
36 {
37  Q_OBJECT
38 public:
39  explicit SoundWrapper(QObject *parent = nullptr);
40 
41 
54  SoundWrapper(QVector<LIDL::SoundFile*> fileList,
55  LIDL::Playback playbackMode,
56  QKeySequence shortcut,
57  int shortcutVirtualKey =-1,
58  int mainOutput = -1,
59  int vacOutput = -1,
60  QObject *parent = nullptr );
61 
62 
64 
77  SoundWrapper(QVector<QString> fileList,
78  LIDL::Playback playbackMode,
79  int mainVolume,
80  int vacVolume,
81  int mainOutput,
82  int vacOutput,
83  QObject * parent=nullptr);
84 
90  SoundWrapper(SoundWrapper* &other);
91 
92 
93 
94 //Getters
95 
99  QVector<LIDL::SoundFile*> getSoundList();
100 
104  QKeySequence getKeySequence();
105 
110 
114  QString getSoundListAsQString();
115 
120  QList<QStandardItem*> getSoundAsItem();
121 
129  int addSound(QString filename, float mainVolume = 1.0, float vacVolume = 1.0);
130 
131 
132 
136  void setPlayerMainOutput(int index);
137 
141  void setPlayerVACOutput(int index);
145  int getMainDevice();
146 
150  int getVacDevice();
151 
155  unsigned int getShortcutVirtualKey();
156 
161  QJsonObject GetWrapperAsObject() const;
162 
163 
164 private:
165 
166  QVector<LIDL::SoundFile*> _soundList;
170  // shortcut
171  QKeySequence _keySequence;
172  unsigned int _virtualKey;
173  // the player to play the sounds
176  bool checkFileExistence(QString fileName);
177 
178  // need this to check for soundboard modification forsenT
179  // will implement SettingsController:WasModified() or something
187  friend bool operator==(const SoundWrapper & a, const SoundWrapper & b);
195  friend bool operator!=(const SoundWrapper & a, const SoundWrapper & b);
196 signals:
203  void UnexistantFile();
204 
205 
210  void ErrorPlaying(QString);
211 
216  void NowPlaying(QString);
217 
223  void holdPTTProxy(int);
224 
225 public slots:
229  void Play();
230 
234  void Stop();
235 
240  void OutputDeviceChanged(int);
244  void VACDeviceChanged(int);
245 
252  void clearShorcut();
253 
254 
255 };
256 
257 #endif // SOUNDWRAPPER_H
void UnexistantFile()
Used to send warning to main ui that a file doesn't exist.
The CustomPlayer class, inherits QObject to access signals and slots.*.
Definition: CustomPlayer.h:63
void Stop()
Tell the player to stop playing the sound.
Definition: soundwrapper.cpp:95
QVector< LIDL::SoundFile * > _soundList
Definition: soundwrapper.h:166
int addSound(QString filename, float mainVolume=1.0, float vacVolume=1.0)
Used by OpenEXPJson to add the revelant sound files.
Definition: soundwrapper.cpp:396
int getVacDevice()
Definition: soundwrapper.cpp:456
SoundWrapper(QObject *parent=nullptr)
Definition: soundwrapper.cpp:4
File describing the CustomListWidgetItem class.
QKeySequence getKeySequence()
Definition: soundwrapper.cpp:113
friend bool operator!=(const SoundWrapper &a, const SoundWrapper &b)
Deprecated.
Definition: soundwrapper.cpp:485
File describing the CustomListWidget class.
void VACDeviceChanged(int)
Set the VAC output device of the player according to the combo box in the UI.
Definition: soundwrapper.cpp:390
File describing the CustomPlayer class.
QList< QStandardItem * > getSoundAsItem()
Definition: soundwrapper.cpp:163
QJsonObject GetWrapperAsObject() const
GetWrapperAsObject.
Definition: soundwrapper.cpp:290
void holdPTTProxy(int)
This signal is sent whenever the "holdPTT" signal of the player is sent.
QVector< LIDL::SoundFile * > getSoundList()
Definition: soundwrapper.cpp:108
void Play()
Tell the player to play the sound according to the playback mode.
Definition: soundwrapper.cpp:90
bool checkFileExistence(QString fileName)
Definition: soundwrapper.cpp:415
LIDL::Playback _playMode
Definition: soundwrapper.h:168
QString getSoundListAsQString()
Definition: soundwrapper.cpp:132
unsigned int getShortcutVirtualKey()
Definition: soundwrapper.cpp:285
Inherits QObject.
Definition: soundwrapper.h:35
void clearShorcut()
Clears the shortcut of the wrapper. (Display purposes)
Definition: soundwrapper.cpp:421
unsigned int _virtualKey
Definition: soundwrapper.h:172
CustomPlayer * _player
Definition: soundwrapper.h:174
void ErrorPlaying(QString)
Used to send a warning to main ui that an error happened playing a file.
void setPlayerVACOutput(int index)
Set the index of the VAC output device.
Definition: soundwrapper.cpp:410
QKeySequence _keySequence
Definition: soundwrapper.h:171
void setPlayerMainOutput(int index)
Set the index of the main output device.
Definition: soundwrapper.cpp:405
LIDL::Playback getPlayMode()
Definition: soundwrapper.cpp:127
int getMainDevice()
Definition: soundwrapper.cpp:451
void OutputDeviceChanged(int)
Set the main output device of the player according to the combo box in the UI.
Definition: soundwrapper.cpp:383
void NowPlaying(QString)
Used to send a message to main ui that a file is playing.
Playback
The Playback enum.
Definition: EnumsAndStructs.h:27
friend bool operator==(const SoundWrapper &a, const SoundWrapper &b)
Deprecated.
Definition: soundwrapper.cpp:461