/***************************************************************************
                            GUSOut.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_GUSOut.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/GUSOut.h>

@implementation  GUSOut


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

- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_GUSOut(0, 12)];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

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

- closeDev
{
	kde_GUSOut_closeDev((kde_GUSOut *)[self qt]);
	return self;
}

- initDev
{
	kde_GUSOut_initDev((kde_GUSOut *)[self qt]);
	return self;
}

- noteOn: (unsigned char)chn note: (unsigned char)note vel: (unsigned char)vel
{
	kde_GUSOut_noteOn((kde_GUSOut *)[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_GUSOut_noteOff((kde_GUSOut *)[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_GUSOut_keyPressure((kde_GUSOut *)[self qt], (unsigned char)chn, (unsigned char)note, (unsigned char)vel);
	return self;
}

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

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

- chnPitchBender: (unsigned char)chn lsb: (unsigned char)lsb msb: (unsigned char)msb
{
	kde_GUSOut_chnPitchBender((kde_GUSOut *)[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_GUSOut_chnController((kde_GUSOut *)[self qt], (unsigned char)chn, (unsigned char)ctl, (unsigned char)v);
	return self;
}

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

- setPatchesToUse: (int*)patchesused
{
	kde_GUSOut_setPatchesToUse((kde_GUSOut *)[self qt], (int*)patchesused);
	return self;
}

- (int) loadPatch: (int)pgm
{
	return (int) kde_GUSOut_loadPatch((kde_GUSOut *)[self qt], (int)pgm);
}

- (int) patch: (int)p
{
	return (int) kde_GUSOut_patch((kde_GUSOut *)[self qt], (int)p);
}

+ setGUSPatchesDirectory: (NSString *)dir
{
	kde_GUSOut_setGUSPatchesDirectory((char*) [dir cString]);
	return self;
}

@end
