Esempio n. 1
0
void boardpx1_bind(void) {

	fmboard_fmrestore(&g_opn, 0, 0);
	fmboard_fmrestore(&g_opn, 3, 1);
	fmboard_fmrestore(&g_opn, 6, 2);
	fmboard_fmrestore(&g_opn, 9, 3);
	fmboard_fmrestore(&g_opn2, 12, 0);
	fmboard_fmrestore(&g_opn2, 15, 1);
	fmboard_fmrestore(&g_opn2, 18, 2);
	fmboard_fmrestore(&g_opn2, 21, 3);
	fmboard_psgrestore(&g_opn, &g_psg1, 0);
	fmboard_psgrestore(&g_opn2, &g_psg2, 0);
	fmboard_rhyrestore(&g_opn, &g_rhythm, 0);
	fmboard_rhyrestore(&g_opn2, &g_rhythm2, 0);
	sound_streamregist(&g_opngen, (SOUNDCB)opngen_getpcmvr);
	sound_streamregist(&g_psg1, (SOUNDCB)psggen_getpcm);
	sound_streamregist(&g_psg2, (SOUNDCB)psggen_getpcm);
	rhythm_bind(&g_rhythm);
	rhythm_bind(&g_rhythm2);
	sound_streamregist(&g_adpcm, (SOUNDCB)adpcm_getpcm);
	sound_streamregist(&g_adpcm2, (SOUNDCB)adpcm_getpcm);

	cbuscore_attachsndex(0x188, spb_o, spb_i);
	cbuscore_attachsndex(0x588, spr_o, spr_i);
	cbuscore_attachsndex(0x088, spb_o2, spb_i2);
	cbuscore_attachsndex(0x488, spr_o2, spr_i2);
}
Esempio n. 2
0
void board26k_bind(void) {

	fmboard_fmrestore(&g_opn, 0, 0);
	fmboard_psgrestore(&g_opn, &g_psg1, 0);
	sound_streamregist(&g_opngen, (SOUNDCB)opngen_getpcm);
	sound_streamregist(&g_psg1, (SOUNDCB)psggen_getpcm);
	cbuscore_attachsndex(0x188 - g_opn.base, opn_o, opn_i);
}
Esempio n. 3
0
void boardspb_bind(void) {

	fmboard_fmrestore(0, 0);
	fmboard_fmrestore(3, 1);
	psggen_restore(&psg1);
	fmboard_rhyrestore(&rhythm, 0);
	sound_streamregist(&opngen, (SOUNDCB)opngen_getpcmvr);
	sound_streamregist(&psg1, (SOUNDCB)psggen_getpcm);
	rhythm_bind(&rhythm);
	sound_streamregist(&adpcm, (SOUNDCB)adpcm_getpcm);
	cbuscore_attachsndex(0x188 - opn.base, spb_o, spb_i);
}
Esempio n. 4
0
void board118_bind(void) {

	fmboard_fmrestore(&g_opn, 0, 0);
	fmboard_fmrestore(&g_opn, 3, 1);
	fmboard_psgrestore(&g_opn, &g_psg1, 0);
	fmboard_rhyrestore(&g_opn, &g_rhythm, 0);
	sound_streamregist(&g_opngen, (SOUNDCB)opngen_getpcm);
	sound_streamregist(&g_psg1, (SOUNDCB)psggen_getpcm);
	rhythm_bind(&g_rhythm);
	cs4231io_bind();
	cbuscore_attachsndex(0x188, ymf_o, ymf_i);
	iocore_attachout(0xa460, ymf_oa460);
	iocore_attachinp(0xa460, ymf_ia460);
}
Esempio n. 5
0
void boardx2_bind(void) {

    fmboard_fmrestore(0, 2);
    fmboard_fmrestore(3, 0);
    fmboard_fmrestore(6, 1);
    psggen_restore(&psg1);
    psggen_restore(&psg2);
    fmboard_rhyrestore(&rhythm, 0);
    sound_streamregist(&opngen, (SOUNDCB)opngen_getpcm);
    sound_streamregist(&psg1, (SOUNDCB)psggen_getpcm);
    sound_streamregist(&psg2, (SOUNDCB)psggen_getpcm);
    rhythm_bind(&rhythm);
    pcm86io_bind();
    cbuscore_attachsndex(0x088, opn_o, opn_i);
    cbuscore_attachsndex(0x188, opna_o, opna_i);
}
Esempio n. 6
0
void cs4231io_bind(void) {

	sound_streamregist(&cs4231, (SOUNDCB)cs4231_getpcm);
	iocore_attachout(0xc24, csctrl_oc24);
	iocore_attachout(0xc2b, csctrl_oc2b);
	iocore_attachout(0xc2d, csctrl_oc2d);
	iocore_attachinp(0xc24, csctrl_ic24);
	iocore_attachinp(0xc2b, csctrl_ic2b);
	iocore_attachinp(0xc2d, csctrl_ic2d);
}
Esempio n. 7
0
COMMNG cmvermouth_create(void) {

	MIDIHDL		midihdl;
	COMMNG		ret;
	CMMIDI		midi;

	if (cmver.vermouth == NULL) {
		goto cmcre_err1;
	}
	midihdl = midiout_create(cmver.vermouth, 512);
	if (midihdl == NULL) {
		goto cmcre_err1;
	}

	ret = (COMMNG)_MALLOC(sizeof(_COMMNG) + sizeof(_CMMIDI), "MIDI");
	if (ret == NULL) {
		goto cmcre_err2;
	}
	ret->connect = COMCONNECT_MIDI;
	ret->read = midiread;
	ret->write = midiwrite;
	ret->getstat = midigetstat;
	ret->msg = midimsg;
	ret->release = midirelease;
	midi = (CMMIDI)(ret + 1);
	ZeroMemory(midi, sizeof(_CMMIDI));
	midi->midihdl = midihdl;
	sound_streamregist((void *)midihdl, (SOUNDCB)vermouth_getpcm);
	midi->midictrl = MIDICTRL_READY;
//	midi->midisyscnt = 0;
//	midi->mpos = 0;
	midi->midilast = 0x80;
	FillMemory(midi->mch, sizeof(midi->mch), 0xff);
	return(ret);

cmcre_err2:
	midiout_destroy(midihdl);

cmcre_err1:
	return(NULL);
}
Esempio n. 8
0
COMMNG cmjasts_create(void) {

	COMMNG		ret;
	CMJAST		js;

	ret = (COMMNG)_MALLOC(sizeof(_COMMNG) + sizeof(_CMJAST), "JAST");
	if (ret == NULL) {
		goto cmjscre_err;
	}
	ret->connect = COMCONNECT_PARALLEL;
	ret->read = jsread;
	ret->write = jswrite;
	ret->getstat = jsgetstat;
	ret->msg = jsmsg;
	ret->release = jsrelease;
	js = (CMJAST)(ret + 1);
	ZeroMemory(js, sizeof(_CMJAST));
	sound_streamregist((void *)js, (SOUNDCB)js_getpcm);
	return(ret);

cmjscre_err:
	return(NULL);
}
Esempio n. 9
0
void fddmtrsnd_bind(void) {

    if (mtrsnd.enable) {
        sound_streamregist(&mtrsnd.snd, (SOUNDCB)pcmmix_getpcm);
    }
}
Esempio n. 10
0
COMMNG cmmidi_create(const OEMCHAR *midiout, const OEMCHAR *midiin,
													const OEMCHAR *module) {

	UINT		opened;
	UINT		id;
	void		(*shortout)(CMMIDI self, UINT32 msg);
	void		(*longout)(CMMIDI self, const UINT8 *msg, UINT leng);
	HMIDIFNOUT	out;
	HMIDIIN		hmidiin = NULL;
	COMMNG		ret;
	CMMIDI		midi;

	opened = 0;
	ZeroMemory(&out, sizeof(out));
	shortout = midi_ncshort;
	longout = midi_nclong;
	if (getmidioutid(midiout, &id) == SUCCESS) {
		if (midiOutOpen(&out.win32.hmidiout, id, 0, 0, CALLBACK_NULL)
														== MMSYSERR_NOERROR) {
			midiOutReset(out.win32.hmidiout);
			shortout = midi_win32short;
			longout = midi_win32long;
			opened |= CMMIDI_MIDIOUT;
		}
	}
	if (getmidiinid(midiin, &id) == SUCCESS) {
		if (midiInOpen(&hmidiin, id, (DWORD)g_hWndMain, 0, CALLBACK_WINDOW)
														== MMSYSERR_NOERROR) {
			midiInReset(hmidiin);
			opened |= CMMIDI_MIDIIN;
		}
	}
#if defined(VERMOUTH_LIB)
	else if (!milstr_cmp(midiout, cmmidi_vermouth)) {
		out.vermouth = midiout_create(vermouth_module, 512);
		if (out.vermouth != NULL) {
			shortout = midi_vermouthshort;
			longout = midi_vermouthlong;
			opened |= CMMIDI_VERMOUTH;
		}
	}
#endif
#if defined(MT32SOUND_DLL)
	else if (!milstr_cmp(midiout, cmmidi_mt32sound)) {
		if (mt32sound_open() == SUCCESS) {
			shortout = midi_mt32short;
			longout = midi_mt32long;
			opened |= CMMIDI_MT32SOUND;
		}
	}
#endif
	if (!opened) {
		goto cmcre_err1;
	}
	ret = (COMMNG)_MALLOC(sizeof(_COMMNG) + sizeof(_CMMIDI), "MIDI");
	if (ret == NULL) {
		goto cmcre_err2;
	}
	ret->connect = COMCONNECT_MIDI;
	ret->read = midiread;
	ret->write = midiwrite;
	ret->getstat = midigetstat;
	ret->msg = midimsg;
	ret->release = midirelease;
	midi = (CMMIDI)(ret + 1);
	ZeroMemory(midi, sizeof(_CMMIDI));
	midi->opened = opened;
	midi->shortout = shortout;
	midi->longout = longout;
	midi->out = out;
	midi->midictrl = MIDICTRL_READY;
#if 1
	midi->hmidiin = hmidiin;
	if (opened & CMMIDI_MIDIIN) {
		if (midiinhdlreg(midi, hmidiin) == SUCCESS) {
			midi->opened |= CMMIDI_MIDIINSTART;
			midi->hmidiinhdr.lpData = (char *)midi->midiinbuf;
			midi->hmidiinhdr.dwBufferLength = MIDI_BUFFER;
			midiInPrepareHeader(hmidiin, &midi->hmidiinhdr, sizeof(MIDIHDR));
			midiInAddBuffer(hmidiin, &midi->hmidiinhdr, sizeof(MIDIHDR));
			midiInStart(hmidiin);
		}
	}
#endif
#if defined(VERMOUTH_LIB)
	if (opened & CMMIDI_VERMOUTH) {
		sound_streamregist((void *)out.vermouth, (SOUNDCB)vermouth_getpcm);
	}
#endif
#if defined(MT32SOUND_DLL)
	if (opened & CMMIDI_MT32SOUND) {
		sound_streamregist(NULL, (SOUNDCB)mt32_getpcm);
	}
#endif
//	midi->midisyscnt = 0;
//	midi->mpos = 0;

	midi->midilast = 0x80;
//	midi->midiexcvwait = 0;
	midi->midimodule = (UINT8)module2number(module);
	FillMemory(midi->mch, sizeof(midi->mch), 0xff);
	return(ret);

cmcre_err2:
	if (opened & CMMIDI_MIDIOUT) {
		midiOutReset(out.win32.hmidiout);
		midiOutClose(out.win32.hmidiout);
	}
#if defined(VERMOUTH_LIB)
	if (opened & CMMIDI_VERMOUTH) {
		midiout_destroy(out.vermouth);
	}
#endif
#if defined(MT32SOUND_DLL)
	if (opened & CMMIDI_MT32SOUND) {
		mt32sound_close();
	}
#endif

cmcre_err1:
	return(NULL);
}
Esempio n. 11
0
/**
 * Bind
 * @param[in] opna The instance
 */
