Skip to content

Commit

Permalink
Add copyright text and comments to SoundManager
Browse files Browse the repository at this point in the history
  • Loading branch information
sensualcoder committed Jul 23, 2023
1 parent 179b5c1 commit 0674a0e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
19 changes: 19 additions & 0 deletions megamek/src/megamek/client/ui/swing/audio/Sound.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright (c) 2023 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMek.
*
* MegaMek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MegaMek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>.
*/

package megamek.client.ui.swing.audio;

import javax.sound.sampled.Clip;
Expand Down
31 changes: 31 additions & 0 deletions megamek/src/megamek/client/ui/swing/audio/SoundManager.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright (c) 2023 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMek.
*
* MegaMek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MegaMek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>.
*/

package megamek.client.ui.swing.audio;

import megamek.client.ui.Messages;
Expand Down Expand Up @@ -26,27 +45,39 @@ public static SoundManager getInstance() {
protected SoundManager() {
}

/**
* Plays a sound when a chat message is entered
*/
public void bingChat() {
if(!GUIP.getSoundMuteChat()) {
setVolume(bingChat);
bingChat.play();
}
}

/**
* Plays a sound when it is the user's turn during a game
*/
public void bingMyTurn() {
if(!GUIP.getSoundMuteMyTurn()) {
setVolume(bingMyTurn);
bingMyTurn.play();
}
}

/**
* Plays a sound when it is another user's turn during a game
*/
public void bingOthersTurn() {
if(!GUIP.getSoundMuteOthersTurn()) {
setVolume(bingOthersTurn);
bingOthersTurn.play();
}
}

/**
* Loads the sound files from the paths given in the client settings
*/
public void loadSoundFiles() {
final Clip bingClipChat = loadSoundClip(GUIP.getSoundBingFilenameChat());
bingChat = new Sound(bingClipChat);
Expand Down

0 comments on commit 0674a0e

Please sign in to comment.