From 8a3c6c86140b528f024253a30b7dfec1ba7d0fba Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Fri, 15 Aug 2008 22:38:46 +0000 Subject: [PATCH] There's no way to genericize the Comparable while using the static ClipBuffer.makeKey to create them, and non-genericized Comparables make the Baby Jesus(Nate) cry, so just drop the pretense and use String. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@631 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/openal/ClipBuffer.java | 10 +++++----- src/java/com/threerings/openal/SoundManager.java | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/java/com/threerings/openal/ClipBuffer.java b/src/java/com/threerings/openal/ClipBuffer.java index af7f3fef..4a851e12 100644 --- a/src/java/com/threerings/openal/ClipBuffer.java +++ b/src/java/com/threerings/openal/ClipBuffer.java @@ -52,7 +52,7 @@ public class ClipBuffer * Create a key that uniquely identifies this combination of clip * provider and path. */ - public static Comparable makeKey (ClipProvider provider, String path) + public static String makeKey (ClipProvider provider, String path) { // we'll just use a string, amazing! return provider + ":" + path; @@ -73,7 +73,7 @@ public class ClipBuffer /** * Returns the unique key for this clip buffer. */ - public Comparable getKey () + public String getKey () { return makeKey(_provider, _path); } @@ -242,9 +242,9 @@ public class ClipBuffer } _state = UNLOADED; - _observers.apply(new ObserverList.ObserverOp() { - public boolean apply (Object observer) { - ((Observer)observer).clipFailed(ClipBuffer.this); + _observers.apply(new ObserverList.ObserverOp() { + public boolean apply (Observer observer) { + observer.clipFailed(ClipBuffer.this); return true; } }); diff --git a/src/java/com/threerings/openal/SoundManager.java b/src/java/com/threerings/openal/SoundManager.java index 6559e159..82f85ca6 100644 --- a/src/java/com/threerings/openal/SoundManager.java +++ b/src/java/com/threerings/openal/SoundManager.java @@ -181,8 +181,8 @@ public class SoundManager } // configure our LRU map with a removal observer - _clips.setRemovalObserver(new LRUHashMap.RemovalObserver() { - public void removedFromMap (LRUHashMap map, + _clips.setRemovalObserver(new LRUHashMap.RemovalObserver() { + public void removedFromMap (LRUHashMap map, final ClipBuffer item) { _rqueue.postRunnable(new Runnable() { public void run () { @@ -218,7 +218,7 @@ public class SoundManager */ protected ClipBuffer getClip (ClipProvider provider, String path, Observer observer) { - Comparable ckey = ClipBuffer.makeKey(provider, path); + String ckey = ClipBuffer.makeKey(provider, path); ClipBuffer buffer = _clips.get(ckey); try { if (buffer == null) { @@ -301,7 +301,7 @@ public class SoundManager final Clip clip = buffer.load(); _rqueue.postRunnable(new Runnable() { public void run () { - Comparable ckey = buffer.getKey(); + String ckey = buffer.getKey(); log.debug("Loaded " + ckey + "."); _loading.remove(ckey); if (buffer.bind(clip)) { @@ -330,11 +330,11 @@ public class SoundManager protected float _baseGain = 1; /** Contains a mapping of all currently-loading clips. */ - protected HashMap _loading = Maps.newHashMap(); + protected HashMap _loading = Maps.newHashMap(); /** Contains a mapping of all loaded clips. */ - protected LRUHashMap _clips = - new LRUHashMap(DEFAULT_CACHE_SIZE, _sizer); + protected LRUHashMap _clips = + new LRUHashMap(DEFAULT_CACHE_SIZE, _sizer); /** Contains a queue of clip buffers waiting to be loaded. */ protected Queue _toLoad;