void opna_bind(POPNA opna)
{
	UINT8 cCaps = opna->s.cCaps;
	UINT nClock = 3993600;

	keydisp_bindopna(opna->s.reg, (cCaps & OPNA_HAS_EXTENDEDFM) ? 6 : 3, nClock);
	if (cCaps & OPNA_HAS_PSG)
	{
		keydisp_bindpsg(opna->s.reg, nClock);
	}

	CExternalOpna* pExt = reinterpret_cast<CExternalOpna*>(opna->userdata);
	if (pExt == NULL)
	{
		IExternalChip::ChipType nChipType = IExternalChip::kYM2203;
		if (cCaps & OPNA_HAS_EXTENDEDFM)
		{
			nChipType = IExternalChip::kYMF288;
			nClock *= 2;
			if (cCaps & OPNA_HAS_ADPCM)
			{
				nChipType = IExternalChip::kYM2608;
			}
			else if (cCaps == OPNA_MODE_3438)
			{
				nChipType = IExternalChip::kYM3438;
			}
		}
		pExt = static_cast<CExternalOpna*>(CExternalChipManager::GetInstance()->GetInterface(nChipType, nClock));
		opna->userdata = reinterpret_cast<INTPTR>(pExt);
	}
	if (pExt)
	{
		pExt->Reset();
		pExt->WriteRegister(0x22, 0x00);
		pExt->WriteRegister(0x29, 0x80);
		pExt->WriteRegister(0x10, 0xbf);
		pExt->WriteRegister(0x11, 0x30);
		pExt->WriteRegister(0x27, opna->s.reg[0x27]);
	}
	else
	{
		opna->opngen.opnch[2].extop = opna->s.reg[0x27] & 0xc0;
	}
	restore(opna);

	if (pExt)
	{
		if ((cCaps & OPNA_HAS_PSG) && (pExt->HasPsg()))
		{
			cCaps &= ~OPNA_HAS_PSG;
		}
		if ((cCaps & OPNA_HAS_RHYTHM) && (pExt->HasRhythm()))
		{
			cCaps &= ~OPNA_HAS_RHYTHM;
		}
		if ((cCaps & OPNA_HAS_ADPCM) && (pExt->HasADPCM()))
		{
			sound_streamregist(&opna->adpcm, (SOUNDCB)adpcm_getpcm_dummy);
			cCaps &= ~OPNA_HAS_ADPCM;
		}
	}

	if (cCaps & OPNA_HAS_PSG)
	{
		sound_streamregist(&opna->psg, (SOUNDCB)psggen_getpcm);
	}
	if (cCaps & OPNA_HAS_VR)
	{
		sound_streamregist(&opna->opngen, (SOUNDCB)opngen_getpcmvr);
	}
	else
	{
		sound_streamregist(&opna->opngen, (SOUNDCB)opngen_getpcm);
	}
	if (cCaps & OPNA_HAS_RHYTHM)
	{
		rhythm_bind(&opna->rhythm);
	}
	if (cCaps & OPNA_HAS_ADPCM)
	{
		sound_streamregist(&opna->adpcm, (SOUNDCB)adpcm_getpcm);
	}
}
Esempio n. 12
0
COMMNG
cmmidi_create(const char *midiout, const char *midiin, const char *module)
{
	COMMNG ret;
	CMMIDI midi;
	void (*outfn)(CMMIDI midi, UINT32 msg, UINT cnt);
	int hmidiout;
	int hmidiin;
#if defined(VERMOUTH_LIB)
	MIDIHDL vermouth = NULL;
#endif
	int opened = 0;

	/* MIDI-IN */
	hmidiin = getmidiin(midiin);
	if (hmidiin >= 0) {
		opened |= CMMIDI_MIDIIN;
	}

	/* MIDI-OUT */
	outfn = midiout_none;
	hmidiout = getmidiout(midiout);
	if (hmidiout >= 0) {
		outfn = midiout_device;
		opened |= CMMIDI_MIDIOUT;
	}
#if defined(VERMOUTH_LIB)
	else if (!milstr_cmp(midiout, cmmidi_vermouth)) {
		vermouth = midiout_create(vermouth_module, 512);
		if (vermouth != NULL) {
			outfn = midiout_vermouth;
			opened |= CMMIDI_VERMOUTH;
		}
	}
#endif
	if (!opened) {
		goto cmcre_err1;
	}
	ret = (COMMNG)_MALLOC(sizeof(_COMMNG) + sizeof(_CMMIDI), "MIDI");
	if (ret == NULL) {
		goto cmcre_err2;
	}
	ret->connect = COMCONNECT_MIDI;
	ret->read = midiread;
	ret->write = midiwrite;
	ret->getstat = midigetstat;
	ret->msg = midimsg;
	ret->release = midirelease;

	midi = (CMMIDI)(ret + 1);
	ZeroMemory(midi, sizeof(_CMMIDI));
	midi->opened = opened;
	midi->outfn = outfn;
	midi->midictrl = MIDICTRL_READY;
	midi->hmidiout = hmidiout;
	if (opened & CMMIDI_MIDIOUT) {
		gettimeofday(&midi->hmidiout_nextstart, NULL);
	}
#if defined(VERMOUTH_LIB)
	midi->vermouth = vermouth;
	if (opened & CMMIDI_VERMOUTH) {
		sound_streamregist((void *)vermouth, (SOUNDCB)vermouth_getpcm);
	}
#endif
	midi->midilast = 0x80;
	midi->midimodule = (UINT8)module2number(module);
	FillMemory(midi->mch, sizeof(midi->mch), 0xff);
	return ret;

cmcre_err2:
	if (opened & CMMIDI_MIDIIN) {
		if (hmidiin >= 0) {
			close(hmidiin);
		}
	}
	if (opened & CMMIDI_MIDIOUT) {
		if (hmidiout >= 0) {
			close(hmidiout);
		}
	}
#if defined(VERMOUTH_LIB)
	if (opened & CMMIDI_VERMOUTH) {
		midiout_destroy(vermouth);
	}
#endif
cmcre_err1:
	return NULL;
}