blob: d4668425c353c998520c9ccb88201e00e8c2441e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "Swift/Controllers/SoundEventController.h"
#include <boost/bind.hpp>
#include "Swift/Controllers/EventController.h"
#include "Swift/Controllers/SoundPlayer.h"
namespace Swift {
SoundEventController::SoundEventController(EventController* eventController, SoundPlayer* soundPlayer, bool playSounds) {
eventController_ = eventController;
soundPlayer_ = soundPlayer;
playSounds_ = playSounds;
eventController_->onEventQueueEventAdded.connect(boost::bind(&SoundEventController::handleEventQueueEventAdded, this, _1));
}
void SoundEventController::handleEventQueueEventAdded(boost::shared_ptr<MessageEvent>) {
if (playSounds_) soundPlayer_->playSound(SoundPlayer::MessageReceived);
}
void SoundEventController::setPlaySounds(bool playSounds) {
playSounds_ = playSounds;
}
}
|