private void playnextsound()
	{
		// Only plays the next sound if the track is still playing
		if (!isPlaying())
			return;
		
		// The sound is no longer delayed
		this.delayed = false;
		
		// Checks whether more loops are needed
		// Loops the current sound if needed
		if (this.currentloopcount > 0 || 
				(this.currentloopcount < 0 && !this.released))
		{
			this.currentloopcount --;
			this.currentsound = playPhase(this.currentindex);
		}
		// Or plays the next sound
		else
		{
			// If the track was released from an infinite loop, remembers it
			if (this.currentloopcount < 0)
				this.released = false;
			
			// Gathers the information
			this.currentindex ++;
			
			// If the end of the track was reached, either repeats or stops
			if (this.currentindex >= getMaxPhase())
			{
				if (this.loops)
					this.currentindex = 0;
				else
				{
					this.delayed = false;
					this.paused = false;
					this.released = false;
					informSoundEnd();
					return;
				}
			}
			// Updates loop count
			this.currentloopcount = getLoopCount(this.currentindex);
			
			// And plays the new sound
			this.currentsound = playPhase(this.currentindex);
		}
	}