public void init() throws Exception { LogUtil.put( LogFactory.getInstance( CommonStrings.getInstance().START, this, CommonStrings.getInstance().INIT)); CommonStrings commonStrings = CommonStrings.getInstance(); final String SOUND = " Sound: "; ProgressCanvas progressCanvas = ProgressCanvasFactory.getInstance(); soundsFactoryInterface.init(); Sound[] soundInterfaceArray = soundsFactoryInterface.getSoundInterfaceArray(); final String INIT_SOUND = "Initializing Sound: "; final SmallIntegerSingletonFactory smallIntegerSingletonFactory = SmallIntegerSingletonFactory.getInstance(); for (int i = 0; i < soundInterfaceArray.length; i++) { final Sound soundInterface = soundInterfaceArray[i]; if (soundInterface != null) { Integer indexInteger = smallIntegerSingletonFactory.getInstance(i); String indexString = indexInteger.toString(); StringBuilder stringBuffer = new StringBuilder(); stringBuffer.append(commonStrings.INDEX_LABEL); stringBuffer.append(indexString); stringBuffer.append(SOUND); stringBuffer.append(soundInterface.getClass().getName()); LogUtil.put( LogFactory.getInstance( stringBuffer.toString(), this, CommonStrings.getInstance().INIT)); soundInterface.init(); progressCanvas.addPortion(100, INIT_SOUND + indexString); } } soundsFactoryInterface.setInitialized(true); LogUtil.put( LogFactory.getInstance( CommonStrings.getInstance().END, this, CommonStrings.getInstance().INIT)); }
public void closeAll() throws Exception { LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "closeAll")); Sound[] soundInterfaceArray = soundsFactoryInterface.getSoundInterfaceArray(); ProgressCanvas progressCanvas = ProgressCanvasFactory.getInstance(); for (int index = 0; index < soundInterfaceArray.length; index++) { if (soundInterfaceArray[index] != null) { Player player = soundInterfaceArray[index].getPlayer(); if (player != null) { player.close(); progressCanvas.addPortion(100, "Closing Sound: ", index); } } } }