--- np2/macosx/commng.cpp 2003/10/16 17:59:37 1.1 +++ np2/macosx/commng.cpp 2004/03/02 23:23:06 1.5 @@ -1,8 +1,9 @@ #include "compiler.h" +#include "np2.h" #include "commng.h" +#include "cmjasts.h" #include "cmmidi.h" - // ---- non connect static UINT ncread(COMMNG self, BYTE *data) { @@ -25,7 +26,7 @@ static BYTE ncgetstat(COMMNG self) { return(0xf0); } -static UINT ncmsg(COMMNG self, UINT msg, long param) { +static long ncmsg(COMMNG self, UINT msg, long param) { (void)self; (void)msg; @@ -34,8 +35,6 @@ static UINT ncmsg(COMMNG self, UINT msg, } static void ncrelease(COMMNG self) { - - (void)self; } static const _COMMNG com_nc = { @@ -44,13 +43,35 @@ static const _COMMNG com_nc = { // ---- +void commng_initialize(void) { + + cmmidi_initailize(); +} + COMMNG commng_create(UINT device) { COMMNG ret; - + COMCFG* cfg; + ret = NULL; - if (device == COMCREATE_MPU98II) { - ret = cmmidi_create(); + 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;