package org.cocolab.inpro.incremental.processor;

import java.util.Collection;
import java.util.List;

import org.cocolab.inpro.dm.RNLA;
import org.cocolab.inpro.incremental.unit.DialogueActIU;
import org.cocolab.inpro.incremental.unit.EditMessage;
import org.cocolab.inpro.incremental.unit.IU;

import edu.cmu.sphinx.util.props.PropertyException;
import edu.cmu.sphinx.util.props.PropertySheet;

public class AudioActionManager extends AbstractActionManager {

	@Override
	public void newProperties(PropertySheet ps) throws PropertyException {
		super.newProperties(ps);
		logger.info("Started AudioActionManager");
	}

	@Override
	public void leftBufferUpdate(Collection<? extends IU> ius,
			List<? extends EditMessage<? extends IU>> edits) {
		for (EditMessage<? extends IU> edit : edits) {
			DialogueActIU iu = (DialogueActIU) edit.getIU();
			RNLA r = iu.getAct();
			switch (edit.getType()) {
				case REVOKE: 
					break;
				case ADD: 
					assert (r.getAct() == RNLA.Act.PROMPT) : "I can only play prompts, don't make me do anything else.";
					if (r.doThis()) {
						logger.info("Setting audio path to " + this.audioPath);
						r.setPath(this.audioPath);
						logger.info("Speaking: " + r.toString());
						r.perform(null, null, this.audioDispatcher);
						this.signalListeners(iu);
					}
					break;
				case COMMIT: 
					break;
				default: logger.fatal("Found unimplemented EditType!");
			}
		}
	}
	
}

@@ -565,16 +565,106 @@
 es(ps);%0A
+%09%09logger.info(%22Setting audio path to %22 + this.audioPath);%0A%09%09RNLA.setPath(this.audioPath);%0A
 %09%09logger
@@ -1162,103 +1162,8 @@
 ) %7B%0A
-%09%09%09%09%09%09logger.info(%22Setting audio path to %22 + this.audioPath);%0A%09%09%09%09%09%09r.setPath(this.audioPath);%0A
 %09%09%09%09

Make audio path static, set only once from config. Fix protocol logic for determining what system utterances to play.