@Override
		public void run() {
			try {
				playingLine = AudioSystem.getSourceDataLine(format);
				bufferSize = playingLine.getBufferSize();
				playingLine.open();
				playingLine.start();
			} catch (LineUnavailableException e) {
				//If something goes wrong, clean up the mess and never start the playback.
				e.printStackTrace();
				this.cleanUp();
				return;
			}
			//Sets the gain.
			this.setVolume(parent.getTotalGain());
			
			while(isRunning) {
				int written = -1;
				if(this.hasOpenPlayingLine() && currentByte < audioData.length)
					written = playingLine.write(audioData, currentByte, this.getBytesToRead());
				
				//If we have reached the end of the file or the loop point, check for looping.
				if(written == -1 || audioData.length - (currentByte + written) == 0 || (this.loopEnabled() && currentByte == loopEnd)) {
					if(this.loopsRemaining > 0) {
						//If we detect a loop, set the variables up and force the next iteration instantly.
						this.setupForLoop();
						continue;
					} else {
						//Else, we are done playing, as no more loops can be detected.
						//The loop will thus exit on the next iteration. 
						this.isRunning = false;
					}
				}
				
				currentByte += written;
				try {Thread.sleep(getSleepTime());}
				catch (InterruptedException e) {/*This will never happen, but to ensure that no strange exception is thrown...*/}
			} //!isRunning
			
			this.cleanUp();
			return;
		}