Class SoundCache
java.lang.Object
com.blackrook.gloop.openal.util.system.SoundCache
- All Implemented Interfaces:
AutoCloseable
A Buffer cache used for caching often-used buffers
so that they don't need to be reloaded.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassNode class for combining resources with buffers. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected static final Comparator<SoundCache.Node> Comparator for resource names.protected static final Comparator<SoundCache.Node> Comparator for buffer sizes. -
Constructor Summary
ConstructorsConstructorDescriptionSoundCache(int maxByteSize) Creates a new buffer cache with a set amount of byte capacity. -
Method Summary
-
Field Details
-
NAME_COMPARATOR
Comparator for resource names. -
SIZE_COMPARATOR
Comparator for buffer sizes. -
maxByteSize
protected int maxByteSize -
currBytes
protected int currBytes
-
-
Constructor Details
-
SoundCache
public SoundCache(int maxByteSize) Creates a new buffer cache with a set amount of byte capacity.- Parameters:
maxByteSize- the maximum bytes of this cache.
-
-
Method Details
-
addBuffer
-
getBuffer
-
removeLargestBuffer
Removes the largest buffer.- Returns:
- the buffer removed. It is NOT freed.
-
destroy
public void destroy()Destroys all buffers and stuff. -
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-