File: 
 
[RetroPC.NET] / 
np2 / 
macosx / 
commng.cpp
 Revision 
1.5: 
download - view: 
text, 
annotated - 
select for diffs
Wed Mar  3 08:23:06 2004 JST (21 years, 8 months ago) by 
tk800
Branches: 
MAIN
CVS tags: 
VER_0_82_x64,
VER_0_82,
VER_0_81A,
VER_0_81,
VER_0_80,
VER_0_79,
VER_0_78,
VER_0_77,
VER_0_76,
VER_0_75,
HEAD
support CoreMIDI and IA32[MacOSX] (tk800)
#include	"compiler.h"
#include	"np2.h"
#include	"commng.h"
#include	"cmjasts.h"
#include	"cmmidi.h"
// ---- non connect
static UINT ncread(COMMNG self, BYTE *data) {
	(void)self;
	(void)data;
	return(0);
}
static UINT ncwrite(COMMNG self, BYTE data) {
	(void)self;
	(void)data;
	return(0);
}
static BYTE ncgetstat(COMMNG self) {
	(void)self;
	return(0xf0);
}
static long ncmsg(COMMNG self, UINT msg, long param) {
	(void)self;
	(void)msg;
	(void)param;
	return(0);
}
static void ncrelease(COMMNG self) {
}
static const _COMMNG com_nc = {
		COMCONNECT_OFF, ncread, ncwrite, ncgetstat, ncmsg, ncrelease};
// ----
void commng_initialize(void) {
	cmmidi_initailize();
}
COMMNG commng_create(UINT device) {
	COMMNG	ret;
	COMCFG* cfg;
	
	ret = NULL;
	switch(device) {
		case COMCREATE_PRINTER:
			if (np2oscfg.jastsnd) {
				ret = cmjasts_create();
			}
			break;
		case COMCREATE_MPU98II:
			cfg = &np2oscfg.mpu;;
			ret = cmmidi_create(cfg->mout, cfg->min, cfg->mdl);
			if (ret) {
				ret->msg(ret, COMMSG_MIMPIDEFFILE, (long)cfg->def);
				ret->msg(ret, COMMSG_MIMPIDEFEN, (long)cfg->def_en);
			}
			break;
		default:
			break;
	}
	if (ret == NULL) {
		ret = (COMMNG)&com_nc;
	}
	return(ret);
}
void commng_destroy(COMMNG hdl) {
	if (hdl) {
		hdl->release(hdl);
	}
}
RetroPC.NET-CVS <cvs@retropc.net>