Merge branch 'master' into 'master'

Update SoundEffect

See merge request core-developers/forge!3743
This commit is contained in:
Anthony Calosa
2021-02-04 17:28:05 +00:00
69 changed files with 75 additions and 60 deletions

View File

@@ -203,6 +203,11 @@
<version>1.27</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.sipgate</groupId>
<artifactId>mp3-wav</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
<profiles>

View File

@@ -20,10 +20,14 @@ package forge.sound;
import javax.sound.sampled.*;
import com.google.common.io.Files;
import com.sipgate.mp3wav.Converter;
import forge.properties.ForgeConstants;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.MissingResourceException;
@@ -178,9 +182,15 @@ public class AudioClip implements IAudioClip {
if (!fSound.exists()) {
throw new IllegalArgumentException("Sound file " + fSound.toString() + " does not exist, cannot make a clip of it");
}
InputStream inputStream = null;
try {
AudioInputStream stream = AudioSystem.getAudioInputStream(fSound);
inputStream = Files.asByteSource(fSound).openStream();
} catch (IOException e) {
e.printStackTrace();
}
try {
ByteArrayInputStream bis = new ByteArrayInputStream(Converter.convertFrom(inputStream).toByteArray());
AudioInputStream stream = AudioSystem.getAudioInputStream(bis);
AudioFormat format = stream.getFormat();
DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat(), ((int) stream.getFrameLength() * format.getFrameSize()));
Clip clip = (Clip) AudioSystem.getLine(info);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
forge-gui/res/sound/tap.mp3 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -36,65 +36,65 @@ package forge.sound;
public enum SoundEffectType {
// Sounds must be listed in alphabetic order.
AddCounter("add_counter.wav", true),
Artifact("artifact.wav", false),
ArtifactCreature("artifact_creature.wav", false),
BlackLand("black_land.wav", false),
BlackRedGreenLand("black_red_green_land.wav", false),
BlackRedLand("black_red_land.wav", false),
BlackWhiteGreenLand("black_white_green_land.wav", false),
BlackWhiteLand("black_white_land.wav", false),
Block("block.wav", false),
BlueBlackLand("blue_black_land.wav", false),
BlueBlackRedLand("blue_black_red_land.wav", false),
BlueLand("blue_land.wav", false),
Creature("creature.wav", false),
Damage("damage.wav", true),
Destroy("destroy.wav", true),
Discard("discard.wav", false),
Draw("draw.wav", false),
Enchantment("enchant.wav", false),
EndOfTurn("end_of_turn.wav", false),
Equip("equip.wav", false),
Exile("exile.wav", false),
FlipCoin("flip_coin.wav", false),
GreenBlackBlueLand("green_black_blue_land.wav", false),
GreenBlackLand("green_black_land.wav", false),
GreenBlueLand("green_blue_land.wav", false),
GreenBlueRedLand("green_blue_red_land.wav", false),
GreenLand("green_land.wav", false),
GreenRedLand("green_red_land.wav", false),
GreenRedWhiteLand("green_red_white_land.wav", false),
Instant("instant.wav", false),
LifeGain("life_gain.wav", true),
LifeLoss("life_loss.wav", true),
LoseDuel("lose_duel.wav", false),
ManaBurn("mana_burn.wav", false),
OtherLand("other_land.wav", false),
Phasing("phasing.wav", true),
Planeswalker("planeswalker.wav", false),
Poison("poison.wav", true),
RedBlueLand("red_blue_land.wav", false),
RedBlueWhiteLand("red_blue_white_land.wav", false),
RedLand("red_land.wav", false),
Regen("regeneration.wav", false),
RemoveCounter("remove_counter.wav", true),
Sacrifice("sacrifice.wav", true),
AddCounter("add_counter.mp3", true),
Artifact("artifact.mp3", false),
ArtifactCreature("artifact_creature.mp3", false),
BlackLand("black_land.mp3", false),
BlackRedGreenLand("black_red_green_land.mp3", false),
BlackRedLand("black_red_land.mp3", false),
BlackWhiteGreenLand("black_white_green_land.mp3", false),
BlackWhiteLand("black_white_land.mp3", false),
Block("block.mp3", false),
BlueBlackLand("blue_black_land.mp3", false),
BlueBlackRedLand("blue_black_red_land.mp3", false),
BlueLand("blue_land.mp3", false),
Creature("creature.mp3", false),
Damage("damage.mp3", true),
Destroy("destroy.mp3", true),
Discard("discard.mp3", false),
Draw("draw.mp3", false),
Enchantment("enchant.mp3", false),
EndOfTurn("end_of_turn.mp3", false),
Equip("equip.mp3", false),
Exile("exile.mp3", false),
FlipCoin("flip_coin.mp3", false),
GreenBlackBlueLand("green_black_blue_land.mp3", false),
GreenBlackLand("green_black_land.mp3", false),
GreenBlueLand("green_blue_land.mp3", false),
GreenBlueRedLand("green_blue_red_land.mp3", false),
GreenLand("green_land.mp3", false),
GreenRedLand("green_red_land.mp3", false),
GreenRedWhiteLand("green_red_white_land.mp3", false),
Instant("instant.mp3", false),
LifeGain("life_gain.mp3", true),
LifeLoss("life_loss.mp3", true),
LoseDuel("lose_duel.mp3", false),
ManaBurn("mana_burn.mp3", false),
OtherLand("other_land.mp3", false),
Phasing("phasing.mp3", true),
Planeswalker("planeswalker.mp3", false),
Poison("poison.mp3", true),
RedBlueLand("red_blue_land.mp3", false),
RedBlueWhiteLand("red_blue_white_land.mp3", false),
RedLand("red_land.mp3", false),
Regen("regeneration.mp3", false),
RemoveCounter("remove_counter.mp3", true),
Sacrifice("sacrifice.mp3", true),
ScriptedEffect("", false), // Plays the effect defined by SVar:SoundEffect
Shuffle("shuffle.wav", false),
Sorcery("sorcery.wav", false),
StartDuel("start_duel.wav",false),
Tap("tap.wav", false),
Token("token.wav", true),
Untap("untap.wav", true),
WhiteBlueBlackLand("white_blue_black_land.wav", false),
WhiteBlueLand("white_blue_land.wav", false),
WhiteGreenBlueLand("white_green_blue_land.wav", false),
WhiteGreenLand("white_green_land.wav", false),
WhiteLand("white_land.wav", false),
WhiteRedBlackLand("white_red_black_land.wav", false),
WhiteRedLand("white_red_land.wav", false),
WinDuel("win_duel.wav", false);
Shuffle("shuffle.mp3", false),
Sorcery("sorcery.mp3", false),
StartDuel("start_duel.mp3",false),
Tap("tap.mp3", false),
Token("token.mp3", true),
Untap("untap.mp3", true),
WhiteBlueBlackLand("white_blue_black_land.mp3", false),
WhiteBlueLand("white_blue_land.mp3", false),
WhiteGreenBlueLand("white_green_blue_land.mp3", false),
WhiteGreenLand("white_green_land.mp3", false),
WhiteLand("white_land.mp3", false),
WhiteRedBlackLand("white_red_black_land.mp3", false),
WhiteRedLand("white_red_land.mp3", false),
WinDuel("win_duel.mp3", false);
private final String resourceFileName;
private final boolean isSync;