1000);
return;
}
VoiceManager vm = AppContext.getManager(VoiceManager.class);
TreatmentGroup group = null;
if (groupId != null && groupId.length() > 0) {
group = vm.createTreatmentGroup(groupId);
}
for (int i = 0; i < treatments.length; i++) {
TreatmentSetup setup = new TreatmentSetup();
setup.treatmentCreatedListener = new TreatmentCreatedListenerImpl(cellID);
setup.spatializer = getSpatializer(false);
String treatment = treatments[i];
String treatmentId = CallID.getCallID(cellID);
String pattern = "wlcontent://";
if (treatment.startsWith(pattern)) {
/*
* We need to create a URL
*/
String path = treatment.substring(pattern.length());
URL url;
try {
path = path.replaceAll(" ", "%20");
url = new URL(new URL(serverURL), "webdav/content/" + path);
treatment = url.toString();
} catch (MalformedURLException e) {
logger.warning("bad url: " + e.getMessage());
return;
}
} else {
pattern = "wls://";
if (treatment.startsWith(pattern)) {
/*
* We need to create a URL from wls:<module>/path
*/
treatment = treatment.substring(pattern.length()); // skip past wls://
int ix = treatment.indexOf("/");
if (ix < 0) {
logger.warning("Bad treatment: " + treatments[i]);
continue;
}
String moduleName = treatment.substring(0, ix);
String path = treatment.substring(ix + 1);
logger.fine("Module: " + moduleName + " treatment " + treatment);
URL url;
try {
path = path.replaceAll(" ", "%20");
url = new URL(new URL(serverURL),
"webdav/content/modules/installed/" + moduleName + "/audio/" + path);
treatment = url.toString();
logger.fine("Treatment: " + treatment);
} catch (MalformedURLException e) {
logger.warning("bad url: " + e.getMessage());
continue;
}
}
}
setup.treatment = treatment;
vm.addCallStatusListener(this, treatmentId);
if (setup.treatment == null || setup.treatment.length() == 0) {
logger.warning("Invalid treatment '" + setup.treatment + "'");
continue;
}
// OWL issue #60: make sure to use world location, not local
// location
Vector3f location = cellRef.get().getWorldTransform(null).getTranslation(null);
setup.x = location.getX();
setup.y = location.getY();
setup.z = location.getZ();
// do we need to start paused?
if (playWhen.equals(PlayWhen.ALWAYS) == false) {
setup.startPaused = true;
}
logger.info("Starting treatment " + setup.treatment + " at (" + setup.x
+ ":" + setup.y + ":" + setup.z + ")");
System.out.println("Starting treatment " + setup.treatment + " at (" + setup.x
+ ":" + setup.y + ":" + setup.z + ")");
try {
Treatment t = vm.createTreatment(treatmentId, setup);
if (group != null) {
group.addTreatment(t);
}