Mercurial > hg > ccmieditor
comparison java/src/uk/ac/qmul/eecs/ccmi/sound/AudioResourcesService.java @ 0:9418ab7b7f3f
Initial import
author | Fiore Martin <fiore@eecs.qmul.ac.uk> |
---|---|
date | Fri, 16 Dec 2011 17:35:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9418ab7b7f3f |
---|---|
1 /* | |
2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool | |
3 | |
4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/) | |
5 | |
6 This program is free software: you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation, either version 3 of the License, or | |
9 (at your option) any later version. | |
10 | |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 */ | |
19 | |
20 package uk.ac.qmul.eecs.ccmi.sound; | |
21 | |
22 import java.io.InputStream; | |
23 import java.util.LinkedHashMap; | |
24 import java.util.Set; | |
25 | |
26 /** | |
27 * This class holds the stream of audio files associated to each | |
28 * sound event type. The audio file is played out each time the event, associated to | |
29 * it, happens. | |
30 */ | |
31 | |
32 public class AudioResourcesService { | |
33 /** | |
34 * @param type A sound event type | |
35 * @return the file name associated to a sound event type | |
36 */ | |
37 public static InputStream getAudiofile(SoundEvent type){ | |
38 if(audioFileNames == null) | |
39 audioFileNames = new AudioResourcesService(); | |
40 return audioFileNames.nameMap.get(type); | |
41 } | |
42 | |
43 public static Set<SoundEvent> eventTypes(){ | |
44 if(audioFileNames == null) | |
45 audioFileNames = new AudioResourcesService(); | |
46 return audioFileNames.nameMap.keySet(); | |
47 } | |
48 | |
49 private AudioResourcesService(){ | |
50 Class<AudioResourcesService> c = AudioResourcesService.class; | |
51 nameMap = new LinkedHashMap<SoundEvent, InputStream>(); | |
52 nameMap.put(SoundEvent.TREE_NODE_COLLAPSE, c.getResourceAsStream("audio/collapse.mp3")); | |
53 nameMap.put(SoundEvent.TREE_NODE_EXPAND, c.getResourceAsStream("audio/expand.mp3")); | |
54 nameMap.put(SoundEvent.LIST_BOTTOM_REACHED, c.getResourceAsStream("audio/endoflist.mp3")); | |
55 nameMap.put(SoundEvent.LIST_TOP_REACHED, c.getResourceAsStream("audio/endoflist.mp3")); | |
56 nameMap.put(SoundEvent.JUMP,c.getResourceAsStream("audio/jump.mp3")); | |
57 nameMap.put(SoundEvent.ERROR,c.getResourceAsStream("audio/error.mp3")); | |
58 nameMap.put(SoundEvent.OK,c.getResourceAsStream("audio/Ok.mp3")); | |
59 nameMap.put(SoundEvent.CANCEL,c.getResourceAsStream("audio/cancel.mp3")); | |
60 nameMap.put(SoundEvent.MESSAGE_OK,c.getResourceAsStream("audio/cancel.mp3")); | |
61 nameMap.put(SoundEvent.EMPTY,c.getResourceAsStream("audio/cancel.mp3")); | |
62 nameMap.put(SoundEvent.EDITING, c.getResourceAsStream("audio/editingMode.mp3")); | |
63 nameMap.put(SoundEvent.MAGNET_ON, c.getResourceAsStream("audio/magnetON.mp3")); | |
64 nameMap.put(SoundEvent.MAGNET_OFF, c.getResourceAsStream("audio/magnetOFF.mp3")); | |
65 nameMap.put(SoundEvent.HOOK_ON,c.getResourceAsStream("audio/hookON.mp3")); | |
66 nameMap.put(SoundEvent.HOOK_OFF,c.getResourceAsStream("audio/hookOFF.mp3")); | |
67 nameMap.put(SoundEvent.DRAG, c.getResourceAsStream("audio/drag.mp3")); | |
68 } | |
69 | |
70 private LinkedHashMap<SoundEvent, InputStream> nameMap; | |
71 private static AudioResourcesService audioFileNames; | |
72 public static String FOLDER = "audio/"; | |
73 } | |
74 |