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