f@0: /*
f@0: CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
f@0:
f@0: Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
f@0:
f@0: This program is free software: you can redistribute it and/or modify
f@0: it under the terms of the GNU General Public License as published by
f@0: the Free Software Foundation, either version 3 of the License, or
f@0: (at your option) any later version.
f@0:
f@0: This program is distributed in the hope that it will be useful,
f@0: but WITHOUT ANY WARRANTY; without even the implied warranty of
f@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f@0: GNU General Public License for more details.
f@0:
f@0: You should have received a copy of the GNU General Public License
f@0: along with this program. If not, see .
f@0: */
f@0:
f@0: package uk.ac.qmul.eecs.ccmi.sound;
f@0:
f@0: import java.io.InputStream;
f@0: import java.util.LinkedHashMap;
f@0: import java.util.Set;
f@0:
f@0: /**
f@0: * This class holds the stream of audio files associated to each
f@0: * sound event type. The audio file is played out each time the event, associated to
f@0: * it, happens.
f@0: */
f@0:
f@0: public class AudioResourcesService {
f@0: /**
f@0: * @param type A sound event type
f@0: * @return the file name associated to a sound event type
f@0: */
f@0: public static InputStream getAudiofile(SoundEvent type){
f@0: if(audioFileNames == null)
f@0: audioFileNames = new AudioResourcesService();
f@0: return audioFileNames.nameMap.get(type);
f@0: }
f@0:
f@0: public static Set eventTypes(){
f@0: if(audioFileNames == null)
f@0: audioFileNames = new AudioResourcesService();
f@0: return audioFileNames.nameMap.keySet();
f@0: }
f@0:
f@0: private AudioResourcesService(){
f@0: Class c = AudioResourcesService.class;
f@0: nameMap = new LinkedHashMap();
f@0: nameMap.put(SoundEvent.TREE_NODE_COLLAPSE, c.getResourceAsStream("audio/collapse.mp3"));
f@0: nameMap.put(SoundEvent.TREE_NODE_EXPAND, c.getResourceAsStream("audio/expand.mp3"));
f@0: nameMap.put(SoundEvent.LIST_BOTTOM_REACHED, c.getResourceAsStream("audio/endoflist.mp3"));
f@0: nameMap.put(SoundEvent.LIST_TOP_REACHED, c.getResourceAsStream("audio/endoflist.mp3"));
f@0: nameMap.put(SoundEvent.JUMP,c.getResourceAsStream("audio/jump.mp3"));
f@0: nameMap.put(SoundEvent.ERROR,c.getResourceAsStream("audio/error.mp3"));
f@0: nameMap.put(SoundEvent.OK,c.getResourceAsStream("audio/Ok.mp3"));
f@0: nameMap.put(SoundEvent.CANCEL,c.getResourceAsStream("audio/cancel.mp3"));
f@0: nameMap.put(SoundEvent.MESSAGE_OK,c.getResourceAsStream("audio/cancel.mp3"));
f@0: nameMap.put(SoundEvent.EMPTY,c.getResourceAsStream("audio/cancel.mp3"));
f@0: nameMap.put(SoundEvent.EDITING, c.getResourceAsStream("audio/editingMode.mp3"));
f@0: nameMap.put(SoundEvent.MAGNET_ON, c.getResourceAsStream("audio/magnetON.mp3"));
f@0: nameMap.put(SoundEvent.MAGNET_OFF, c.getResourceAsStream("audio/magnetOFF.mp3"));
f@0: nameMap.put(SoundEvent.HOOK_ON,c.getResourceAsStream("audio/hookON.mp3"));
f@0: nameMap.put(SoundEvent.HOOK_OFF,c.getResourceAsStream("audio/hookOFF.mp3"));
f@0: nameMap.put(SoundEvent.DRAG, c.getResourceAsStream("audio/drag.mp3"));
f@0: }
f@0:
f@0: private LinkedHashMap nameMap;
f@0: private static AudioResourcesService audioFileNames;
f@0: public static String FOLDER = "audio/";
f@0: }
f@0: