|
|
|
@ -76,13 +76,11 @@ public abstract class AudioModule extends BackendModule implements Updateable { |
|
|
|
|
* Create effect resource |
|
|
|
|
* |
|
|
|
|
* @param resource resource path |
|
|
|
|
* @param pitch default pitch (1 = unchanged) |
|
|
|
|
* @param gain default gain (0-1) |
|
|
|
|
* @return player |
|
|
|
|
*/ |
|
|
|
|
public EffectPlayer createEffect(String resource, double pitch, double gain) |
|
|
|
|
public EffectPlayer createEffect(String resource) |
|
|
|
|
{ |
|
|
|
|
return new EffectPlayer(createAudio(resource), pitch, gain, effectsVolume); |
|
|
|
|
return new EffectPlayer(createAudioResource(resource), effectsVolume); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -90,16 +88,11 @@ public abstract class AudioModule extends BackendModule implements Updateable { |
|
|
|
|
* Register loop resource (music / effect loop) |
|
|
|
|
* |
|
|
|
|
* @param resource resource path |
|
|
|
|
* @param pitch default pitch (1 = unchanged) |
|
|
|
|
* @param gain default gain (0-1) |
|
|
|
|
* @param fadeIn default time for fadeIn |
|
|
|
|
* @param fadeOut default time for fadeOut |
|
|
|
|
* @return player |
|
|
|
|
*/ |
|
|
|
|
public LoopPlayer createLoop(String resource, double pitch, double gain, double fadeIn, double fadeOut) |
|
|
|
|
public LoopPlayer createLoop(String resource) |
|
|
|
|
{ |
|
|
|
|
final LoopPlayer p = new LoopPlayer(createAudio(resource), pitch, gain, loopsVolume); |
|
|
|
|
p.setFadeTimes(fadeIn, fadeOut); |
|
|
|
|
final LoopPlayer p = new LoopPlayer(createAudioResource(resource), loopsVolume); |
|
|
|
|
loopPlayers.add(p); |
|
|
|
|
return p; |
|
|
|
|
} |
|
|
|
@ -107,13 +100,15 @@ public abstract class AudioModule extends BackendModule implements Updateable { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create {@link DeferredAudio} for a resource, request deferred load and |
|
|
|
|
* add to the resources list. |
|
|
|
|
* add to the resources list.<br> |
|
|
|
|
* The method is accessed only from within this class, since the sound |
|
|
|
|
* registry holds players, not the resources themselves. |
|
|
|
|
* |
|
|
|
|
* @param res a resource name |
|
|
|
|
* @return the resource |
|
|
|
|
* @throws IllegalArgumentException if resource is already registered |
|
|
|
|
*/ |
|
|
|
|
protected DeferredAudio createAudio(String res) |
|
|
|
|
protected final DeferredAudio createAudioResource(String res) |
|
|
|
|
{ |
|
|
|
|
final DeferredAudio a = doCreateResource(res); |
|
|
|
|
App.bus().send(new ResourceLoadRequest(a)); |
|
|
|
@ -123,7 +118,9 @@ public abstract class AudioModule extends BackendModule implements Updateable { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Create a backend-specific deferred audio resource |
|
|
|
|
* Create a backend-specific deferred audio resource.<br> |
|
|
|
|
* The actual resource instance should be created here. Registering, loading |
|
|
|
|
* etc. is handled higher. |
|
|
|
|
* |
|
|
|
|
* @param res resource path |
|
|
|
|
* @return Deferred Audio |
|
|
|
|