Fixed a bug where sounds weren't reloaded when changing skins.
When restarting the program through the options menu, all sounds now get reloaded if the skin was changed. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -105,6 +105,12 @@ public enum HitSound implements SoundController.SoundComponent {
|
||||
return (currentSampleSet != null) ? clips.get(currentSampleSet) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Clip associated with the given sample set.
|
||||
* @param s the sample set
|
||||
*/
|
||||
public MultiClip getClip(SampleSet s) { return clips.get(s); }
|
||||
|
||||
/**
|
||||
* Sets the hit sound Clip for the sample type.
|
||||
* @param s the sample set
|
||||
|
||||
@@ -207,7 +207,14 @@ public class SoundController {
|
||||
ErrorHandler.error(String.format("Could not find sound file '%s'.", s.getFileName()), null, false);
|
||||
continue;
|
||||
}
|
||||
s.setClip(loadClip(currentFileName, currentFileName.endsWith(".mp3")));
|
||||
MultiClip newClip = loadClip(currentFileName, currentFileName.endsWith(".mp3"));
|
||||
if (s.getClip() != null) { // clip previously loaded (e.g. program restart)
|
||||
if (newClip != null) {
|
||||
s.getClip().destroy(); // destroy previous clip
|
||||
s.setClip(newClip);
|
||||
}
|
||||
} else
|
||||
s.setClip(newClip);
|
||||
currentFileIndex++;
|
||||
}
|
||||
|
||||
@@ -219,7 +226,14 @@ public class SoundController {
|
||||
ErrorHandler.error(String.format("Could not find hit sound file '%s'.", filename), null, false);
|
||||
continue;
|
||||
}
|
||||
s.setClip(ss, loadClip(currentFileName, false));
|
||||
MultiClip newClip = loadClip(currentFileName, false);
|
||||
if (s.getClip(ss) != null) { // clip previously loaded (e.g. program restart)
|
||||
if (newClip != null) {
|
||||
s.getClip(ss).destroy(); // destroy previous clip
|
||||
s.setClip(ss, newClip);
|
||||
}
|
||||
} else
|
||||
s.setClip(ss, newClip);
|
||||
currentFileIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user