Skip to content

Commit

Permalink
added audio volume control
Browse files Browse the repository at this point in the history
see (#41, #21)
  • Loading branch information
t3kt committed Dec 26, 2014
1 parent 907d9d1 commit 2f61fd3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/config/BleepoutParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ BleepoutParameters::BleepoutParameters(BleepoutConfig& appConfig)
, ballsToAdd(0)
, enableSyphon(true)
, syphonAppName(appConfig.syphonAppName())
, syphonServerName(appConfig.syphonServerName()) {
, syphonServerName(appConfig.syphonServerName())
, audioVolume(.5) {
for (const auto& round : _appConfig.roundConfigs()) {
_queuedRoundNames.push_back(round->name());
}
Expand Down
1 change: 1 addition & 0 deletions src/config/BleepoutParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class BleepoutParameters {
bool enableSyphon;
std::string syphonAppName;
std::string syphonServerName;
float audioVolume;
private:
ofParameterGroup _params;
BleepoutConfig& _appConfig;
Expand Down
2 changes: 2 additions & 0 deletions src/core/AdminController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct AdminUIControls {
ofxUIButton* startRound;
ofxUIButton* endRound;
ofxUILabel* remainingTime;
ofxUISlider* audioVolume;

~AdminUIControls() {
for (auto& slot : roundQueueSlots)
Expand Down Expand Up @@ -163,6 +164,7 @@ void AdminController::setup() {
_controls->syphonAppName->setTriggerType(OFX_UI_TEXTINPUT_ON_UNFOCUS);
_controls->syphonServerName = _gui->addTextInput("Syphon Server", _appParams.syphonServerName);
_controls->syphonServerName->setTriggerType(OFX_UI_TEXTINPUT_ON_UNFOCUS);
_controls->audioVolume = _gui->addSlider("Audio Volume", 0, 1, &_appParams.audioVolume);

ofAddListener(_gui->newGUIEvent, this,
&AdminController::onUIEvent);
Expand Down
12 changes: 11 additions & 1 deletion src/core/AudioManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ void AudioManager::setup() {
}

void AudioManager::update() {
//...
_roundStartedSound.setVolume(_appParams.audioVolume);
_roundEndedSound.setVolume(_appParams.audioVolume);
_brickDestroyedSound.setVolume(_appParams.audioVolume);
_collisionSound.setVolume(_appParams.audioVolume);
_modifierAppliedSound.setVolume(_appParams.audioVolume);
_modifierRemovedSound.setVolume(_appParams.audioVolume);
_ballDestroyedSound.setVolume(_appParams.audioVolume);
_brickDestroyedSound.setVolume(_appParams.audioVolume);
_playerLivesChangedSound.setVolume(_appParams.audioVolume);
_playerLostSound.setVolume(_appParams.audioVolume);
_countdownTimerTickSound.setVolume(_appParams.audioVolume);
}

void AudioManager::attachTo(BleepoutApp &app) {
Expand Down

0 comments on commit 2f61fd3

Please sign in to comment.