public final boolean setMidi(@SuppressWarnings("hiding") final Path midi) {
		if (midi == null) {
			throw new IllegalArgumentException();
		}
		synchronized (this) {
			++this.lock;
			while (this.lockRead > 0) {
				try {
					wait();
				} catch (final InterruptedException e) {
					--this.lock;
					notifyAll();
					return false;
				}
			}
			this.lockRead = 1;
		}
		if ((this.midi == midi) && (this.mod == midi.toFile().lastModified())) {
			synchronized (this) {
				this.lockRead = 0;
				--this.lock;
				notifyAll();
			}
			return true;
		}
		this.midi = null;
		this.duration = 0;
		this.lastParsedMidi = null;
		this.tracksToChannel.clear();
		this.channelsToInstrument.clear();
		this.titles.clear();
		this.eventsEncoded.clear();
		this.renumberMap.clear();
		this.bytes.clear();
		for (final ParseState ps : MidiParser.instancesOfParseState) {
			ps.reset();
		}
		this.state = this.HEADER;
		this.activeTrack = 0;
		this.activeChannel = -1;
		this.ntracks = -1;
		try {
			prepareMidi(midi);
			this.midi = midi;
			this.mod = midi.toFile().lastModified();
			return true;
		} catch (final Exception e) {
			this.io.handleException(ExceptionHandle.CONTINUE, e);
			return false;
		} finally {
			synchronized (this) {
				this.lockRead = 0;
				--this.lock;
				notifyAll();
			}
		}
	}