/***************************************************************************
                            AlsaOut.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

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

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_AlsaOut.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/AlsaOut.h>

@implementation  AlsaOut


- initWithInt: (int)d client: (int)client port: (int)port cname: (NSString *)cname pname: (NSString *)pname
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_AlsaOut((int)d, (int)client, (int)port, (char*) [cname cString], (char*) [pname cString])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)d 
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_AlsaOut((int)d, 64, 0, "", "")];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_AlsaOut((kde_AlsaOut *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- openDev: (int)sqfd
{
	kde_AlsaOut_openDev((kde_AlsaOut *)[self qt], (int)sqfd);
	return self;
}

- closeDev
{
	kde_AlsaOut_closeDev((kde_AlsaOut *)[self qt]);
	return self;
}

- initDev
{
	kde_AlsaOut_initDev((kde_AlsaOut *)[self qt]);
	return self;
}

- (int) deviceType
{
	return (int) kde_AlsaOut_deviceType((kde_AlsaOut *)[self qt]);
}

- (NSString *) deviceName
{
	return (NSString *) [NSString stringWithCString: kde_AlsaOut_deviceName((kde_AlsaOut *)[self qt])];
}

- (int) rate
{
	return (int) kde_AlsaOut_rate((kde_AlsaOut *)[self qt]);
}

- noteOn: (unsigned char)chn note: (unsigned char)note vel: (unsigned char)vel
{
	kde_AlsaOut_noteOn((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)note, (unsigned char)vel);
	return self;
}

- noteOff: (unsigned char)chn note: (unsigned char)note vel: (unsigned char)vel
{
	kde_AlsaOut_noteOff((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)note, (unsigned char)vel);
	return self;
}

- keyPressure: (unsigned char)chn note: (unsigned char)note vel: (unsigned char)vel
{
	kde_AlsaOut_keyPressure((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)note, (unsigned char)vel);
	return self;
}

- chnPatchChange: (unsigned char)chn patch: (unsigned char)patch
{
	kde_AlsaOut_chnPatchChange((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)patch);
	return self;
}

- chnPressure: (unsigned char)chn vel: (unsigned char)vel
{
	kde_AlsaOut_chnPressure((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)vel);
	return self;
}

- chnPitchBender: (unsigned char)chn lsb: (unsigned char)lsb msb: (unsigned char)msb
{
	kde_AlsaOut_chnPitchBender((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)lsb, (unsigned char)msb);
	return self;
}

- chnController: (unsigned char)chn ctl: (unsigned char)ctl v: (unsigned char)v
{
	kde_AlsaOut_chnController((kde_AlsaOut *)[self qt], (unsigned char)chn, (unsigned char)ctl, (unsigned char)v);
	return self;
}

- sysex: (unsigned char*)data size: (unsigned long)size
{
	kde_AlsaOut_sysex((kde_AlsaOut *)[self qt], (unsigned char*)data, (unsigned long)size);
	return self;
}

- channelSilence: (unsigned char)chn
{
	kde_AlsaOut_channelSilence((kde_AlsaOut *)[self qt], (unsigned char)chn);
	return self;
}

- channelMute: (unsigned char)chn a: (int)a
{
	kde_AlsaOut_channelMute((kde_AlsaOut *)[self qt], (unsigned char)chn, (int)a);
	return self;
}

- setVolumePercentage: (int)volper
{
	kde_AlsaOut_setVolumePercentage((kde_AlsaOut *)[self qt], (int)volper);
	return self;
}

- (int) ok
{
	return (int) kde_AlsaOut_ok((kde_AlsaOut *)[self qt]);
}

- wait: (double)ticks
{
	kde_AlsaOut_wait((kde_AlsaOut *)[self qt], (double)ticks);
	return self;
}

- tmrSetTempo: (int)v
{
	kde_AlsaOut_tmrSetTempo((kde_AlsaOut *)[self qt], (int)v);
	return self;
}

- tmrStart: (int)tpcn
{
	kde_AlsaOut_tmrStart((kde_AlsaOut *)[self qt], (int)tpcn);
	return self;
}

- tmrStart
{
	kde_AlsaOut_tmrStart1((kde_AlsaOut *)[self qt]);
	return self;
}

- tmrStop
{
	kde_AlsaOut_tmrStop((kde_AlsaOut *)[self qt]);
	return self;
}

- tmrContinue
{
	kde_AlsaOut_tmrContinue((kde_AlsaOut *)[self qt]);
	return self;
}

- sync: (int)i
{
	kde_AlsaOut_sync((kde_AlsaOut *)[self qt], (int)i);
	return self;
}

- sync
{
	kde_AlsaOut_sync((kde_AlsaOut *)[self qt], 0);
	return self;
}

- seqbuf_dump
{
	kde_AlsaOut_seqbuf_dump((kde_AlsaOut *)[self qt]);
	return self;
}

- seqbuf_clean
{
	kde_AlsaOut_seqbuf_clean((kde_AlsaOut *)[self qt]);
	return self;
}

//- eventInit: (int*)ev
//{
//	kde_AlsaOut_eventInit((kde_AlsaOut *)[self qt], (int*)ev);
//	return self;
//}

//- eventSend: (int*)ep
//{
//	kde_AlsaOut_eventSend((kde_AlsaOut *)[self qt], (int*)ep);
//	return self;
//}

//- timerEventSend: (int)type
//{
//	kde_AlsaOut_timerEventSend((kde_AlsaOut *)[self qt], (int)type);
//	return self;
//}

@end
