示例#1
0
/**
 * ユーザーが OK のボタン (IDOK ID がのボタン) をクリックすると呼び出されます
 */
void SndOptMixerPage::OnOK()
{
	bool bUpdated = false;

	const UINT8 cFM = static_cast<UINT8>(m_fm.GetPos());
	if (np2cfg.vol_fm != cFM)
	{
		np2cfg.vol_fm = cFM;
		opngen_setvol(cFM);
		bUpdated = true;
	}

	const UINT8 cPSG = static_cast<UINT8>(m_psg.GetPos());
	if (np2cfg.vol_ssg != cPSG)
	{
		np2cfg.vol_ssg = cPSG;
		psggen_setvol(cPSG);
		bUpdated = true;
	}

	const UINT8 cADPCM = static_cast<UINT8>(m_adpcm.GetPos());
	if (np2cfg.vol_adpcm != cADPCM)
	{
		np2cfg.vol_adpcm = cADPCM;
		adpcm_setvol(cADPCM);
		for (UINT i = 0; i < _countof(g_opna); i++)
		{
			adpcm_update(&g_opna[i].adpcm);
		}
		bUpdated = true;
	}

	const UINT8 cPCM = static_cast<UINT8>(m_pcm.GetPos());
	if (np2cfg.vol_pcm != cPCM)
	{
		np2cfg.vol_pcm = cPCM;
		pcm86gen_setvol(cPCM);
		pcm86gen_update();
		bUpdated = true;
	}

	const UINT8 cRhythm = static_cast<UINT8>(m_rhythm.GetPos());
	if (np2cfg.vol_rhythm != cRhythm)
	{
		np2cfg.vol_rhythm = cRhythm;
		rhythm_setvol(cRhythm);
		for (UINT i = 0; i < _countof(g_opna); i++)
		{
			rhythm_update(&g_opna[i].rhythm);
		}
		bUpdated = true;
	}

	if (bUpdated)
	{
		::sysmng_update(SYS_UPDATECFG);
	}
}
示例#2
0
static LRESULT CALLBACK SndmixDlgProc(HWND hWnd, UINT msg,
													WPARAM wp, LPARAM lp) {

	int		i;
	int		ctrlid;

	switch (msg) {
		case WM_INITDIALOG:
			for (i=0; i<5; i++) {
				sliderinit(hWnd, &sndmixitem[i]);
			}
			return(TRUE);

		case WM_COMMAND:
			switch(LOWORD(wp)) {
				case IDC_SNDMIXDEF:
					for (i=0; i<5; i++) {
						slidersetvalue(hWnd, &sndmixitem[i], 64);
					}
					break;
			}
			break;

		case WM_HSCROLL:
			ctrlid = GetDlgCtrlID((HWND)lp);
			for (i=0; i<5; i++) {
				if (ctrlid == sndmixitem[i].res) {
					sliderresetpos(hWnd, &sndmixitem[i]);
					return(TRUE);
				}
			}
			break;

		case WM_NOTIFY:
			if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) {
				for (i=0; i<5; i++) {
					if (sliderrestore(hWnd, &sndmixitem[i])) {
						sysmng_update(SYS_UPDATECFG);
					}
				}
				opngen_setvol(np2cfg.vol_fm);
				psggen_setvol(np2cfg.vol_ssg);
				rhythm_setvol(np2cfg.vol_rhythm);
				adpcm_setvol(np2cfg.vol_adpcm);
				pcm86gen_setvol(np2cfg.vol_pcm);
				pcm86gen_update();
				for (i = 0; i < NELEMENTS(g_opna); i++)
				{
					rhythm_update(&g_opna[i].rhythm);
					adpcm_update(&g_opna[i].adpcm);
				}
				return(TRUE);
			}
			break;
	}
	return(FALSE);
}
示例#3
0
文件: statsave.c 项目: aliaspider/np2
static int flagload_fm(STFLAGH sfh, const SFENTRY *t) {

	int		ret;
	UINT	saveflg;
	OPNKEY	opnkey;
	UINT	i;

	ret = statflag_read(sfh, &g_usesound, sizeof(g_usesound));
	fmboard_reset(&np2cfg, g_usesound);

	switch(g_usesound) {
		case 0x01:
			saveflg = FLAG_MG;
			break;

		case 0x02:
			saveflg = FLAG_FM1A;
			break;

		case 0x04:
			saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_RHYTHM | FLAG_PCM86;
			break;

		case 0x06:
			saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_FM2A | FLAG_RHYTHM | FLAG_PCM86;
			break;

		case 0x08:
			saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_RHYTHM | FLAG_CS4231;
			break;

		case 0x14:
			saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_RHYTHM | FLAG_ADPCM | FLAG_PCM86;
			break;

		case 0x20:
			saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_RHYTHM | FLAG_ADPCM;
			break;

		case 0x40:
			saveflg = FLAG_FM1A | FLAG_FM1B | FLAG_FM2A | FLAG_FM2B | FLAG_RHYTHM | FLAG_ADPCM;
			break;

		case 0x80:
			saveflg = FLAG_PSG1 | FLAG_PSG2 | FLAG_PSG3;
			break;

		default:
			saveflg = 0;
			break;
	}

	if (saveflg & FLAG_MG) {
		ret |= statflag_read(sfh, &g_musicgen, sizeof(g_musicgen));
		board14_allkeymake();
	}

	if (saveflg & FLAG_FM1A) {
		ret |= statflag_read(sfh, &g_fmtimer, sizeof(g_fmtimer));
		ret |= statflag_read(sfh, &g_opn, sizeof(g_opn));
		ret |= statflag_read(sfh, &opnkey, sizeof(opnkey));
		for (i = 0; i < OPNCH_MAX; i++)
		{
			g_opngen.opnch[i].keyreg = opnkey.keyreg[i];
		}
		g_opngen.opnch[2].extop = opnkey.extop[0];
		g_opngen.opnch[5].extop = opnkey.extop[1];
		g_opngen.opnch[8].extop = opnkey.extop[2];
		g_opngen.opnch[11].extop = opnkey.extop[3];
	}
	if (saveflg & FLAG_PSG1) {
		ret |= statflag_read(sfh, &g_psg1.reg, sizeof(PSGREG));
	}
	if (saveflg & FLAG_PSG2) {
		ret |= statflag_read(sfh, &g_psg2.reg, sizeof(PSGREG));
	}
	if (saveflg & FLAG_PSG3) {
		ret |= statflag_read(sfh, &g_psg3.reg, sizeof(PSGREG));
	}
	if (saveflg & FLAG_ADPCM) {
		ret |= statflag_read(sfh, &g_adpcm, sizeof(g_adpcm));
	}
	if (saveflg & FLAG_PCM86) {
		ret |= statflag_read(sfh, &pcm86, sizeof(pcm86));
	}
	if (saveflg & FLAG_CS4231) {
		ret |= statflag_read(sfh, &cs4231, sizeof(cs4231));
	}

	// 復元。 これ移動すること!
	adpcm_update(&g_adpcm);
	pcm86gen_update();
	if (saveflg & FLAG_PCM86) {
		fmboard_extenable((REG8)(pcm86.extfunc & 1));
	}
	if (saveflg & FLAG_CS4231) {
		fmboard_extenable((REG8)(cs4231.extfunc & 1));
	}
	(void)t;
	return(ret);
}
示例#4
0
static void changeSoundOpt(void) {
    SINT32	val;
	UInt8	update;
	int		renewal;
    short	i,j;
    
    renewal = 0;
    for (j=0;j<5;j++) {
        val = getControlValue('vMix', j);
        if (val != *cfg[j]) {
            *cfg[j] = val;
            renewal = 1;
        }
    }
    if (renewal) {
        sysmng_update(SYS_UPDATECFG);
    }
    opngen_setvol(np2cfg.vol_fm);
    psggen_setvol(np2cfg.vol_ssg);
    rhythm_setvol(np2cfg.vol_rhythm);
    rhythm_update(&g_rhythm);
    adpcm_setvol(np2cfg.vol_adpcm);
    adpcm_update(&g_adpcm);
    pcm86gen_setvol(np2cfg.vol_pcm);
    pcm86gen_update();

    renewal = 0;
    for (i=0;i<6;i++) {
        val = getControlValue('vMix',i+10);
        if (val != np2cfg.vol14[i]) {
            np2cfg.vol14[i] = val;
            renewal = 1;
        }
    }
    if (renewal) {
        sysmng_update(SYS_UPDATECFG);
        tms3631_setvol(np2cfg.vol14);
    }

    if (np2cfg.snd26opt != snd26) {
        np2cfg.snd26opt = snd26;
        sysmng_update(SYS_UPDATECFG);
    }
    if (np2cfg.snd86opt != snd86) {
        np2cfg.snd86opt = snd86;
        sysmng_update(SYS_UPDATECFG);
    }

    update = 0;
    if (np2cfg.spbopt != spb) {
        np2cfg.spbopt = spb;
        update |= SYS_UPDATECFG;
    }
    if (np2cfg.spb_vrc != spbvrc) {
        np2cfg.spb_vrc = spbvrc;
        update |= SYS_UPDATECFG;
    }
    val = getControlValue('splv', 0);
    if (np2cfg.spb_vrl != val) {
        np2cfg.spb_vrl = val;
        update |= SYS_UPDATECFG;
    }
    opngen_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl);
    val = getControlValue('sprv', 0);
    if (np2cfg.spb_x != val) {
        np2cfg.spb_x = val;
        update |= SYS_UPDATECFG;
    }
    sysmng_update(update);
    changeJoyPadSetup();                
}
示例#5
0
void pcm86gen_setvol(UINT vol) {

	pcm86cfg.vol = vol;
	pcm86gen_update();
}