From b521b4bfbfa8761434b3ee0b8fce3dfeee51bb98 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Tue, 27 May 2008 22:09:03 +0000 Subject: [PATCH] Instead of caching the last 10 sound clips, cache up to 4 megs of clips git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@509 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/media/sound/SoundManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/media/sound/SoundManager.java b/src/java/com/threerings/media/sound/SoundManager.java index c39d01b7..ad2acfc2 100644 --- a/src/java/com/threerings/media/sound/SoundManager.java +++ b/src/java/com/threerings/media/sound/SoundManager.java @@ -1010,7 +1010,16 @@ public class SoundManager protected float _clipVol = 1f; /** The cache of recent audio clips . */ - protected LRUHashMap _clipCache = new LRUHashMap(10); + protected LRUHashMap _clipCache = + new LRUHashMap(4 * 1024 * 1024, new LRUHashMap.ItemSizer() { + public int computeSize (byte[][] value) { + int total = 0; + for (byte[] bs : value) { + total += bs.length; + } + return total; + } + }); /** The set of locked audio clips; this is separate from the LRU so * that locking clips doesn't booch up an otherwise normal caching