|
|
@ -76,13 +76,11 @@ public abstract class AudioModule extends BackendModule implements Updateable { |
|
|
|
* Create effect resource |
|
|
|
* Create effect resource |
|
|
|
* |
|
|
|
* |
|
|
|
* @param resource resource path |
|
|
|
* @param resource resource path |
|
|
|
* @param pitch default pitch (1 = unchanged) |
|
|
|
|
|
|
|
* @param gain default gain (0-1) |
|
|
|
|
|
|
|
* @return player |
|
|
|
* @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) |
|
|
|
* Register loop resource (music / effect loop) |
|
|
|
* |
|
|
|
* |
|
|
|
* @param resource resource path |
|
|
|
* @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 |
|
|
|
* @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); |
|
|
|
final LoopPlayer p = new LoopPlayer(createAudioResource(resource), loopsVolume); |
|
|
|
p.setFadeTimes(fadeIn, fadeOut); |
|
|
|
|
|
|
|
loopPlayers.add(p); |
|
|
|
loopPlayers.add(p); |
|
|
|
return 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 |
|
|
|
* 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 |
|
|
|
* @param res a resource name |
|
|
|
* @return the resource |
|
|
|
* @return the resource |
|
|
|
* @throws IllegalArgumentException if resource is already registered |
|
|
|
* @throws IllegalArgumentException if resource is already registered |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected DeferredAudio createAudio(String res) |
|
|
|
protected final DeferredAudio createAudioResource(String res) |
|
|
|
{ |
|
|
|
{ |
|
|
|
final DeferredAudio a = doCreateResource(res); |
|
|
|
final DeferredAudio a = doCreateResource(res); |
|
|
|
App.bus().send(new ResourceLoadRequest(a)); |
|
|
|
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 |
|
|
|
* @param res resource path |
|
|
|
* @return Deferred Audio |
|
|
|
* @return Deferred Audio |
|
|
|