private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { // Create the Frinika Track Wrapper so that when reading MultiEvents the // MidiEvents can be generated as well /** * PJS: The sequence is created for the first time here - reason why not in the ProjectContainer * is because the ticksPerQuarterNote variable might not be loaded before the object is entirely * read. Chicken and egg problem - but this solves it... */ if (this.getProject().getSequence() == null) { this.getProject().createSequence(); } this.ftw = this.getProject().getSequence().createFrinikaTrack(); in.defaultReadObject(); if (programEvent == null) { // previous versions trackHeaderPart = new MidiPart(); trackHeaderPart.lane = this; programEvent = new ProgramChangeEvent(trackHeaderPart, 0, 0, 0, 0); } midiMessageListeners = new HashSet<MidiMessageListener>(); // Jens programEvent.commitAdd(); // getPlayOptions(); // setUpKeys(); }
/** * Construct an empty lane * * @param ftw * @param project */ public MidiLane(FrinikaTrackWrapper ftw, ProjectContainer project) { super("Midi " + nameCount++, project); this.ftw = ftw; // cntrlList=new ControllerList(); // TODO different lists // We do not want this part to be in the part list trackHeaderPart = new MidiPart(); trackHeaderPart.lane = this; programEvent = new ProgramChangeEvent(trackHeaderPart, 0, 0, 0, 0); programEvent.commitAdd(); midiChannel = ftw.getMidiChannel(); }
/** * Constructor for deepClone * * @param cloneMe */ private MidiLane(MidiLane cloneMe) { super("Copy of " + cloneMe.getName(), cloneMe.project); trackHeaderPart = (MidiPart) (cloneMe.trackHeaderPart.deepCopy(null)); trackHeaderPart.lane = this; midiDeviceIndex = cloneMe.midiDeviceIndex; midiChannel = cloneMe.midiChannel; keyNames = cloneMe.keyNames; for (Part part : cloneMe.getParts()) { part.deepCopy(this); } ftw = cloneMe.ftw.getSequence().createFrinikaTrack(); ftw.setMidiChannel(midiChannel); setUpKeys(); }