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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? alsa090_pcm_seq_howto.txt

?? alsa sound devlopment
?? TXT
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* alsa090_pcm_seq_howto.txt 0.0.4 by Matthias Nagorni */CONTENTS:   --------1. Introduction2. Basic PCM audio3. PCM capture 4. Writing a sequencer client5. A MIDI router6. Combining PCM and MIDI: miniFMsynth7. Scheduling MIDI events: miniArp8. Notes on writing a GUI based audio applicationAcknowledgement---------------The author is grateful to Takashi Iwai for his assistance in writingthis howto.1. Introduction---------------This howto intends to give a brief introduction in writing simple audioapplications with ALSA 0.9.0. Section 2. explains the most basic functionsfor PCM audio. If you remove the explaining text, you end up with a minimalPCM playback program. Section 3. briefly treats some functions for PCMcapture. In section 4. you will learn how to write a simple client for theALSA sequencer. The section is based on the example seqdemo.c, a program,which can receive MIDI events and displays the most important event types.Section 5. demonstrates how the ALSA MIDI sequencer can be used to routeMIDI events from one input port to several output ports. This section isbased on the example midiroute.c. Section 6. combines PCM playback and MIDIinput and explains the mini synthesizer miniFMsynth.c. This sectionintroduces callback-based audio playback, as proposed by Paul Davis on the linux-audio-dev mailinglist. It is recommended to also have a look at the doxygen-generated function reference of the ALSA library.Compiling an ALSA application: Just use -lasound and make sure you have                                included #include <alsa/asoundlib.h>2. Basic PCM audio ------------------To write a simple PCM application for ALSA 0.9.0 we first need a handle forthe PCM device. Then we have to specify the direction of the PCM stream,which can be either playback or capture. We also have to provide someinformation about the configuration we would like to use, like buffer size, sample rate, pcm data format. So, first we declare:    /* Handle for the PCM device */  snd_pcm_t *pcm_handle;           /* Playback stream */  snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;  /* This structure contains information about    */  /* the hardware and can be used to specify the  */        /* configuration to be used for the PCM stream. */   snd_pcm_hw_params_t *hwparams;The most important ALSA interfaces to the PCM devices are the "plughw" and the"hw" interface. If you use the "plughw" interface, you need not care muchabout the sound hardware. If your soundcard does not support the sample rate or sample format you specify, your data will be automatically converted.This also applies to the access type and the number of channels. With the "hw" interface, you have to check whether your hardware supportsthe configuration you would like to use.   /* Name of the PCM device, like plughw:0,0          */  /* The first number is the number of the soundcard, */  /* the second number is the number of the device.   */  char *pcm_name;Then we initialize the variables and allocate a hwparams structure:  /* Init pcm_name. Of course, later you */  /* will make this configurable ;-)     */  pcm_name = strdup("plughw:0,0");    /* Allocate the snd_pcm_hw_params_t structure on the stack. */  snd_pcm_hw_params_alloca(&hwparams);Now we can open the PCM device:  /* Open PCM. The last parameter of this function is the mode. */  /* If this is set to 0, the standard mode is used. Possible   */  /* other values are SND_PCM_NONBLOCK and SND_PCM_ASYNC.       */   /* If SND_PCM_NONBLOCK is used, read / write access to the    */  /* PCM device will return immediately. If SND_PCM_ASYNC is    */  /* specified, SIGIO will be emitted whenever a period has     */  /* been completely processed by the soundcard.                */  if (snd_pcm_open(&pcm_handle, pcm_name, stream, 0) < 0) {    fprintf(stderr, "Error opening PCM device %s\n", pcm_name);    return(-1);  }Before we can write PCM data to the soundcard, we have to specify accesstype, sample format, sample rate, number of channels, number of periods and period size. First, we initialize the hwparams structure with the full configuration space of the soundcard.   /* Init hwparams with full configuration space */  if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0) {    fprintf(stderr, "Can not configure this PCM device.\n");    return(-1);  }Information about possible configurations can be obtained with a set offunctions named  snd_pcm_hw_params_can_<capability>  snd_pcm_hw_params_is_<property>  snd_pcm_hw_params_get_<parameter>The availability of the most important parameters, namely access type, buffer size, number of channels, sample format, sample rate, and number of periods, can be tested with a set of functions named  snd_pcm_hw_params_test_<parameter> These query functions are especially important, if the "hw" interface isused. The configuration space can be restricted to a certain configuration with a set of functions named  snd_pcm_hw_params_set_<parameter>For this example, we assume that the soundcard can be configured forstereo playback of 16 Bit Little Endian data, sampled at 44100 Hz.Accordingly, we restrict the configurations space to match thisconfiguration:   int rate = 44100; /* Sample rate */  int periods = 2;     /* Number of periods */  int periodsize = 8192; /* Periodsize (bytes) */The access type specifies the way, multichannel data is stored in thebuffer. For INTERLEAVED access, each frame in the buffer contains theconsecutive sample data for the channels. For 16 Bit stereo data, thismeans that the buffer contains alternating words of sample data for the leftand right channel. For NONINTERLEAVED access, each period contains first allsample data for the first channel followed by the sample data for the secondchannel and so on.    /* Set access type. This can be either    */  /* SND_PCM_ACCESS_RW_INTERLEAVED or       */  /* SND_PCM_ACCESS_RW_NONINTERLEAVED.      */  /* There are also access types for MMAPed */  /* access, but this is beyond the scope   */  /* of this introduction.                  */  if (snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) {    fprintf(stderr, "Error setting access.\n");    return(-1);  }    /* Set sample format */  if (snd_pcm_hw_params_set_format(pcm_handle, hwparams, SND_PCM_FORMAT_S16_LE) < 0) {    fprintf(stderr, "Error setting format.\n");    return(-1);  }  /* Set sample rate. If the exact rate is not supported */  /* by the hardware, use nearest possible rate.         */   if (snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, rate, 0) < 0) {    fprintf(stderr, "Error setting rate.\n");    return(-1);  }  /* Set number of channels */  if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 2) < 0) {    fprintf(stderr, "Error setting channels.\n");    return(-1);  }  /* Set number of periods. Periods used to be called fragments. */   if (snd_pcm_hw_params_set_periods(pcm_handle, hwparams, periods, 0) < 0) {    fprintf(stderr, "Error setting periods.\n");    return(-1);  }The unit of the buffersize depends on the function. Sometimes it is given inbytes, sometimes the number of frames have to be specified. One frame is thesample data vector for all channels. For 16 Bit stereo data, one frame has alength of four bytes.     /* Set buffer size (in frames). The resulting latency is given by */  /* latency = periodsize * periods / (rate * bytes_per_frame)     */  if (snd_pcm_hw_params_set_buffer_size(pcm_handle, hwparams, (periodsize * periods)>>2) < 0) {    fprintf(stderr, "Error setting buffersize.\n");    return(-1);  }Now we apply the configuration to the PCM device pointed to by pcm_handle.This will also prepare the PCM device.     /* Apply HW parameter settings to */  /* PCM device and prepare device  */  if (snd_pcm_hw_params(pcm_handle, hwparams) < 0) {    fprintf(stderr, "Error setting HW params.\n");    return(-1);  }After the PCM device is configured, we can start writing PCM data to it.The first write access will start the PCM playback. For interleaved write access, we use the function     /* Write num_frames frames from buffer data to    */   /* the PCM device pointed to by pcm_handle.       */  /* Returns the number of frames actually written. */  snd_pcm_sframes_t snd_pcm_writei(pcm_handle, data, num_frames);For noninterleaved access, we would have to use the function  /* Write num_frames frames from buffer data to    */   /* the PCM device pointed to by pcm_handle.       */   /* Returns the number of frames actually written. */  snd_pcm_sframes_t snd_pcm_writen(pcm_handle, data, num_frames);After the PCM playback is started, we have to make sure, that ourapplication sends enough data to the soundcard buffer. Otherwise, abuffer underrun will occur. After such an underrun has occured,snd_pcm_prepare should be called. A simple stereo saw wave could begenerated this way:  unsigned char *data;  int pcmreturn, l1, l2;  short s1, s2;  int frames;  data = (unsigned char *)malloc(periodsize);  frames = periodsize >> 2;  for(l1 = 0; l1 < 100; l1++) {    for(l2 = 0; l2 < num_frames; l2++) {      s1 = (l2 % 128) * 100 - 5000;        s2 = (l2 % 256) * 100 - 5000;        data[4*l2] = (unsigned char)s1;      data[4*l2+1] = s1 >> 8;      data[4*l2+2] = (unsigned char)s2;      data[4*l2+3] = s2 >> 8;    }    while ((pcmreturn = snd_pcm_writei(pcm_handle, data, frames)) < 0) {      snd_pcm_prepare(pcm_handle);      fprintf(stderr, "<<<<<<<<<<<<<<< Buffer Underrun >>>>>>>>>>>>>>>\n");    }  }If we want to stop playback, we can either use snd_pcm_drop orsnd_pcm_drain. The first function will immediately stop the playback anddrop pending frames. The latter function will stop after pending frames havebeen played.  /* Stop PCM device and drop pending frames */  snd_pcm_drop(pcm_handle);  /* Stop PCM device after pending frames have been played */   snd_pcm_drain(pcm_handle);3. PCM capture  --------------It is not possible to use one pcm handle for both playback and capture. Soyou have to configure two handles if you want to access the PCM device inboth directions. The snd_pcm_open function now has to be called with stream set to SND_PCM_STREAM_CAPTURE.  /* Capture stream */  snd_pcm_stream_t stream_capture = SND_PCM_STREAM_CAPTURE;The other settings are identical to the playback settings.For interleaved capture, we call  /* Read num_frames frames from the PCM device  */  /* pointed to by pcm_handle to buffer capdata. */  /* Returns the number of frames actually read. */  snd_pcm_readi(pcm_capture_handle, capdata, num_frames);For noninterleaved access, we would have to use the function  /* Read num_frames frames from the PCM device  */           /* pointed to by pcm_handle to buffer capdata. */        /* Returns the number of frames actually read. */     snd_pcm_readn(pcm_capture_handle, capdata, num_frames);As in the case of playback, we have to take care that the application callsthe read function before the capture buffer of the soundcard is completely filled.Otherwise there will be a buffer overrun.  int pcmreturn;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人开心网精品视频| 99国内精品久久| 青青草成人在线观看| 亚洲大片精品永久免费| 亚洲影视在线观看| 亚洲综合视频网| 夜色激情一区二区| 亚洲午夜久久久久久久久电影网| 亚洲精品欧美二区三区中文字幕| 亚洲老妇xxxxxx| 亚洲国产中文字幕在线视频综合| 亚洲高清免费视频| 视频一区在线视频| 麻豆中文一区二区| 国产综合久久久久影院| 粉嫩久久99精品久久久久久夜| 国产伦精品一区二区三区视频青涩 | 美腿丝袜亚洲综合| 麻豆成人久久精品二区三区红| 久久不见久久见免费视频7| 国产中文字幕精品| 99久久免费精品高清特色大片| 在线精品视频一区二区三四| 欧美三级视频在线播放| 日韩午夜精品电影| 国产欧美中文在线| 亚洲综合色自拍一区| 麻豆成人免费电影| 成人污污视频在线观看| 欧美色涩在线第一页| 日韩欧美国产小视频| 国产精品伦一区| 亚洲成人av一区二区| 麻豆免费精品视频| 成人午夜电影网站| 欧美高清视频www夜色资源网| 26uuu久久天堂性欧美| 亚洲欧洲日产国码二区| 丝瓜av网站精品一区二区| 久久99国产精品尤物| 99精品在线观看视频| 91麻豆精品国产无毒不卡在线观看| 国产日产欧美一区二区三区| 亚洲自拍偷拍综合| 国产在线看一区| 欧亚一区二区三区| 久久久精品日韩欧美| 亚洲最大成人网4388xx| 国产精品一区二区果冻传媒| 欧美在线观看禁18| 国产夜色精品一区二区av| 亚洲亚洲精品在线观看| 国产精品一区二区果冻传媒| 欧美日韩久久一区| 亚洲国产精品av| 青青草97国产精品免费观看| 91女人视频在线观看| 精品免费一区二区三区| 亚欧色一区w666天堂| 波多野结衣欧美| 精品美女一区二区三区| 午夜欧美一区二区三区在线播放| 成人综合在线视频| 91精品国产欧美一区二区| 日韩毛片高清在线播放| 国产美女视频一区| 欧美一二三区在线| 亚洲一区免费观看| www.爱久久.com| 久久色中文字幕| 日韩精品电影在线观看| 日本久久一区二区| 国产精品理论片| 国产一区二区美女| 精品久久久久香蕉网| 日韩中文字幕不卡| 91国偷自产一区二区三区成为亚洲经典 | 国内精品在线播放| 日韩一区二区三区在线观看| 一区二区三区不卡视频在线观看| 国产河南妇女毛片精品久久久| 日韩一区二区三| 日韩精品国产欧美| 在线不卡中文字幕播放| 亚洲一区中文在线| 色噜噜狠狠一区二区三区果冻| 亚洲国产高清在线观看视频| 久久av中文字幕片| 欧美精品 日韩| 日本伊人色综合网| 欧美美女一区二区| 亚洲成人第一页| 欧美日韩国产首页在线观看| 亚洲综合一区二区三区| 欧美性大战久久久久久久蜜臀| 亚洲精品免费一二三区| 99久久精品情趣| 亚洲欧美日韩综合aⅴ视频| www.亚洲激情.com| 日韩一区在线播放| 99视频精品全部免费在线| 综合网在线视频| 北条麻妃国产九九精品视频| 国产目拍亚洲精品99久久精品| 国产一区二区免费看| 日本一区二区三级电影在线观看 | 欧美妇女性影城| 日韩av一区二区三区| 91精品国产91久久久久久最新毛片 | 秋霞电影网一区二区| 日韩欧美激情四射| 极品美女销魂一区二区三区免费| 精品国产污网站| 国产综合色精品一区二区三区| 国产日韩欧美精品一区| www.激情成人| 亚洲综合在线视频| 欧美人妖巨大在线| 日本成人在线看| 久久先锋影音av鲁色资源网| 丁香五精品蜜臀久久久久99网站| 国产精品久久久久毛片软件| 一本到一区二区三区| 亚洲成人免费电影| 欧美成人伊人久久综合网| 粉嫩一区二区三区性色av| 亚洲人成网站影音先锋播放| 欧美亚洲高清一区二区三区不卡| 三级欧美在线一区| 久久综合久久综合久久综合| zzijzzij亚洲日本少妇熟睡| 一区二区三区四区不卡在线| 3atv一区二区三区| 麻豆国产精品官网| 中文字幕一区二区三区色视频 | 亚洲一区二区三区美女| 日韩免费高清视频| 成人精品小蝌蚪| 亚洲国产精品人人做人人爽| 精品久久久久久久久久久久久久久 | 久久久久久黄色| 一本一本大道香蕉久在线精品 | 日本韩国精品在线| 久久精品国产亚洲5555| 国产精品视频线看| 欧美三级电影网站| 国产精品白丝jk白祙喷水网站| 亚洲欧洲综合另类| 精品久久久久久最新网址| 99精品国产99久久久久久白柏| 青娱乐精品在线视频| 国产精品欧美一区二区三区| 欧美久久久久久蜜桃| 成人av手机在线观看| 青青草原综合久久大伊人精品 | 亚洲国产精品一区二区久久| 国产亚洲精品久| 6080日韩午夜伦伦午夜伦| 成人中文字幕在线| 日本在线不卡一区| 1024成人网| 久久五月婷婷丁香社区| 欧美精品九九99久久| av电影一区二区| 国产制服丝袜一区| 亚洲成人av福利| 最新热久久免费视频| 亚洲精品一区二区三区四区高清| 91麻豆免费视频| 国产福利91精品| 免费一级片91| 亚洲成人午夜影院| 一区二区在线观看免费视频播放| 久久综合视频网| 欧美一区二区三区四区视频| 色婷婷狠狠综合| 成人午夜大片免费观看| 国产在线视频一区二区| 肉色丝袜一区二区| 亚洲一区二区三区在线| 一区精品在线播放| 国产欧美精品一区二区色综合| 日韩欧美国产电影| 69av一区二区三区| 欧美日韩国产区一| 欧美亚洲综合网| 91黄色激情网站| 91视频一区二区| 99精品国产热久久91蜜凸| 波多野结衣91| 波多野结衣在线一区| 国产成人一区在线| 国产一区不卡视频| 国产一区二区三区精品视频| 卡一卡二国产精品| 美女性感视频久久| 轻轻草成人在线| 欧美日韩国产乱码电影| 在线免费亚洲电影| 91极品视觉盛宴|