Added sound settings page

+ added sound setting page
+ added sound setting icon
+ moved sound settings from interface settings

Added master volume

+ added master volume slider.
+ volume can be changed by sliding bar or by using the spin box
+ Preview of  volume will be played when dragging and releasing bar.

Added checks for qt4

Qt4 does not have support for setting the volume without some lengthy
work around, I have disabled volume control for qt4 users and have
mentioned that "Master volume requires qt5".

Updated sfx

+ removed all old sfx
+ added new end step and tap sound
+ tap/endstep sound has a timer on it to prevent spamming
+ test sound engine will now use endstep sound

Made end step sfx softer

end step felt too harsh

Added player joined sound

+ added a sound for when a new player joins a room

Updated

Was missing a sound when a player joins

Made end step softer

Made end step even softer

updated sound again
This commit is contained in:
Matt Lowe 2015-05-05 10:06:23 +02:00
parent cf24f4aa04
commit c64eeb4ebe
19 changed files with 454 additions and 96 deletions

View file

@ -14,12 +14,15 @@ SoundEngine::SoundEngine(QObject *parent)
connect(settingsCache, SIGNAL(soundEnabledChanged()), this, SLOT(soundEnabledChanged()));
cacheData();
soundEnabledChanged();
lastTapPlayed = QDateTime::currentDateTime();
lastEndStepPlayed = QDateTime::currentDateTime();
}
void SoundEngine::cacheData()
{
static const QStringList fileNames = QStringList()
<< "notification" << "draw" << "playcard" << "shuffle" << "tap" << "untap" << "cuckoo";
<< "end_step" << "tap" << "player_joined";
for (int i = 0; i < fileNames.size(); ++i) {
QFile file(settingsCache->getSoundPath() + "/" + fileNames[i] + ".raw");
if(!file.exists())
@ -64,40 +67,28 @@ void SoundEngine::playSound(const QString &fileName)
inputBuffer->close();
inputBuffer->setData(audioData[fileName]);
inputBuffer->open(QIODevice::ReadOnly);
#if QT_VERSION >= 0x050000
audio->setVolume(settingsCache->getMasterVolume() / 100.0);
#endif
audio->start(inputBuffer);
}
void SoundEngine::notification()
void SoundEngine::endStep()
{
playSound("notification");
}
void SoundEngine::draw()
{
playSound("draw");
}
void SoundEngine::playCard()
{
playSound("playcard");
}
void SoundEngine::shuffle()
{
playSound("shuffle");
if (lastEndStepPlayed.secsTo(QDateTime::currentDateTime()) >= 1)
playSound("end_step");
lastEndStepPlayed = QDateTime::currentDateTime();
}
void SoundEngine::tap()
{
playSound("tap");
if (lastTapPlayed.secsTo(QDateTime::currentDateTime()) >= 1)
playSound("tap");
lastTapPlayed = QDateTime::currentDateTime();
}
void SoundEngine::untap()
void SoundEngine::playerJoined()
{
playSound("untap");
}
void SoundEngine::cuckoo()
{
playSound("cuckoo");
playSound("player_joined");
}