亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? es5506.c

?? 十七種模擬器源代碼 非常有用的作課程設計不可缺少的
?? C
?? 第 1 頁 / 共 4 頁
字號:
alldone:	voice->accum = accum;	if (samples > 0)		update_envelopes(voice, samples);}/**********************************************************************************************     generate_ulaw -- general u-law decoding routine***********************************************************************************************/static void generate_ulaw(struct ES5506Voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples){	UINT32 freqcount = voice->freqcount;	UINT32 accum = voice->accum;	INT32 lvol = volume_lookup[voice->lvol >> 4];	INT32 rvol = volume_lookup[voice->rvol >> 4];	INT32 val1,val2;		/* pre-add the bank offset */	base += voice->exbank;	/* outer loop, in case we switch directions */	while (samples > 0 && !(voice->control & CONTROL_STOPMASK))	{reverse:		/* two cases: first case is forward direction */		if (!(voice->control & CONTROL_DIR))		{			/* loop while we still have samples to generate */			while (samples--)			{				/* fetch two samples */				val1 = base[accum >> 11];				val2 = base[(accum >> 11) + 1];				accum += freqcount;				/* decompress u-law */				val1 = ulaw_lookup[val1 >> (16 - ULAW_MAXBITS)];				val2 = ulaw_lookup[val2 >> (16 - ULAW_MAXBITS)];								/* interpolate */				val1 = interpolate(val1, val2, accum);								/* apply filters */				apply_filters(voice, val1);								/* update filters/volumes */				if (voice->ecount != 0)				{					update_envelopes(voice, 1);					lvol = volume_lookup[voice->lvol >> 4];					rvol = volume_lookup[voice->rvol >> 4];				}								/* apply volumes and add */				*lbuffer++ += (val1 * lvol) >> 11;				*rbuffer++ += (val1 * rvol) >> 11;								/* check for loop end */				check_for_end_forward(voice, accum);			}		}		/* two cases: second case is backward direction */		else		{			/* loop while we still have samples to generate */			while (samples--)			{				/* fetch two samples */				INT32 val1 = base[accum >> 11];				INT32 val2 = base[(accum >> 11) + 1];				accum -= freqcount;								/* decompress u-law */				val1 = ulaw_lookup[val1 >> (16 - ULAW_MAXBITS)];				val2 = ulaw_lookup[val2 >> (16 - ULAW_MAXBITS)];				/* interpolate */				val1 = interpolate(val1, val2, accum);								/* apply filters */				apply_filters(voice, val1);								/* update filters/volumes */				if (voice->ecount != 0)				{					update_envelopes(voice, 1);					lvol = volume_lookup[voice->lvol >> 4];					rvol = volume_lookup[voice->rvol >> 4];				}								/* apply volumes and add */				*lbuffer++ += (val1 * lvol) >> 11;				*rbuffer++ += (val1 * rvol) >> 11;								/* check for loop end */				check_for_end_reverse(voice, accum);			}		}	}	/* if we stopped, process any additional envelope */alldone:	voice->accum = accum;	if (samples > 0)		update_envelopes(voice, samples);}/**********************************************************************************************     generate_pcm -- general PCM decoding routine***********************************************************************************************/static void generate_pcm(struct ES5506Voice *voice, UINT16 *base, INT32 *lbuffer, INT32 *rbuffer, int samples){	UINT32 freqcount = voice->freqcount;	UINT32 accum = voice->accum;	INT32 lvol = volume_lookup[voice->lvol >> 4];	INT32 rvol = volume_lookup[voice->rvol >> 4];	INT32 val1,val2;		/* pre-add the bank offset */	base += voice->exbank;	//fprintf(stderr,"generate_pcm %x status %x\n",voice,voice->control);	/* outer loop, in case we switch directions */	while (samples > 0 && !(voice->control & CONTROL_STOPMASK))	{reverse:		/* two cases: first case is forward direction */		if (!(voice->control & CONTROL_DIR))		{			/* loop while we still have samples to generate */			while (samples--)			{				/* fetch two samples */			  accum &= 0x7fffffff; // Grrr....				val1 = (INT16)base[accum >> 11];				val2 = (INT16)base[(accum >> 11) + 1];				accum += freqcount;				/* interpolate */				val1 = interpolate(val1, val2, accum);								/* apply filters */				apply_filters(voice, val1);								/* update filters/volumes */				if (voice->ecount != 0)				{					update_envelopes(voice, 1);					lvol = volume_lookup[voice->lvol >> 4];					rvol = volume_lookup[voice->rvol >> 4];				}								/* apply volumes and add */				*lbuffer++ += (val1 * lvol) >> 11;				*rbuffer++ += (val1 * rvol) >> 11;								/* check for loop end */				//oldac = accum;				check_for_end_forward(voice, accum);			}		}		/* two cases: second case is backward direction */		else		{			/* loop while we still have samples to generate */			while (samples--)			{				/* fetch two samples */			  accum &= 0x7fffffff; // Grrr....			        val1 = (INT16)base[accum >> 11];			        val2 = (INT16)base[(accum >> 11) + 1];				accum -= freqcount;								/* interpolate */				val1 = interpolate(val1, val2, accum);								/* apply filters */				apply_filters(voice, val1);								/* update filters/volumes */				if (voice->ecount != 0)				{					update_envelopes(voice, 1);					lvol = volume_lookup[voice->lvol >> 4];					rvol = volume_lookup[voice->rvol >> 4];				}								/* apply volumes and add */				*lbuffer++ += (val1 * lvol) >> 11;				*rbuffer++ += (val1 * rvol) >> 11;								/* check for loop end */				//oldac = accum;				check_for_end_reverse(voice, accum);			} // while samples--		} // else	} // while samples > 0 ...	/* if we stopped, process any additional envelope */alldone:	voice->accum = accum;	if (samples > 0)		update_envelopes(voice, samples);}/**********************************************************************************************     es5506_update -- update the sound chip so that it is in sync with CPU execution***********************************************************************************************/static void es5506_update(int num, INT16 **buffer, int length){	struct ES5506Chip *chip = &es5506[num];	INT32 lprev = chip->last_lsample;	INT32 rprev = chip->last_rsample;	INT32 lcurr = chip->curr_lsample;	INT32 rcurr = chip->curr_rsample;	INT16 *ldest = buffer[0];	INT16 *rdest = buffer[1];	INT32 *lsrc, *rsrc;	INT32 interp;	UINT32 new_samples, samples_left;	UINT32 final_pos;	int remaining = length;	int v;	/* finish off the current sample */	if (chip->output_pos > 0)	{		/* interpolate */		while (remaining > 0 && chip->output_pos < FRAC_ONE)		{			/* left channel */			interp = backend_interpolate(lprev, lcurr, chip->output_pos);			*ldest++ = (interp < -32768) ? -32768 : (interp > 32767) ? 32767 : interp;						/* right channel */			interp = backend_interpolate(rprev, rcurr, chip->output_pos);			*rdest++ = (interp < -32768) ? -32768 : (interp > 32767) ? 32767 : interp;						/* advance */			chip->output_pos += chip->output_step;			remaining--;		}		/* if we're over, continue; otherwise, we're done */		if (chip->output_pos >= FRAC_ONE)			chip->output_pos -= FRAC_ONE;	}	/* compute how many new samples we need */	final_pos = chip->output_pos + remaining * chip->output_step;	new_samples = (final_pos + FRAC_ONE - 1) >> FRAC_BITS;	if (new_samples > MAX_SAMPLE_CHUNK)		new_samples = MAX_SAMPLE_CHUNK;	samples_left = new_samples;	/* determine left/right source data */	lsrc = scratch;	rsrc = scratch + new_samples;	/* generate them into our buffer */	if (new_samples)	{		/* clear out the accumulator */		memset(scratch, 0, new_samples * 2 * sizeof(scratch[0]));		/* loop over voices */		for (v = 0; v <= chip->active_voices; v++)		{			struct ES5506Voice *voice = &chip->voice[v];			UINT16 *base = chip->region_base[voice->control >> 14];			if (!base)				generate_dummy(voice, base, lsrc, rsrc, new_samples);			else if (voice->control & 0x2000)				generate_ulaw(voice, base, lsrc, rsrc, new_samples);			else if (!(voice->control & CONTROL_STOPMASK))				generate_pcm(voice, base, lsrc, rsrc, new_samples);		}	}	/* advance forward one sample */	lprev = lcurr;	rprev = rcurr;	lcurr = *lsrc++ >> 4;	rcurr = *rsrc++ >> 4;	/* then sample-rate convert with linear interpolation */	while (remaining > 0)	{		/* interpolate */		while (remaining > 0 && chip->output_pos < FRAC_ONE)		{			/* left channel */			interp = backend_interpolate(lprev, lcurr, chip->output_pos);			*ldest++ = (interp < -32768) ? -32768 : (interp > 32767) ? 32767 : interp;			/* right channel */			interp = backend_interpolate(rprev, rcurr, chip->output_pos);			*rdest++ = (interp < -32768) ? -32768 : (interp > 32767) ? 32767 : interp;			/* advance */			chip->output_pos += chip->output_step;			remaining--;		}		/* if we're over, grab the next samples */		if (chip->output_pos >= FRAC_ONE)		{			chip->output_pos -= FRAC_ONE;			lprev = lcurr;			rprev = rcurr;			lcurr = *lsrc++ >> 4;			rcurr = *rsrc++ >> 4;		}	}	/* remember the last samples */	chip->last_lsample = lprev;	chip->last_rsample = rprev;	chip->curr_lsample = lcurr;	chip->curr_rsample = rcurr;}/**********************************************************************************************     ES5506_sh_start -- start emulation of the ES5506***********************************************************************************************/void* memory_region(int num) {  return NULL; // while we don't finish our regions, it will have to be done by hand...}int ES5506_sh_start(const struct ES5506interface *intf){	char stream_name[2][40];	const char *stream_name_ptrs[2];	int vol[2];	int i, j;		/* debugging */	if (LOG_COMMANDS && !eslog)		eslog = fopen("es.log", "w");		/* compute the tables */	if (!compute_tables())		return 1;	/* initialize the voices */	memset(&es5506, 0, sizeof(es5506));	for (i = 0; i < intf->num; i++)	{		/* generate the name and create the stream */		sprintf(stream_name[0], "%s #%d Ch1", "ES5506", i);		sprintf(stream_name[1], "%s #%d Ch2", "ES5506", i);		stream_name_ptrs[0] = stream_name[0];		stream_name_ptrs[1] = stream_name[1];		/* set the volumes */		vol[0] = intf->mixing_level[i] & 0xffff;		vol[1] = intf->mixing_level[i] >> 16;		/* create the stream */		es5506[i].stream = stream_init_multim(2, stream_name_ptrs, vol, audio_sample_rate, i, es5506_update);		if (es5506[i].stream == -1)			return 1;		/* initialize the regions */		es5506[i].region_base[0] = ((UINT16*)PCMROM); //intf->region0[i] ? (UINT16 *)memory_region(intf->region0[i]) : NULL;		es5506[i].region_base[1] = ((UINT16*)PCMROM); //intf->region1[i] ? (UINT16 *)memory_region(intf->region1[i]) : NULL;		es5506[i].region_base[2] = ((UINT16*)PCMROM); //intf->region2[i] ? (UINT16 *)memory_region(intf->region2[i]) : NULL;		es5506[i].region_base[3] = ((UINT16*)PCMROM); //intf->region3[i] ? (UINT16 *)memory_region(intf->region3[i]) : NULL;		/* initialize the rest of the structure */		es5506[i].master_clock = (double)intf->baseclock[i];		es5506[i].irq_callback = intf->irq_callback[i];				/* init the voices */		for (j = 0; j < 32; j++)		{			es5506[i].voice[j].index = j;			es5506[i].voice[j].control = CONTROL_STOPMASK;			es5506[i].voice[j].lvol = 0xffff;			es5506[i].voice[j].rvol = 0xffff;			es5506[i].voice[j].exbank = 0;		}	}	/* allocate memory */	accumulator = malloc(sizeof(accumulator[0]) * 2 * MAX_SAMPLE_CHUNK);	scratch = malloc(sizeof(scratch[0]) * 2 * MAX_SAMPLE_CHUNK);	if (!accumulator || !scratch)		return 1;	/* success */	return 0;}/**********************************************************************************************     ES5506_sh_stop -- stop emulation of the ES5506***********************************************************************************************/void ES5506_sh_stop(void){	/* free memory */	if (accumulator)		free(accumulator);	accumulator = NULL;	if (scratch)		free(scratch);	scratch = NULL;		/* debugging */	if (LOG_COMMANDS && eslog)	{		fclose(eslog);		eslog = NULL;	}}/**********************************************************************************************     es5506_reg_write -- handle a write to the selected ES5506 register***********************************************************************************************/INLINE void es5506_reg_write_low(struct ES5506Chip *chip, struct ES5506Voice *voice, offs_t offset, UINT32 data){		  //fprintf(stderr,"ess_reg_write_low %x %d\n",offset,data);  switch (offset)	{		case 0x00/8:	/* CR */		  //if (!(voice->control & CONTROL_IRQ)){		    voice->control = data & 0xffff;		    update_irq_state(chip);		    //}		  break;					case 0x08/8:	/* FC */			voice->freqcount = data & 0x1ffff;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, freq count=%08x\n", chip->current_page & 0x1f, voice->freqcount);			break;			case 0x10/8:	/* LVOL */			voice->lvol = data & 0xffff;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, left vol=%04x\n", chip->current_page & 0x1f, voice->lvol);			break;			case 0x18/8:	/* LVRAMP */			voice->lvramp = (data & 0xff00) >> 8;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, left vol ramp=%04x\n", chip->current_page & 0x1f, voice->lvramp);			break;			case 0x20/8:	/* RVOL */			voice->rvol = data & 0xffff;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, right vol=%04x\n", chip->current_page & 0x1f, voice->rvol);			break;			case 0x28/8:	/* RVRAMP */			voice->rvramp = (data & 0xff00) >> 8;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, right vol ramp=%04x\n", chip->current_page & 0x1f, voice->rvramp);			break;			case 0x30/8:	/* ECOUNT */			voice->ecount = data & 0x1ff;			voice->filtcount = 0;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, envelope count=%04x\n", chip->current_page & 0x1f, voice->ecount);			break;			case 0x38/8:	/* K2 */			voice->k2 = data & 0xffff;			if (LOG_COMMANDS && eslog)				fprintf(eslog, "voice %d, K2=%04x\n", chip->current_page & 0x1f, voice->k2);			break;			case 0x40/8:	/* K2RAMP */			voice->k2ramp = ((data & 0xff00) >> 8) | ((data & 0x0001) << 31);			if (LOG_COMMANDS && eslog)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国模一区二区三区白浆| 972aa.com艺术欧美| 国产精品一卡二卡在线观看| 成人精品免费视频| 欧美三级午夜理伦三级中视频| 这里只有精品免费| 久久久一区二区三区| 一区二区三区色| 蜜臀精品久久久久久蜜臀| 不卡视频一二三四| 欧美精品在线观看一区二区| 国产色产综合产在线视频| 亚洲激情五月婷婷| 韩国成人在线视频| 欧美中文字幕一二三区视频| 精品电影一区二区| 一区二区三区高清在线| 精品一区二区影视| 91久久精品国产91性色tv| 欧美成va人片在线观看| 亚洲欧美aⅴ...| 久久91精品国产91久久小草| 色综合久久久久久久久久久| 精品国产免费人成电影在线观看四季| 亚洲日本在线天堂| 精品一区二区精品| 精品视频在线免费观看| 中文字幕精品在线不卡| 另类调教123区| 欧美偷拍一区二区| 国产精品护士白丝一区av| 日本三级韩国三级欧美三级| 99re视频精品| 久久午夜电影网| 午夜久久久久久久久| 91亚洲精品一区二区乱码| 久久综合九色综合久久久精品综合| 亚洲高清免费观看高清完整版在线观看 | 亚洲国产精品久久久男人的天堂| 国产一区二区三区高清播放| 正在播放亚洲一区| 亚洲一本大道在线| 91免费版在线| 国产精品免费网站在线观看| 九九**精品视频免费播放| 欧美日韩国产不卡| 亚洲乱码精品一二三四区日韩在线| 国产精品一区不卡| www一区二区| 另类小说综合欧美亚洲| 69p69国产精品| 亚洲成人动漫一区| 国产精品污污网站在线观看 | www激情久久| 日韩电影在线观看网站| 欧美伊人久久久久久久久影院| 中文字幕va一区二区三区| 国产成人精品www牛牛影视| 精品成人私密视频| 久久av资源网| 精品区一区二区| 看电视剧不卡顿的网站| 日韩三级高清在线| 男人的天堂亚洲一区| 91精品国产91久久久久久一区二区| 亚洲成在人线在线播放| 欧日韩精品视频| 亚洲综合色噜噜狠狠| 欧美综合亚洲图片综合区| 亚洲一线二线三线久久久| 色婷婷激情综合| 亚洲一区二区四区蜜桃| 欧美一a一片一级一片| 亚洲高清久久久| 欧美日韩精品电影| 亚洲国产成人av| 欧美浪妇xxxx高跟鞋交| 日本中文一区二区三区| 日韩三区在线观看| 极品销魂美女一区二区三区| 精品sm捆绑视频| 国产乱淫av一区二区三区| 国产婷婷一区二区| 国产99久久久国产精品潘金网站| 国产精品久久久久婷婷二区次| 成人动漫av在线| 一区二区视频在线| 亚洲自拍欧美精品| 欧美日韩国产免费| 男女男精品网站| 久久久综合激的五月天| 本田岬高潮一区二区三区| 自拍偷在线精品自拍偷无码专区| 91丨九色porny丨蝌蚪| 亚洲资源中文字幕| 91精品国产91久久综合桃花 | 亚洲国产成人一区二区三区| 91在线观看美女| 亚洲成人激情av| 26uuu欧美| 99国产精品久久久久久久久久久| 一区二区三区在线观看国产 | 狠狠色丁香久久婷婷综| 国产精品婷婷午夜在线观看| 在线观看欧美黄色| 久久草av在线| 国产精品福利电影一区二区三区四区| 91视频国产资源| 青青草一区二区三区| 欧美国产欧美综合| 欧美色倩网站大全免费| 精品一区二区免费在线观看| 国产精品盗摄一区二区三区| 欧美男生操女生| 粉嫩嫩av羞羞动漫久久久| 一区二区三区中文字幕电影| 精品免费视频一区二区| 成人欧美一区二区三区1314| 欧美探花视频资源| 精品亚洲国内自在自线福利| 亚洲色图在线视频| 精品国产网站在线观看| 91视频xxxx| 精品一区二区免费在线观看| 亚洲精品免费在线播放| 日韩精品一区二区三区三区免费| 99精品欧美一区二区三区小说| 日本不卡的三区四区五区| 亚洲欧洲成人精品av97| 日韩一卡二卡三卡国产欧美| 波多野结衣视频一区| 青青草成人在线观看| 亚洲免费观看高清在线观看| xfplay精品久久| 欧美精品久久99| 色综合久久88色综合天天| 国产乱国产乱300精品| 天天综合天天做天天综合| 国产精品视频一区二区三区不卡| 欧美一区二区三区四区视频| 91在线观看免费视频| 国产精品中文字幕一区二区三区| 亚洲午夜av在线| 中文字幕五月欧美| 久久久美女毛片| 91精品国产91久久久久久最新毛片 | 欧美精品一区二区三区蜜桃| 欧美三级在线视频| 91在线观看污| 岛国一区二区三区| 韩国av一区二区三区四区| 天堂在线一区二区| 亚洲免费av观看| 欧美激情艳妇裸体舞| 久久影院午夜片一区| 91精品国产综合久久国产大片| 在线这里只有精品| 不卡欧美aaaaa| 粉嫩av一区二区三区| 激情图片小说一区| 蜜臀a∨国产成人精品| 视频一区视频二区中文| 一区二区三区成人| 亚洲伦理在线免费看| 国产精品午夜在线| 国产偷国产偷亚洲高清人白洁| 精品少妇一区二区三区视频免付费 | 亚洲素人一区二区| 国产欧美久久久精品影院| 精品国精品国产| 欧美tk丨vk视频| 欧美成va人片在线观看| 日韩欧美激情四射| 日韩视频中午一区| 日韩一区二区精品在线观看| 日韩一卡二卡三卡四卡| 日韩一区二区麻豆国产| 91精品国产欧美一区二区成人| 69堂亚洲精品首页| 91精品国产综合久久久久久漫画| 欧美日韩精品免费观看视频| 欧美精品色综合| 欧美精品少妇一区二区三区| 欧美一区二区在线免费观看| 欧美一区二区在线免费观看| 日韩久久精品一区| 精品精品欲导航| 国产亚洲一二三区| 日本一区二区三级电影在线观看| 中文字幕欧美激情| 亚洲男女毛片无遮挡| 一区二区三区四区中文字幕| 亚洲线精品一区二区三区| 午夜精品久久久久久久| 日本视频免费一区| 国产激情91久久精品导航 | 亚洲免费色视频| 亚洲成av人影院在线观看网| 偷窥国产亚洲免费视频| 久久国产麻豆精品|