Pull the generic sound playing api from SoundManager up into
AbstractSoundManager and implement the actual sound playing with Java sound in SoundManager and with OpenAL in OpenALSoundManager. I left the SoundManager name alone so nothing using it will need to change, but if nothing besides yohoho is using it, I can refactor it to a more sane naming scheme. Rip out all the music and alternative format stuff since it didn't work anyway. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@622 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -21,8 +21,11 @@
|
||||
|
||||
package com.threerings.openal;
|
||||
|
||||
import static com.threerings.openal.Log.log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.lwjgl.openal.AL;
|
||||
import org.lwjgl.openal.AL10;
|
||||
|
||||
@@ -32,7 +35,7 @@ import com.samskivert.util.LRUHashMap;
|
||||
import com.samskivert.util.Queue;
|
||||
import com.samskivert.util.RunQueue;
|
||||
|
||||
import static com.threerings.openal.Log.log;
|
||||
import com.threerings.openal.ClipBuffer.Observer;
|
||||
|
||||
/**
|
||||
* An interface to the OpenAL library that provides a number of additional services:
|
||||
@@ -142,7 +145,16 @@ public class SoundManager
|
||||
*/
|
||||
public void loadClip (ClipProvider provider, String path)
|
||||
{
|
||||
getClip(provider, path);
|
||||
loadClip(provider, path, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a clip buffer for the sound clip loaded via the specified provider with the
|
||||
* specified path. The loaded clip is placed in the cache.
|
||||
*/
|
||||
public void loadClip (ClipProvider provider, String path, Observer observer)
|
||||
{
|
||||
getClip(provider, path, observer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,6 +207,16 @@ public class SoundManager
|
||||
* for loading if it is not already loaded.
|
||||
*/
|
||||
protected ClipBuffer getClip (ClipProvider provider, String path)
|
||||
{
|
||||
return getClip(provider, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clip buffer for the sound clip loaded via the specified provider with the
|
||||
* specified path. The clip buffer may come from the cache, and it will immediately be queued
|
||||
* for loading if it is not already loaded.
|
||||
*/
|
||||
protected ClipBuffer getClip (ClipProvider provider, String path, Observer observer)
|
||||
{
|
||||
Comparable ckey = ClipBuffer.makeKey(provider, path);
|
||||
ClipBuffer buffer = _clips.get(ckey);
|
||||
@@ -207,7 +229,7 @@ public class SoundManager
|
||||
_loading.put(ckey, buffer);
|
||||
}
|
||||
}
|
||||
buffer.resolve(null);
|
||||
buffer.resolve(observer);
|
||||
return buffer;
|
||||
|
||||
} catch (Throwable t) {
|
||||
|
||||
Reference in New Issue
Block a user