/***************************************************************************
 * playbacktracker.h
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2006- the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#ifndef PLAYBACKTRACKER_H
#define PLAYBACKTRACKER_H

#include <QVector>
#include <tse3/listen/Transport.h>

class SongView;
class TabBar;
class TrackPos;
class TabSongModel;

class PlaybackTracker : public TSE3::TransportCallback
{
public:
	PlaybackTracker(SongView* songView, const TabSongModel* tabSong);
	
	void resetCursor();
	
	virtual void Transport_MidiOut(TSE3::MidiCommand c);
	virtual void Transport_MidiIn(TSE3::MidiCommand c);
	
	static const uint playBackTrackCmd;
	
private:
	/*
		Converts the midi channel number to the internal channel
	*/
	uint midiChanToIntChan(uint channel);
	
	/*
		Go to the next time.
	*/
	void nextTime(const TabBar& bar, uint channel);
	
	SongView* mSongView;
	const TabSongModel* mTabSong;
	bool drumTrack;
	uint drumTrackNb;
	int midiPort;
	QVector<TrackPos> trackPos;
};

#endif
