/***************************************************************************
                            GUSOut.cpp -  description
                             -------------------
    begin                : Sun Aug 26 09:45:02 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Aug 26 09:45:02 2001, using kdoc parser/custom Java conversion backend.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <libkmid/gusout.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/GUSOut.h>

class GUSOutJBridge : public GUSOut
{
public:
	GUSOutJBridge(int d, int total) : GUSOut(d, total) {}
	~GUSOutJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_newGUSOut__II(JNIEnv *env, jobject obj, jint d, jint total)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new GUSOutJBridge((int) d, (int) total));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_newGUSOut__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new GUSOutJBridge(0, 12));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (GUSOut*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_openDev(JNIEnv *env, jobject obj, jint sqfd)
{
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->openDev((int) sqfd);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_closeDev(JNIEnv *env, jobject obj)
{
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->closeDev();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_initDev(JNIEnv *env, jobject obj)
{
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->initDev();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_noteOn(JNIEnv *env, jobject obj, jstring chn, jstring note, jstring vel)
{
static QCString * _qstring_vel = 0;
static QCString * _qstring_note = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->noteOn((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, note, &_qstring_note), (uchar) QtSupport::toCharString(env, vel, &_qstring_vel));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_noteOff(JNIEnv *env, jobject obj, jstring chn, jstring note, jstring vel)
{
static QCString * _qstring_vel = 0;
static QCString * _qstring_note = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->noteOff((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, note, &_qstring_note), (uchar) QtSupport::toCharString(env, vel, &_qstring_vel));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_keyPressure(JNIEnv *env, jobject obj, jstring chn, jstring note, jstring vel)
{
static QCString * _qstring_vel = 0;
static QCString * _qstring_note = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->keyPressure((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, note, &_qstring_note), (uchar) QtSupport::toCharString(env, vel, &_qstring_vel));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_chnPatchChange(JNIEnv *env, jobject obj, jstring chn, jstring patch)
{
static QCString * _qstring_patch = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->chnPatchChange((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, patch, &_qstring_patch));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_chnPressure(JNIEnv *env, jobject obj, jstring chn, jstring vel)
{
static QCString * _qstring_vel = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->chnPressure((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, vel, &_qstring_vel));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_chnPitchBender(JNIEnv *env, jobject obj, jstring chn, jstring lsb, jstring msb)
{
static QCString * _qstring_msb = 0;
static QCString * _qstring_lsb = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->chnPitchBender((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, lsb, &_qstring_lsb), (uchar) QtSupport::toCharString(env, msb, &_qstring_msb));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_chnController(JNIEnv *env, jobject obj, jstring chn, jstring ctl, jstring v)
{
static QCString * _qstring_v = 0;
static QCString * _qstring_ctl = 0;
static QCString * _qstring_chn = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->chnController((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (uchar) QtSupport::toCharString(env, ctl, &_qstring_ctl), (uchar) QtSupport::toCharString(env, v, &_qstring_v));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_sysex(JNIEnv *env, jobject obj, jstring data, jlong size)
{
static QCString * _qstring_data = 0;
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->sysex((uchar*) QtSupport::toCharString(env, data, &_qstring_data), (ulong) size);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_setPatchesToUse(JNIEnv *env, jobject obj, jintArray patchesused)
{
	((GUSOutJBridge*) QtSupport::getQt(env, obj))->setPatchesToUse( (int*) QtSupport::toIntPtr(env, patchesused));
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_GUSOut_loadPatch(JNIEnv *env, jobject obj, jint pgm)
{
	return (jint) ((GUSOutJBridge*) QtSupport::getQt(env, obj))->loadPatch((int) pgm);
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_GUSOut_patch(JNIEnv *env, jobject obj, jint p)
{
	return (jint) ((GUSOutJBridge*) QtSupport::getQt(env, obj))->patch((int) p);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_GUSOut_setGUSPatchesDirectory(JNIEnv *env, jclass obj, jstring dir)
{
static QCString * _qstring_dir = 0;
	GUSOutJBridge::setGUSPatchesDirectory((char*) QtSupport::toCharString(env, dir, &_qstring_dir));
	return;
}

