//set timeRange duration
timeRange.setDuration(duration);
}
private EditUnitNumber getEditUnitNumber(String time, int editRate, long numSamples, String elementName) {
EditUnitNumber eun = null;
if(editRate != 0 && numSamples != 0) {
eun = new EditUnitNumber((int)numSamples,elementName);
eun.setEditRate(editRate);
}
else {
double timeval = timeUnitToAddress(time);
//check if time is a whole number
if(Math.floor(timeval) == timeval) {
//whole number so use seconds, use timeval as is
editRate = 1;
}
else {
//convert timevalto milliseconds
timeval = timeval * 1000;
editRate = 1000;
}
eun = new EditUnitNumber((int)timeval,elementName);
eun.setEditRate(editRate);
}
return eun;
}