/***************************************************************************
                            AlsaOut.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/alsaout.h>
#include <qstring.h>
#include <qcstring.h>

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

class AlsaOutJBridge : public AlsaOut
{
public:
	AlsaOutJBridge(int d, int client, int port, const char* cname, const char* pname) : AlsaOut(d, client, port, cname, pname) {}
	~AlsaOutJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_seqbuf_dump() {
		AlsaOut::seqbuf_dump();
		return;
	}
	void protected_seqbuf_clean() {
		AlsaOut::seqbuf_clean();
		return;
	}
//	void protected_eventInit(snd_seq_event_t* ev) {
//		AlsaOut::eventInit(ev);
//		return;
//	}
//	void protected_eventSend(snd_seq_event_t* ep) {
//		AlsaOut::eventSend(ep);
//		return;
//	}
//	void protected_timerEventSend(int type) {
//		AlsaOut::timerEventSend(type);
//		return;
//	}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_newAlsaOut__IIILjava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jint d, jint client, jint port, jstring cname, jstring pname)
{
static QCString * _qstring_pname = 0;
static QCString * _qstring_cname = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new AlsaOutJBridge((int) d, (int) client, (int) port, (char*) QtSupport::toCharString(env, cname, &_qstring_cname), (char*) QtSupport::toCharString(env, pname, &_qstring_pname)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_newAlsaOut__I(JNIEnv *env, jobject obj, jint d)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new AlsaOutJBridge((int) d, 64, 0, "", ""));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

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

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

JNIEXPORT jint JNICALL
Java_org_kde_koala_AlsaOut_deviceType(JNIEnv *env, jobject obj)
{
	return (jint) ((AlsaOutJBridge*) QtSupport::getQt(env, obj))->deviceType();
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_AlsaOut_deviceName(JNIEnv *env, jobject obj)
{
	 const char *  _qcstring;
	_qcstring = (const char *)((AlsaOutJBridge*) QtSupport::getQt(env, obj))->deviceName();
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_AlsaOut_rate(JNIEnv *env, jobject obj)
{
	return (jint) ((AlsaOutJBridge*) QtSupport::getQt(env, obj))->rate();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_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;
	((AlsaOutJBridge*) 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_AlsaOut_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;
	((AlsaOutJBridge*) 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_AlsaOut_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;
	((AlsaOutJBridge*) 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_AlsaOut_chnPatchChange(JNIEnv *env, jobject obj, jstring chn, jstring patch)
{
static QCString * _qstring_patch = 0;
static QCString * _qstring_chn = 0;
	((AlsaOutJBridge*) 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_AlsaOut_chnPressure(JNIEnv *env, jobject obj, jstring chn, jstring vel)
{
static QCString * _qstring_vel = 0;
static QCString * _qstring_chn = 0;
	((AlsaOutJBridge*) 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_AlsaOut_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;
	((AlsaOutJBridge*) 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_AlsaOut_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;
	((AlsaOutJBridge*) 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_AlsaOut_sysex(JNIEnv *env, jobject obj, jstring data, jlong size)
{
static QCString * _qstring_data = 0;
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->sysex((uchar*) QtSupport::toCharString(env, data, &_qstring_data), (ulong) size);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_channelSilence(JNIEnv *env, jobject obj, jstring chn)
{
static QCString * _qstring_chn = 0;
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->channelSilence((uchar) QtSupport::toCharString(env, chn, &_qstring_chn));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_channelMute(JNIEnv *env, jobject obj, jstring chn, jint a)
{
static QCString * _qstring_chn = 0;
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->channelMute((uchar) QtSupport::toCharString(env, chn, &_qstring_chn), (int) a);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_setVolumePercentage(JNIEnv *env, jobject obj, jint volper)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->setVolumePercentage((int) volper);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_AlsaOut_ok(JNIEnv *env, jobject obj)
{
	return (jint) ((AlsaOutJBridge*) QtSupport::getQt(env, obj))->ok();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_wait(JNIEnv *env, jobject obj, jdouble ticks)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->wait((double) ticks);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_tmrSetTempo(JNIEnv *env, jobject obj, jint v)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->tmrSetTempo((int) v);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_tmrStart__I(JNIEnv *env, jobject obj, jint tpcn)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->tmrStart((int) tpcn);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_tmrStart__(JNIEnv *env, jobject obj)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->tmrStart();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_tmrStop(JNIEnv *env, jobject obj)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->tmrStop();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_tmrContinue(JNIEnv *env, jobject obj)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->tmrContinue();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_sync__I(JNIEnv *env, jobject obj, jint i)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->sync((int) i);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_sync__(JNIEnv *env, jobject obj)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->sync(0);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_seqbuf_1dump(JNIEnv *env, jobject obj)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->protected_seqbuf_dump();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_AlsaOut_seqbuf_1clean(JNIEnv *env, jobject obj)
{
	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->protected_seqbuf_clean();
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_AlsaOut_eventInit(JNIEnv *env, jobject obj, jintArray ev)
//{
//	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->protected_eventInit( (snd_seq_event_t*) QtSupport::toIntPtr(env, ev));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_AlsaOut_eventSend(JNIEnv *env, jobject obj, jintArray ep)
//{
//	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->protected_eventSend( (snd_seq_event_t*) QtSupport::toIntPtr(env, ep));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_AlsaOut_timerEventSend(JNIEnv *env, jobject obj, jint type)
//{
//	((AlsaOutJBridge*) QtSupport::getQt(env, obj))->protected_timerEventSend((int) type);
//	return;
//}

