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

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

?? gus_wave.c

?? <Linux1.0核心游記>電子書+書后源碼+Linux1.0源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*  * sound/gus_wave.c *  * Driver for the Gravis UltraSound wave table synth. *  * Copyright by Hannu Savolainen 1993 *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. 2. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. *  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  */#include "sound_config.h"#include <linux/ultrasound.h>#include "gus_hw.h"#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_GUS)#define MAX_SAMPLE	128#define MAX_PATCH	256struct voice_info  {    unsigned long   orig_freq;    unsigned long   current_freq;    unsigned long   mode;    int             bender;    int             bender_range;    int             panning;    int             midi_volume;    unsigned int    initial_volume;    unsigned int    current_volume;    int             loop_irq_mode, loop_irq_parm;#define LMODE_FINISH		1#define LMODE_PCM		2#define LMODE_PCM_STOP		3    int             volume_irq_mode, volume_irq_parm;#define VMODE_HALT		1#define VMODE_ENVELOPE		2#define VMODE_START_NOTE	3    int             env_phase;    unsigned char   env_rate[6];    unsigned char   env_offset[6];    /*      * Volume computation parameters for gus_adagio_vol()     */    int             main_vol, expression_vol, patch_vol;    /* Variables for "Ultraclick" removal */    int             dev_pending, note_pending, volume_pending, sample_pending;    char            kill_pending;    long            offset_pending;  };extern int      gus_base;extern int      gus_irq, gus_dma;extern char    *snd_raw_buf[MAX_DSP_DEV][DSP_BUFFCOUNT];extern unsigned long snd_raw_buf_phys[MAX_DSP_DEV][DSP_BUFFCOUNT];extern int      snd_raw_count[MAX_DSP_DEV];static long     gus_mem_size = 0;static long     free_mem_ptr = 0;static int      gus_busy = 0;static int      nr_voices = 0;static int      gus_devnum = 0;static int      volume_base, volume_scale, volume_method;static int	gus_line_vol = 100, gus_mic_vol = 0;static int	gus_recmask = SOUND_MASK_MIC;static int	recording_active = 0;#define VOL_METHOD_ADAGIO	1int             gus_wave_volume = 60;int             gus_pcm_volume = 80;static unsigned char mix_image = 0x00;/*  * Current version of this driver doesn't allow synth and PCM functions * at the same time. The active_device specifies the active driver */static int      active_device = 0;#define GUS_DEV_WAVE		1	/* 					 * * * Wave table synth   */#define GUS_DEV_PCM_DONE	2	/* 					 * * * PCM device, transfer done   */#define GUS_DEV_PCM_CONTINUE	3	/* 					 * * * PCM device, transfer the					 * second * * * chn   */static int      gus_sampling_speed;static int      gus_sampling_channels;static int      gus_sampling_bits;DEFINE_WAIT_QUEUE (dram_sleeper, dram_sleep_flag);/*  * Variables and buffers for PCM output */#define MAX_PCM_BUFFERS		(32*MAX_REALTIME_FACTOR)	/* 								 * * * Don't								 * * * change 								 * 								 */static int      pcm_bsize,	/* 				 * Current blocksize 				 */                pcm_nblk,	/* 				 * Current # of blocks 				 */                pcm_banksize;	/* 				 * 				 * *  * * # bytes allocated for channels   */static int      pcm_datasize[MAX_PCM_BUFFERS];	/* 						 * 						 * *  * * Actual # of bytes						 * in blk  *  */static volatile int pcm_head, pcm_tail, pcm_qlen;	/* 							 * 							 * *  * * DRAM queue							 *  */static volatile int pcm_active;static int      pcm_opened = 0;static int      pcm_current_dev;static int      pcm_current_block;static unsigned long pcm_current_buf;static int      pcm_current_count;static int      pcm_current_intrflag;struct voice_info voices[32];static int      freq_div_table[] ={  44100,			/* 				 * 14 				 */  41160,			/* 				 * 15 				 */  38587,			/* 				 * 16 				 */  36317,			/* 				 * 17 				 */  34300,			/* 				 * 18 				 */  32494,			/* 				 * 19 				 */  30870,			/* 				 * 20 				 */  29400,			/* 				 * 21 				 */  28063,			/* 				 * 22 				 */  26843,			/* 				 * 23 				 */  25725,			/* 				 * 24 				 */  24696,			/* 				 * 25 				 */  23746,			/* 				 * 26 				 */  22866,			/* 				 * 27 				 */  22050,			/* 				 * 28 				 */  21289,			/* 				 * 29 				 */  20580,			/* 				 * 30 				 */  19916,			/* 				 * 31 				 */  19293				/* 				 * 32 				 */};static struct patch_info *samples;static long     sample_ptrs[MAX_SAMPLE + 1];static int      sample_map[32];static int      free_sample;static int      patch_table[MAX_PATCH];static int      patch_map[32];static struct synth_info gus_info ={"Gravis UltraSound", 0, SYNTH_TYPE_SAMPLE, SAMPLE_TYPE_GUS, 0, 16, 0, MAX_PATCH};static void     gus_poke (long addr, unsigned char data);static void     compute_and_set_volume (int voice, int volume, int ramp_time);extern unsigned short gus_adagio_vol (int vel, int mainv, int xpn, int voicev);static void     compute_volume (int voice, int volume);static void     do_volume_irq (int voice);static void	set_input_volumes(void);#define	INSTANT_RAMP		-1	/* 					 * * * Dont use ramping   */#define FAST_RAMP		0	/* 					 * * * Fastest possible ramp   */static voidreset_sample_memory (void){  int             i;  for (i = 0; i <= MAX_SAMPLE; i++)    sample_ptrs[i] = -1;  for (i = 0; i < 32; i++)    sample_map[i] = -1;  for (i = 0; i < 32; i++)    patch_map[i] = -1;  gus_poke (0, 0);		/* 				 * Put silence here 				 */  gus_poke (1, 0);  free_mem_ptr = 2;  free_sample = 0;  for (i = 0; i < MAX_PATCH; i++)    patch_table[i] = -1;}voidgus_delay (void){  int             i;  for (i = 0; i < 7; i++)    INB (u_DRAMIO);}static voidgus_poke (long addr, unsigned char data){  unsigned long   flags;  DISABLE_INTR (flags);  OUTB (0x43, u_Command);  OUTB (addr & 0xff, u_DataLo);  OUTB ((addr >> 8) & 0xff, u_DataHi);  OUTB (0x44, u_Command);  OUTB ((addr >> 16) & 0xff, u_DataHi);  OUTB (data, u_DRAMIO);  RESTORE_INTR (flags);}static unsigned chargus_peek (long addr){  unsigned long   flags;  unsigned char   tmp;  DISABLE_INTR (flags);  OUTB (0x43, u_Command);  OUTB (addr & 0xff, u_DataLo);  OUTB ((addr >> 8) & 0xff, u_DataHi);  OUTB (0x44, u_Command);  OUTB ((addr >> 16) & 0xff, u_DataHi);  tmp = INB (u_DRAMIO);  RESTORE_INTR (flags);  return tmp;}voidgus_write8 (int reg, unsigned int data){  unsigned long   flags;  DISABLE_INTR (flags);  OUTB (reg, u_Command);  OUTB ((unsigned char) (data & 0xff), u_DataHi);  RESTORE_INTR (flags);}unsigned chargus_read8 (int reg){  unsigned long   flags;  unsigned char   val;  DISABLE_INTR (flags);  OUTB (reg | 0x80, u_Command);  val = INB (u_DataHi);  RESTORE_INTR (flags);  return val;}unsigned chargus_look8 (int reg){  unsigned long   flags;  unsigned char   val;  DISABLE_INTR (flags);  OUTB (reg, u_Command);  val = INB (u_DataHi);  RESTORE_INTR (flags);  return val;}voidgus_write16 (int reg, unsigned int data){  unsigned long   flags;  DISABLE_INTR (flags);  OUTB (reg, u_Command);  OUTB ((unsigned char) (data & 0xff), u_DataLo);  OUTB ((unsigned char) ((data >> 8) & 0xff), u_DataHi);  RESTORE_INTR (flags);}unsigned shortgus_read16 (int reg){  unsigned long   flags;  unsigned char   hi, lo;  DISABLE_INTR (flags);  OUTB (reg | 0x80, u_Command);  lo = INB (u_DataLo);  hi = INB (u_DataHi);  RESTORE_INTR (flags);  return ((hi << 8) & 0xff00) | lo;}voidgus_write_addr (int reg, unsigned long address, int is16bit){  unsigned long   hold_address;  if (is16bit)    {      /*        * Special processing required for 16 bit patches       */      hold_address = address;      address = address >> 1;      address &= 0x0001ffffL;      address |= (hold_address & 0x000c0000L);    }  gus_write16 (reg, (unsigned short) ((address >> 7) & 0xffff));  gus_write16 (reg + 1, (unsigned short) ((address << 9) & 0xffff));}static voidgus_select_voice (int voice){  if (voice < 0 || voice > 31)    return;  OUTB (voice, u_Voice);}static voidgus_select_max_voices (int nvoices){  if (nvoices < 14)    nvoices = 14;  if (nvoices > 32)    nvoices = 32;  nr_voices = nvoices;  gus_write8 (0x0e, (nvoices - 1) | 0xc0);}static voidgus_voice_on (unsigned int mode){  gus_write8 (0x00, (unsigned char) (mode & 0xfc));  gus_delay ();  gus_write8 (0x00, (unsigned char) (mode & 0xfc));}static voidgus_voice_off (void){  gus_write8 (0x00, gus_read8 (0x00) | 0x03);}static voidgus_voice_mode (unsigned int m){  unsigned char   mode = (unsigned char) (m & 0xff);  gus_write8 (0x00, (gus_read8 (0x00) & 0x03) | (mode & 0xfc));		/* 									 * Don't 									 * start 									 * or 									 * stop									 * *									 * voice 									 */  gus_delay ();  gus_write8 (0x00, (gus_read8 (0x00) & 0x03) | (mode & 0xfc));}static voidgus_voice_freq (unsigned long freq){  unsigned long   divisor = freq_div_table[nr_voices - 14];  unsigned short  fc;  fc = (unsigned short) (((freq << 9) + (divisor >> 1)) / divisor);  fc = fc << 1;  gus_write16 (0x01, fc);}static voidgus_voice_volume (unsigned int vol){  gus_write8 (0x0d, 0x03);	/* 				 * Stop ramp before setting volume 				 */  gus_write16 (0x09, (unsigned short) (vol << 4));}static voidgus_voice_balance (unsigned int balance){  gus_write8 (0x0c, (unsigned char) (balance & 0xff));}static voidgus_ramp_range (unsigned int low, unsigned int high){  gus_write8 (0x07, (unsigned char) ((low >> 4) & 0xff));  gus_write8 (0x08, (unsigned char) ((high >> 4) & 0xff));}static voidgus_ramp_rate (unsigned int scale, unsigned int rate){  gus_write8 (0x06, (unsigned char) (((scale & 0x03) << 6) | (rate & 0x3f)));}static voidgus_rampon (unsigned int m){  unsigned char   mode = (unsigned char) (m & 0xff);  gus_write8 (0x0d, mode & 0xfc);  gus_delay ();  gus_write8 (0x0d, mode & 0xfc);}static voidgus_ramp_mode (unsigned int m){  unsigned char   mode = (unsigned char) (m & 0xff);  gus_write8 (0x0d, (gus_read8 (0x0d) & 0x03) | (mode & 0xfc));		/* 									 * Don't 									 * start 									 * or 									 * stop									 * *									 * ramping 									 */  gus_delay ();  gus_write8 (0x0d, (gus_read8 (0x0d) & 0x03) | (mode & 0xfc));}static voidgus_rampoff (void){  gus_write8 (0x0d, 0x03);}static voidgus_set_voice_pos (int voice, long position){  int             sample_no;  if ((sample_no = sample_map[voice]) != -1)    if (position < samples[sample_no].len)      if (voices[voice].volume_irq_mode == VMODE_START_NOTE)	voices[voice].offset_pending = position;      else	gus_write_addr (0x0a, sample_ptrs[sample_no] + position,			samples[sample_no].mode & WAVE_16_BITS);}static voidgus_voice_init (int voice){  unsigned long   flags;  DISABLE_INTR (flags);  gus_select_voice (voice);  gus_voice_volume (0);  gus_write_addr (0x0a, 0, 0);	/* 				 * Set current position to 0 				 */  gus_write8 (0x00, 0x03);	/* 				 * Voice off 				 */  gus_write8 (0x0d, 0x03);	/* 				 * Ramping off 				 */  RESTORE_INTR (flags);}static voidgus_voice_init2 (int voice){  voices[voice].panning = 0;  voices[voice].mode = 0;  voices[voice].orig_freq = 20000;  voices[voice].current_freq = 20000;  voices[voice].bender = 0;  voices[voice].bender_range = 200;  voices[voice].initial_volume = 0;  voices[voice].current_volume = 0;  voices[voice].loop_irq_mode = 0;  voices[voice].loop_irq_parm = 0;  voices[voice].volume_irq_mode = 0;  voices[voice].volume_irq_parm = 0;  voices[voice].env_phase = 0;  voices[voice].main_vol = 127;  voices[voice].patch_vol = 127;  voices[voice].expression_vol = 127;  voices[voice].sample_pending = -1;}static voidstep_envelope (int voice){  unsigned        vol, prev_vol, phase;  unsigned char   rate;  if (voices[voice].mode & WAVE_SUSTAIN_ON && voices[voice].env_phase == 2)    {      gus_rampoff ();      return;			/* 				 * Sustain 				 */    }  if (voices[voice].env_phase >= 5)    {      /*        * Shoot the voice off       */      gus_voice_init (voice);      return;    }  prev_vol = voices[voice].current_volume;  gus_voice_volume (prev_vol);  phase = ++voices[voice].env_phase;  compute_volume (voice, voices[voice].midi_volume);  vol = voices[voice].initial_volume * voices[voice].env_offset[phase] / 255;  rate = voices[voice].env_rate[phase];  gus_write8 (0x06, rate);	/* 				 * Ramping rate 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩视频一区二区在线观看| 一区二区三区在线播放| 中文字幕免费在线观看视频一区| 亚洲男人电影天堂| 国内外精品视频| 在线观看免费一区| 国产网站一区二区| 日韩高清国产一区在线| 99r精品视频| 久久精品一区二区| 视频一区视频二区中文| 一本久道久久综合中文字幕| 国产亚洲综合av| 老司机午夜精品| 欧美日韩视频一区二区| 亚洲丝袜自拍清纯另类| 国产成人亚洲综合a∨婷婷| 欧美精品久久天天躁| 一区二区三区精品在线| 成人福利视频在线看| 久久女同互慰一区二区三区| 日韩影院免费视频| 欧美日韩在线播| 亚洲精品欧美激情| 色欧美日韩亚洲| 一色桃子久久精品亚洲| 成人久久久精品乱码一区二区三区 | 欧美性受极品xxxx喷水| 国产精品乱码一区二三区小蝌蚪| 国产一区二三区| 精品国产伦一区二区三区免费| 日韩电影在线观看电影| 欧美日韩不卡一区| 亚洲bt欧美bt精品777| 欧美三级一区二区| 午夜激情久久久| 91麻豆精品国产91久久久| 丝袜美腿亚洲一区| 欧美一区二区视频在线观看2022| 日韩极品在线观看| 欧美电视剧免费全集观看| 美女脱光内衣内裤视频久久影院| 精品视频全国免费看| 奇米亚洲午夜久久精品| 欧美成人三级在线| 国产电影一区在线| 国产精品超碰97尤物18| 91老司机福利 在线| 综合电影一区二区三区| 欧美午夜不卡在线观看免费| 日本特黄久久久高潮| 精品国内二区三区| 成人动漫一区二区| 一区二区三区在线观看视频| 欧美另类z0zxhd电影| 捆绑调教一区二区三区| 中文字幕欧美国产| 欧美性受xxxx黑人xyx性爽| 美女免费视频一区二区| 国产色产综合产在线视频| 成人91在线观看| 日韩国产精品久久久| 久久精品亚洲麻豆av一区二区 | 91精品国产一区二区| 国内一区二区在线| 亚洲精品伦理在线| 精品人在线二区三区| www.亚洲免费av| 日韩电影一二三区| 国产精品久久毛片av大全日韩| 欧美伊人久久大香线蕉综合69| 久久精品99国产精品| 亚洲情趣在线观看| 精品日韩一区二区三区| 91官网在线免费观看| 精品中文字幕一区二区| 玉足女爽爽91| 国产日韩欧美精品一区| 欧美电影影音先锋| 波波电影院一区二区三区| 日韩精品午夜视频| 国产精品电影一区二区| 欧美zozozo| 欧美视频在线一区二区三区 | 中文字幕中文乱码欧美一区二区| 欧美精选一区二区| 成人99免费视频| 不卡在线视频中文字幕| 久久精品视频免费| 久久 天天综合| 亚洲精品一卡二卡| 中文一区一区三区高中清不卡| 欧美亚洲综合另类| 成人激情午夜影院| 另类小说欧美激情| 中文字幕精品一区二区精品绿巨人| 国产一区二区精品久久| 视频一区二区三区中文字幕| 一区二区三区免费观看| 国产精品三级久久久久三级| 久久午夜色播影院免费高清| 555www色欧美视频| 欧美日本一区二区三区四区| 99国产欧美另类久久久精品| 国产久卡久卡久卡久卡视频精品| 蜜臀久久久99精品久久久久久| 亚洲综合免费观看高清完整版 | 国产成人精品免费一区二区| 免费亚洲电影在线| 欧美一区二区三区视频在线 | 国产一区二区三区在线看麻豆| 亚洲国产视频a| 天天av天天翘天天综合网色鬼国产| 国产精品你懂的在线| 欧美精彩视频一区二区三区| 久久五月婷婷丁香社区| 精品成人佐山爱一区二区| 日韩一区二区三区高清免费看看| 337p亚洲精品色噜噜狠狠| 欧美精品vⅰdeose4hd| 欧美日韩中文字幕精品| 欧美乱熟臀69xxxxxx| 欧美亚洲另类激情小说| 欧美日本免费一区二区三区| 欧美日韩午夜影院| 3atv一区二区三区| 日韩精品中文字幕一区二区三区 | 国产乱子伦一区二区三区国色天香| 男女男精品视频| 久久超碰97人人做人人爱| 国产成人免费xxxxxxxx| 国产精品影视网| 99久久综合色| 在线看国产日韩| 91精品国产入口| 欧美精品一区二区三区视频| 亚洲国产成人自拍| 中文字幕亚洲电影| 日日夜夜免费精品| 九九久久精品视频| 成人av小说网| 欧美视频精品在线观看| 日韩免费成人网| 中文字幕日韩av资源站| 午夜欧美在线一二页| 国产伦精品一区二区三区免费 | 91精品中文字幕一区二区三区| 日韩欧美一区二区不卡| 国产精品天美传媒| 亚洲国产中文字幕| 久久99久久99小草精品免视看| 成人激情图片网| 555夜色666亚洲国产免| 亚洲国产精品成人综合色在线婷婷| 亚洲美女免费视频| 久久99精品国产麻豆不卡| 91欧美一区二区| 日韩欧美国产电影| 亚洲少妇最新在线视频| 久久99久久99精品免视看婷婷| 99久久国产综合精品麻豆| 91精品在线免费观看| 中文字幕一区二区三区在线播放| 日韩av电影免费观看高清完整版在线观看 | 日韩视频不卡中文| 自拍偷拍亚洲综合| 国产在线日韩欧美| 欧美日韩精品一区二区三区蜜桃| 久久久不卡网国产精品一区| 日韩精品一级二级| 在线视频欧美区| 国产精品网友自拍| 国产最新精品免费| 欧美一区二区三区啪啪| 亚洲免费观看高清完整版在线观看 | 亚洲精选视频在线| 成人sese在线| 久久亚洲捆绑美女| 日韩国产精品91| 欧美日韩国产一级二级| 亚洲色图视频网站| 菠萝蜜视频在线观看一区| 久久人人爽人人爽| 久久不见久久见免费视频1| 7777精品伊人久久久大香线蕉的 | 91成人国产精品| 专区另类欧美日韩| 成人精品鲁一区一区二区| 久久久国产综合精品女国产盗摄| 日韩av电影天堂| 欧美一区二区高清| 日韩av电影免费观看高清完整版 | 美国十次了思思久久精品导航| 欧美日韩一区成人| 亚洲午夜日本在线观看| 色av成人天堂桃色av| 亚洲午夜三级在线| 欧美日韩精品二区第二页| 夜夜精品视频一区二区| 91福利在线观看|