Changeset 164 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/structures/ScriptIncident.java


Ignore:
Timestamp:
12/04/2019 02:52:08 PM (6 years ago)
Author:
sdanthin
Message:

ScriptIncident?.java added if statement to create a correct AudioEvent? when an I_AudioEvent event is created.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/structures/ScriptIncident.java

    r150 r164  
    88import java.util.TreeMap; 
    99import scriptbuilder.structures.events.I_ScriptEvent; 
     10import scriptbuilder.structures.ScriptEvent.ScriptEventType; 
     11import scriptbuilder.structures.events.I_AudioEvent; 
     12import scriptbuilder.structures.events.AudioEvent; 
    1013 
    1114/** 
     
    7174     */ 
    7275    public int eventCount = 0; 
     76     
     77    public int audioEventCount = 0; 
    7378 
    7479    public SimulationScript script; 
     
    285290        //Check to see if there's already a timeslice here 
    286291        TimeSlice t = slices.get(start); 
     292        //logic to check if the added event needs to also have an associated audio event. 
     293         
    287294        //If not, make one; then, add the event to it 
    288295        if (t == null) 
    289296        { 
    290297            t = new TimeSlice(start, this); 
    291             t.addEvent(ev); 
     298            //t.addEvent(ev); 
    292299            slices.put(start, t); 
    293300        } 
    294301        else 
    295302        { 
    296             t.addEvent(ev); 
     303            //t.addEvent(ev); 
     304        } 
     305        t.addEvent(ev); 
     306        if(ev instanceof I_AudioEvent){ 
     307            //should make a path and a different filename fields for the file itself. Either that or deal with the string separation each time 
     308            //needs a check for when we move I_AudioEvents in the incident, as to not make duplicate events. 
     309            String fileName = number+"/"+number + "" + audioEventCount; 
     310            AudioEvent audio = (AudioEvent) ScriptEvent.factoryByType(ScriptEventType.AUDIO_EVENT); 
     311            ((I_AudioEvent) ev).setFileName(fileName); 
     312            audio.setAudioFilePathRelative(fileName); 
     313             
     314            t.addEvent(audio); 
     315            audioEventCount++; 
    297316        } 
    298317        eventCount++; 
     
    524543        if (!(oldTime == 0 && newTime > oldTime)) 
    525544        { 
     545            if(evt instanceof I_AudioEvent) 
     546            { 
     547                //todo: need to figure out how to remove the audioEvent tha corresponds with the  
     548                this.slices.get(oldTime).removeCorrespondingAudioEvent((I_AudioEvent)evt); 
     549                //this.addNewEvent(evt,newTime) 
     550            } 
    526551            this.slices.get(oldTime).events.remove(evt); 
    527552            this.addNewEvent(evt, newTime); 
Note: See TracChangeset for help on using the changeset viewer.