From 2c681d7291b6e685a912ffe7409163d6d167dbc5 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 22 Nov 2002 21:54:49 +0000 Subject: [PATCH] A base class for our sound repository classes. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1985 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/sound/Sounds.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/java/com/threerings/media/sound/Sounds.java diff --git a/src/java/com/threerings/media/sound/Sounds.java b/src/java/com/threerings/media/sound/Sounds.java new file mode 100644 index 000000000..8580494e4 --- /dev/null +++ b/src/java/com/threerings/media/sound/Sounds.java @@ -0,0 +1,31 @@ +// +// $Id: Sounds.java,v 1.1 2002/11/22 21:54:49 mdb Exp $ + +package com.threerings.media; + +/** + * A base class for sound repository classes. These would extend this + * class and define keys for the various sounds that are mapped in the + * properties file associated with that sound repository. + */ +public class Sounds +{ + /** The name of the sound repository configuration file. */ + public static final String PROP_NAME = "sounds"; + + /** + * Generates the key for the sound repository configuration file in + * the package associated with the class. For example, if a the class + * com.threerings.happy.fun.GameSounds were supplied to + * this method, it would return + * com.threerings.happy.fun.sounds which would reference + * a sounds.properties file in the + * com.threerings.happy.fun package. + */ + protected static String makeKey (Class clazz) + { + String cname = clazz.getName(); + int didx = cname.lastIndexOf("."); + return (didx != -1) ? cname.substring(0, didx) : ""; + } +}