/***************************************************************************
 * tabmidipropeteries.h: implementation of TabMidiProperties
 *
 * This file is part of KGuitar, a KDE tabulature editor
 *
 * copyright (C) 2003-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.
 ***************************************************************************/
 
#include "trackmidiproperties.h"
#include "util/assert.h"

TrackMidiProperties::TrackMidiProperties()
: midiPatch(0),
  midiChannel(0),
  midiChannelEffects(0),
  midiMidiPort(0),
  midiBank(0),
  midiVolume(16),
  midiBalance(8),
  midiChorus(0),
  midiReverb(0),
  midiPhaser(0),
  midiTremolo(0)
{
}

TrackMidiProperties::~TrackMidiProperties()
{
}

void TrackMidiProperties::clone(const TrackMidiProperties* midi)
{
	PRECONDITION( midi != 0x0 );
	
	midiPatch = midi->midiPatch;
	midiChannel = midi->midiChannel;
	midiChannelEffects = midi->midiChannelEffects;
	midiMidiPort = midi->midiMidiPort;
	midiBank = midi->midiBank;
	midiVolume = midi->midiVolume;
	midiBalance = midi->midiBalance;
	midiChorus = midi->midiChorus;
	midiReverb = midi->midiReverb;
	midiPhaser = midi->midiPhaser;
	midiTremolo = midi->midiTremolo;
}

void TrackMidiProperties::setPatch(uchar i)
{
	midiPatch = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::patch() const
{
	return midiPatch;
}

void TrackMidiProperties::setChannel(uchar i)
{
	midiChannel = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::channel() const
{
	return midiChannel;
}

void TrackMidiProperties::setChannelEffects(uchar i)
{
	midiChannelEffects = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::channelEffects() const
{
	return midiChannelEffects;
}

void TrackMidiProperties::setMidiPort(int i)
{
	midiMidiPort = i;
	
	emit midiPropertyChanged();
}

int TrackMidiProperties::midiPort() const
{
	return midiMidiPort;
}

void TrackMidiProperties::setBank(unsigned int i)
{
	midiBank = i;
	
	emit midiPropertyChanged();
}

unsigned int TrackMidiProperties::bank() const
{
	return midiBank;
}

void TrackMidiProperties::setVolume(uchar i)
{
	midiVolume = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::volume() const
{
	return midiVolume;
}

void TrackMidiProperties::setBalance(char i)
{
	midiBalance = i;
	
	emit midiPropertyChanged();
}

char TrackMidiProperties::balance() const
{
	return midiBalance;
}

void TrackMidiProperties::setChorus(uchar i)
{
	midiChorus = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::chorus() const
{
	return midiChorus;
}

void TrackMidiProperties::setReverb(uchar i)
{
	midiReverb = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::reverb() const
{
	return midiReverb;
}

void TrackMidiProperties::setPhaser(uchar i)
{
	midiPhaser = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::phaser() const
{
	return midiPhaser;
}

void TrackMidiProperties::setTremolo(uchar i)
{
	midiTremolo = i;
	
	emit midiPropertyChanged();
}

uchar TrackMidiProperties::tremolo() const
{
	return midiTremolo;
}

bool TrackMidiProperties::operator==(const TrackMidiProperties& properties) const
{
	return (midiPatch == properties.midiPatch && midiChannel == properties.midiChannel &&
			midiChannelEffects == properties.midiChannelEffects && midiMidiPort == properties.midiMidiPort &&
			midiBank == properties.midiBank && midiVolume == properties.midiVolume &&
			midiBalance == properties.midiBalance && midiChorus == properties.midiChorus &&
			midiReverb == properties.midiReverb && midiPhaser == properties.midiPhaser &&
			midiTremolo == properties.midiTremolo );
}

bool TrackMidiProperties::operator!=(const TrackMidiProperties& properties) const
{
	return !this->operator==(properties);
}

#include "trackmidiproperties.moc"
