![]() |
LIDL Soundboard
1.9.0
A simple soundboard, yet better than EXP Soundboard forsenE
|
The CustomPlayer class, inherits QObject to access signals and slots.*. More...
#include <CustomPlayer.h>
Public Slots | |
void | PlayNext () |
PlayNext PlayNext function is called whenever the shortcut, or play button, is pressed. More... | |
void | Stop () |
Stop all the channels of this player. More... | |
Signals | |
void | ErrorPlaying (QString) |
ErrorPlaying Signal to tell the main UI (via the proxy set up in the SoundWrapper class) that an error happened playing the sound <sound name>=""> (will be displayed in status bar). More... | |
void | NowPlaying (QString) |
NowPlaying Signal to tell the main UI (via the proxy set up in the SoundWrapper class) to display now playing sound <soundName> in the status bar. More... | |
void | holdPTT (int duration) |
holdPTT Signal to tell the main UI (via the proxy set up in the SoundWrapper class) to hold ptt for the duration. More... | |
Public Member Functions | |
CustomPlayer (QObject *parent=nullptr) | |
CustomPlayer Default contructor, used by the default constructor of SoundWrapper. More... | |
CustomPlayer (QVector< LIDL::SoundFile * > soundlist, LIDL::Playback playMode=LIDL::Playback::Singleton, QObject *parent=nullptr) | |
CustomPlayer Overloaded constructor, doesn't serve any purpose at the moment. More... | |
void | SetOutputDevice (int index) |
SetOutputDevice Sets the main output device of the player. More... | |
void | SetVACDevice (int index) |
SetVACDevice Sets the VAC output device of the player. More... | |
int | GetOutputDevice () |
GetOutputDevice. More... | |
int | GetVACDevice () |
GetVACDevice. More... | |
void | SetPlaylist (QVector< LIDL::SoundFile * > soundList) |
SetPlaylist Set the playlist of the CustomPlayer. More... | |
void | SetPlaybackMode (LIDL::Playback playMode) |
SetPlaybackMode Sets the playback mode of the CustomPlayer. More... | |
~CustomPlayer () | |
Destructor. More... | |
Private Member Functions | |
double | PlayAt (int index) |
PlayAt Will play the song at the specified index. More... | |
void | resetShouldPlay () |
resetShouldPlay will reset the _shouldPlay boolean to true; More... | |
Private Attributes | |
QVector< LIDL::SoundFile * > | _soundList |
LIDL::Playback | _playMode |
int | _index |
QVector< unsigned long > | _mainChannel |
QVector< unsigned long > | _vacChannel |
unsigned long | _mainOutputDevice |
unsigned long | _VACOutputDevice |
QTimer * | _timerShouldPlay |
QTimer * | _timerSequentialAutoPlay |
bool | _shouldPlay |
The CustomPlayer class, inherits QObject to access signals and slots.*.
This player uses bass library as a backend to deal with audio streams. It also uses some bass extensions (namely bassflac.h) to deal with the flac format. It uses ssl protocol for streaming over https, so installer includes openssl dll to allow it.
|
explicit |
CustomPlayer Default contructor, used by the default constructor of SoundWrapper.
parent | nullptr as usual. |
References _index, _mainOutputDevice, _shouldPlay, _timerSequentialAutoPlay, _timerShouldPlay, _VACOutputDevice, PlayNext(), and resetShouldPlay().
CustomPlayer::CustomPlayer | ( | QVector< LIDL::SoundFile * > | soundlist, |
LIDL::Playback | playMode = LIDL::Playback::Singleton , |
||
QObject * | parent = nullptr |
||
) |
CustomPlayer Overloaded constructor, doesn't serve any purpose at the moment.
Will probably use it to add a "preview" sound button latter.
soundlist | The soundlist, should only contain one file if used for preview |
playMode | Default to singleton because if used to preview a sound, it will only contain ONE sound. |
parent | nullptr as usual. |
References _index, _playMode, and _soundList.
CustomPlayer::~CustomPlayer | ( | ) |
Destructor.
References _soundList.
|
signal |
ErrorPlaying Signal to tell the main UI (via the proxy set up in the SoundWrapper class) that an error happened playing the sound <sound name>=""> (will be displayed in status bar).
Referenced by PlayNext(), and SoundWrapper::SoundWrapper().
int CustomPlayer::GetOutputDevice | ( | ) |
GetOutputDevice.
References _mainOutputDevice.
Referenced by SoundWrapper::getMainDevice(), and SoundWrapper::SoundWrapper().
int CustomPlayer::GetVACDevice | ( | ) |
GetVACDevice.
References _VACOutputDevice.
Referenced by SoundWrapper::getVacDevice(), and SoundWrapper::SoundWrapper().
|
signal |
holdPTT Signal to tell the main UI (via the proxy set up in the SoundWrapper class) to hold ptt for the duration.
duration |
Referenced by PlayAt(), and SoundWrapper::SoundWrapper().
|
signal |
NowPlaying Signal to tell the main UI (via the proxy set up in the SoundWrapper class) to display now playing sound <soundName> in the status bar.
Referenced by PlayNext(), and SoundWrapper::SoundWrapper().
|
private |
PlayAt Will play the song at the specified index.
Will play the next sound in line (_soundlist.at(index) ) if and only if one of the output is valid.
If the file is remote, it will play it in streaming, so a few seconds to cache it are to be expected. Remote files will use a QThread to check on the channel state repeatedly until the status is playing, and then it will send the signal to auto-hold PTT. If the remote file is .ogg, the duration is somehow flawed by -1 second, so we manually add a second for ogg or flacs files.
If the file is local, it will just play it and won't use a QThread to start auto-holding push to talk since it is instantly played.
It will also starts a QTimer::singleShot to pop_front the arrays containing the channel indexes.
index |
References _mainChannel, _mainOutputDevice, _soundList, _vacChannel, _VACOutputDevice, BASS_ATTRIB_VOL, BASS_ChannelBytes2Seconds(), BASS_ChannelGetLength(), BASS_ChannelIsActive(), BASS_ChannelPlay(), BASS_ChannelSetAttribute(), BASS_ChannelSetDevice(), BASS_ChannelSetFX(), BASS_FX_DX8_CHORUS, BASS_FX_DX8_COMPRESSOR, BASS_FX_DX8_DISTORTION, BASS_FX_DX8_ECHO, BASS_FX_DX8_FLANGER, BASS_FX_DX8_GARGLE, BASS_FXSetParameters(), BASS_Init(), BASS_POS_BYTE, BASS_STREAM_AUTOFREE, BASS_STREAM_PRESCAN, BASS_StreamCreateFile(), BASS_StreamCreateURL(), LIDL::CHORUS, LIDL::COMPRESSOR, LIDL::DISTORTION, LIDL::ECHO, LIDL::FLANGER, LIDL::GARGLE, and holdPTT().
Referenced by PlayNext().
|
slot |
PlayNext PlayNext function is called whenever the shortcut, or play button, is pressed.
It will either play the same sound over and over again (Singleton, Singleton Cancer) Or cycle through the files in the wrapper (Sequential, Sequential Auto)
References _index, _mainOutputDevice, _playMode, _shouldPlay, _soundList, _timerSequentialAutoPlay, _timerShouldPlay, _VACOutputDevice, LIDL::Auto, LIDL::AutoLoop, LIDL::Cancer, ErrorPlaying(), NowPlaying(), PlayAt(), LIDL::Sequential, and LIDL::Singleton.
Referenced by CustomPlayer(), and SoundWrapper::Play().
|
private |
resetShouldPlay will reset the _shouldPlay boolean to true;
It will stop all the timers and allows playing sounds again. (The _shouldPlay boolean isn't used if the playback mode is Singleton Cancer).
References _shouldPlay, and _timerShouldPlay.
Referenced by CustomPlayer(), and Stop().
void CustomPlayer::SetOutputDevice | ( | int | index | ) |
SetOutputDevice Sets the main output device of the player.
index | Device index. |
References _mainOutputDevice.
Referenced by SoundWrapper::OutputDeviceChanged(), and SoundWrapper::setPlayerMainOutput().
void CustomPlayer::SetPlaybackMode | ( | LIDL::Playback | playMode | ) |
SetPlaybackMode Sets the playback mode of the CustomPlayer.
playMode | One of playback mode defined in EnumsAndStructs.h |
References _playMode.
Referenced by SoundWrapper::SoundWrapper().
void CustomPlayer::SetPlaylist | ( | QVector< LIDL::SoundFile * > | soundList | ) |
SetPlaylist Set the playlist of the CustomPlayer.
Will attempt to clear the existing soundlist pointers if it exists.
soundList | The soundlist to be set. |
References _soundList.
Referenced by SoundWrapper::SoundWrapper().
void CustomPlayer::SetVACDevice | ( | int | index | ) |
SetVACDevice Sets the VAC output device of the player.
index | Device index. |
References _VACOutputDevice.
Referenced by SoundWrapper::setPlayerVACOutput(), and SoundWrapper::VACDeviceChanged().
|
slot |
Stop all the channels of this player.
Iterates through channels and calls BASS_ChannelStop() on them. BASS_ChannelStop will not crash the soundword if channel isn't valid. (Which could be the case if the iteration starts and somehow the vector is popped_front right at the same time.) It should not happen tho, as stop it called, it means the sound is still playing.
References _mainChannel, _timerSequentialAutoPlay, _vacChannel, BASS_ChannelStop(), and resetShouldPlay().
Referenced by SoundWrapper::Stop().
|
private |
The index of the next song to be played.
Referenced by CustomPlayer(), and PlayNext().
|
private |
|
private |
The index of the main output device.
Referenced by CustomPlayer(), GetOutputDevice(), PlayAt(), PlayNext(), and SetOutputDevice().
|
private |
Playmode, either Singleton, Singleton Cancer, Sequential, Sequential auto.
Referenced by CustomPlayer(), PlayNext(), and SetPlaybackMode().
|
private |
Boolean to know whether this player is allowed to play next song or not.
Referenced by CustomPlayer(), PlayNext(), and resetShouldPlay().
|
private |
Vector containing the soundlist.
Referenced by CustomPlayer(), PlayAt(), PlayNext(), SetPlaylist(), and ~CustomPlayer().
|
private |
Timer to know when to auto-play next song.
Referenced by CustomPlayer(), PlayNext(), and Stop().
|
private |
Timer to reset the _shouldPlay boolean (calls the resetShouldPlay method).
Referenced by CustomPlayer(), PlayNext(), and resetShouldPlay().
|
private |
The index of the main output device.
Referenced by CustomPlayer(), GetVACDevice(), PlayAt(), PlayNext(), and SetVACDevice().