forked from External/mage
Add a background music player to Mage Client. Music support .mp3 or .wav files. Put the audio files under plugins\sounds\music, random song will be played sequentially when GamePane is activited. the UI to adjust background music is add to preference dialog as well.
This commit is contained in:
parent
7102d08637
commit
6bbaa9fda1
6 changed files with 78 additions and 20 deletions
|
|
@ -2,6 +2,7 @@ package mage.client.util;
|
|||
import java.io.File;
|
||||
import java.awt.List;
|
||||
import javax.sound.sampled.*;
|
||||
import mage.client.constants.Constants;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -16,15 +17,13 @@ public class MusicPlayer {
|
|||
List filelist = new List();
|
||||
static MusicPlayer player = null;
|
||||
|
||||
public static String BASE_BGM_PATH = "G:\\mp3\\东方\\TH13_-_东方神灵庙BGM\\";
|
||||
|
||||
public MusicPlayer(){
|
||||
open();
|
||||
}
|
||||
|
||||
//open file and add list
|
||||
private void open(){
|
||||
filepath = BASE_BGM_PATH;
|
||||
filepath = Constants.BASE_MUSICS_PATH;
|
||||
filelist.removeAll();
|
||||
File filedir = new File(filepath);
|
||||
File[] fileread = filedir.listFiles();
|
||||
|
|
@ -122,7 +121,7 @@ public class MusicPlayer {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void run(){
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue