| version 1.2, 2003/11/17 13:41:43 | version 1.6, 2007/01/10 18:03:01 | 
| Line 2 | Line 2 | 
 |  |  | 
 | #include "np2.h" | #include "np2.h" | 
 | #include "commng.h" | #include "commng.h" | 
 |  | #include "cmjasts.h" | 
 |  |  | 
 |  |  | 
 | // ---- non connect | // ---- non connect | 
| Line 76  commng_create(UINT device) | Line 77  commng_create(UINT device) | 
 | ret = NULL; | ret = NULL; | 
 |  |  | 
 | switch (device) { | switch (device) { | 
 |  | case COMCREATE_SERIAL: | 
 |  | cfg = &np2oscfg.com[0]; | 
 |  | break; | 
 |  |  | 
 |  | case COMCREATE_PC9861K1: | 
 |  | cfg = &np2oscfg.com[1]; | 
 |  | break; | 
 |  |  | 
 |  | case COMCREATE_PC9861K2: | 
 |  | cfg = &np2oscfg.com[2]; | 
 |  | break; | 
 |  |  | 
 | case COMCREATE_MPU98II: | case COMCREATE_MPU98II: | 
 | cfg = &np2oscfg.mpu; | cfg = &np2oscfg.mpu; | 
 | break; | break; | 
 |  |  | 
 |  | case COMCREATE_PRINTER: | 
 |  | cfg = NULL; | 
 |  | if (np2oscfg.jastsnd) { | 
 |  | ret = cmjasts_create(); | 
 |  | } | 
 |  | break; | 
 |  |  | 
 | default: | default: | 
 | cfg = NULL; | cfg = NULL; | 
 | break; | break; | 
 | } | } | 
 | if (cfg) { | if (cfg) { | 
| if (cfg->port == COMPORT_MIDI) { | if ((cfg->port >= COMPORT_COM1) | 
|  | && (cfg->port <= COMPORT_COM4)) { | 
|  | ret = cmserial_create(cfg->port - COMPORT_COM1 + 1, cfg->param, cfg->speed); | 
|  | } else if (cfg->port == COMPORT_MIDI) { | 
 | ret = cmmidi_create(cfg->mout, cfg->min, cfg->mdl); | ret = cmmidi_create(cfg->mout, cfg->min, cfg->mdl); | 
 | if (ret) { | if (ret) { | 
 | (*ret->msg)(ret, COMMSG_MIMPIDEFFILE, (long)cfg->def); | (*ret->msg)(ret, COMMSG_MIMPIDEFFILE, (long)cfg->def); | 
| Line 102  void | Line 125  void | 
 | commng_destroy(COMMNG hdl) | commng_destroy(COMMNG hdl) | 
 | { | { | 
 |  |  | 
| if (hdl && (hdl != &com_nc)) { | if (hdl) { | 
 | hdl->release(hdl); | hdl->release(hdl); | 
 | } | } | 
 | } | } |