锘??xml version="1.0" encoding="utf-8" standalone="yes"?>无码人妻少妇久久中文字幕 ,久久精品国产久精国产思思,久久久久久精品久久久久http://www.shnenglu.com/gaimor/category/16272.htmlC/C++楂樼駭宸ョ▼甯? Android楂樼駭杞歡宸ョ▼甯? IT闆嗘垚宸ョ▼甯? 闊抽宸ョ▼甯? 鐔熸倝c,c++,java,c#,py,js,asp絳夊縐嶈璦 紼嬪簭鐚?/description>zh-cnThu, 19 Sep 2019 02:15:10 GMTThu, 19 Sep 2019 02:15:10 GMT60ffmpeg av_seek_framehttp://www.shnenglu.com/gaimor/archive/2019/09/19/216840.htmlccsdu2009ccsdu2009Thu, 19 Sep 2019 01:51:00 GMThttp://www.shnenglu.com/gaimor/archive/2019/09/19/216840.htmlhttp://www.shnenglu.com/gaimor/comments/216840.htmlhttp://www.shnenglu.com/gaimor/archive/2019/09/19/216840.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/216840.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/216840.html    int result = av_seek_frame(ffmpeg->formatCtx, -1,
        (ffmpeg->formatCtx->start_time + time) * AV_TIME_BASE,
        AVSEEK_FLAG_BACKWARD);
time鍗曚綅涓虹


ccsdu2009 2019-09-19 09:51 鍙戣〃璇勮
]]>
GAudio library 2.2.1.0鍙戝竷鍟?/title><link>http://www.shnenglu.com/gaimor/archive/2015/12/10/212449.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Thu, 10 Dec 2015 08:37:00 GMT</pubDate><guid>http://www.shnenglu.com/gaimor/archive/2015/12/10/212449.html</guid><wfw:comment>http://www.shnenglu.com/gaimor/comments/212449.html</wfw:comment><comments>http://www.shnenglu.com/gaimor/archive/2015/12/10/212449.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/gaimor/comments/commentRss/212449.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gaimor/services/trackbacks/212449.html</trackback:ping><description><![CDATA[鏇存柊涓嶅錛屼富瑕佹槸鍙栨秷浜嗘彃鎺ョ粨鏋勶紝鎶婃墍鏈夌殑緙栬В鐮佸拰闊蟲晥閮藉悎鍏ヤ簡涓誨簱<br />dll鍚堣涓嶈秴榪?M<br /><br />鏀寔甯歌闊抽鏍煎紡鍜岄煶鏁堬紝浣跨敤瓚呯駭鏂逛究<br />涓嬭澆鍦ㄨ繖閲?<a href="/Files/gaimor/gaudio-sdk-2.2.1.0.zip">/Files/gaimor/gaudio-sdk-2.2.1.0.zip</a><img src ="http://www.shnenglu.com/gaimor/aggbug/212449.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gaimor/" target="_blank">ccsdu2009</a> 2015-12-10 16:37 <a href="http://www.shnenglu.com/gaimor/archive/2015/12/10/212449.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>GAudio浠嬬粛http://www.shnenglu.com/gaimor/archive/2013/11/26/204465.htmlccsdu2009ccsdu2009Tue, 26 Nov 2013 11:53:00 GMThttp://www.shnenglu.com/gaimor/archive/2013/11/26/204465.htmlhttp://www.shnenglu.com/gaimor/comments/204465.htmlhttp://www.shnenglu.com/gaimor/archive/2013/11/26/204465.html#Feedback1http://www.shnenglu.com/gaimor/comments/commentRss/204465.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/204465.html
褰撳墠鎬ц兘:
1.鏈澶ф敮鎸侀煶婧愬悓鏃舵挱鏀劇殑鏍煎紡-8
2.鍗曢煶婧愭渶澶ф寕杞界殑闊蟲晥涓暟-8
3.鍏ㄥ眬鏈澶у彲鎸傝澆鐨勯煶鏁堜釜鏁?8
4.褰撳墠鏀寔璇█C/C++/C#
5.褰撳墠鏀寔鐨凮S Win32/Win64/Linux32
6. 褰撳墠鏀寔鐨勯煶鏁?Fade in,Fade Out,Bassboost,Speed Changer,Echo,3D Effect, Doppler, Phaser, Channel Merget, Channel Swap,  Fft, Distortion, Foldback Distortion, Modulator, AutoWah 絳?br />7.褰撳墠鏀寔鐨勮В鐮佹牸寮?- WAV, AU, AIFF, OGG, MOD,IT,XM,S3M,WV,MPC,WV,TTA,MP3,MIDI,FLAC
8.鏀寔鐨勭紪鐮佹牸寮?- WAV,AU,AIFF,OGG,MP2,MP3,FLAC,AAC,WV,VOC,CAF
9.鏀寔鐨勯煶棰戝姞杞芥ā寮?- 鏂囦歡鍔犺澆錛屽唴瀛樺姞杞斤紝铏氭嫙鏂囦歡鍔犺澆
10.鏀寔PAN,鐜粫闊?鍏ㄩ煶閲忥紝闊蟲簮闊抽噺璁劇疆

涓嬩竴姝ヨ鍒?
1.DEPHI緇戝畾
2.MAC OS鏀寔
3.Flanger,Chorus闊蟲晥
4.TAK,AAC鏍煎紡
5.鏁呴殰澶勭悊

榪滄櫙:
1.鏀寔鎵鏈夊鉤鍙板拰鎵嬫寔璁懼
2.鏀寔甯歌鐨勬墍鏈夐煶棰戞牸寮?br />3.鏀寔甯歌鐨勬墍鏈夐煶鏁?br />4.鎻愰珮鏈鏄撶敤鏈鏂逛究鐨凙PI鎺ュ彛

涓涓嬌鐢ㄧ殑灝忎緥瀛?
/*
    GAudio 2.1.0.1, (C)2013 by Eric Du(E)
    This program is a part of the GAudio SDK.
    Use GAudio's echo effect
*/
#include 
<stdlib.h>
#include 
<conio.h>
#include 
<stdio.h>
#include 
"gaudio.h"

int main(int argc,char* argv[])
{
    printf(
"echo created by D.Eric\n");

#if(defined(WIN32) || defined(WIN64))
    gaudio_init(
"addons");
#else
    gaudio_init(
"/usr/local/lib/gaudio/");
#endif

    
const char* filename = "..\\media\\hurnscald.ogg";

    gsource
* source = gaudio_source_create_from_file(filename,FALSE);
    
if(source == NULL)
    {
        printf(
"load file:%s error!\n",filename);
        printf(
"bad source.\nerror code:%d.\n",gaudio_error_get());
        gaudio_deinit();
        
return -1;
    }

    gaudio_source_set_int32(source,AUDIO_ENUM_LOOP,FALSE);
    printf(
"play filename:%s\n",filename);

    geffect
* effect = gaudio_effect_create(AUDIO_EFFECT_ECHO,0);
    
if(!effect)
    {
        printf(
"not support echo effect\n");
        gaudio_source_destroy(source);
        gaudio_deinit();
        
return -1;
    }

    gaudio_effect_set_float(effect,AUDIO_EFFECT_ECHO_DELAY,
1.0f);
    gaudio_effect_set_float(effect,AUDIO_EFFECT_ECHO_DECAY,
0.6f);

    gaudio_effect_bind(effect,
0);
    gaudio_source_play(source,FALSE);

    printf(
"\nplaying, press any key to quit.\n");
    getch();

    gaudio_effect_unbind(effect);
    gaudio_effect_destroy(effect);

    gaudio_source_stop(source);
    gaudio_source_destroy(source);

    gaudio_deinit();
    system(
"PAUSE");
    
return EXIT_SUCCESS;
}

榪欎釜浠h〃浜嗘垜褰撳墠瀵歸煶棰戣繖鍧楃殑浜嗚В紼嬪害
涓嬭澆鍦ㄨ繖閲?download
嬈㈣繋鎻愭剰瑙佸晩.

ccsdu2009 2013-11-26 19:53 鍙戣〃璇勮
]]>
浣跨敤libao+mpeg123鎾斁mp3鐨勪緥瀛?/title><link>http://www.shnenglu.com/gaimor/archive/2013/08/04/202333.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Sun, 04 Aug 2013 04:12:00 GMT</pubDate><guid>http://www.shnenglu.com/gaimor/archive/2013/08/04/202333.html</guid><wfw:comment>http://www.shnenglu.com/gaimor/comments/202333.html</wfw:comment><comments>http://www.shnenglu.com/gaimor/archive/2013/08/04/202333.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/gaimor/comments/commentRss/202333.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gaimor/services/trackbacks/202333.html</trackback:ping><description><![CDATA[鐩存帴涓婁唬鐮?<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">stdio.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">ao</span><span style="color: #000000; ">/</span><span style="color: #000000; ">ao.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; ">"</span><span style="color: #000000; ">mpg123.h</span><span style="color: #000000; ">"</span><span style="color: #000000; "><br /><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> argc, </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> </span><span style="color: #000000; ">*</span><span style="color: #000000; ">argv[])<br />{   <br />    ao_initialize();<br />        <br />    mpg123_handle </span><span style="color: #000000; ">*</span><span style="color: #000000; ">mpg123 ;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> iMpg123_error;<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(MPG123_OK </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> (iMpg123_error </span><span style="color: #000000; ">=</span><span style="color: #000000; "> mpg123_init()))<br />    {<br />        printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">failed to init mpg123\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    }<br /><br />    mpg123 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> mpg123_new(mpg123_decoders()[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">], </span><span style="color: #000000; ">&</span><span style="color: #000000; ">iMpg123_error);<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(MPG123_OK </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> (iMpg123_error </span><span style="color: #000000; ">=</span><span style="color: #000000; "> mpg123_open(mpg123,argv[</span><span style="color: #000000; ">1</span><span style="color: #000000; ">])))<br />    {<br />        fprintf(stderr,</span><span style="color: #000000; ">"</span><span style="color: #000000; ">error in open mp3 file\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    }<br />    <br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> rate,channel,encoding;<br />    mpg123_getformat(mpg123,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">rate,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">channel,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">encoding);<br />    <br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> default_driver </span><span style="color: #000000; ">=</span><span style="color: #000000; "> ao_default_driver_id();<br />    ao_sample_format format;<br />    memset(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">format,</span><span style="color: #000000; ">0</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(format));<br />    format.bits </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">16</span><span style="color: #000000; ">;<br />    format.channels </span><span style="color: #000000; ">=</span><span style="color: #000000; "> channel;<br />    format.rate </span><span style="color: #000000; ">=</span><span style="color: #000000; "> rate;<br />    format.byte_format </span><span style="color: #000000; ">=</span><span style="color: #000000; "> AO_FMT_LITTLE;<br />    <br />    ao_device </span><span style="color: #000000; ">*</span><span style="color: #000000; ">device; <br />    device </span><span style="color: #000000; ">=</span><span style="color: #000000; "> ao_open_live(default_driver,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">format,NULL);<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(device </span><span style="color: #000000; ">==</span><span style="color: #000000; "> NULL) <br />    {<br />        fprintf(stderr,</span><span style="color: #000000; ">"</span><span style="color: #000000; ">error opening device.\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    }<br />    <br />    </span><span style="color: #0000FF; ">short</span><span style="color: #000000; "> buffer[</span><span style="color: #000000; ">4096</span><span style="color: #000000; ">];<br />    <br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> read </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(</span><span style="color: #000000; ">1</span><span style="color: #000000; ">)<br />    {<br />        mpg123_read(mpg123,buffer,</span><span style="color: #000000; ">4096</span><span style="color: #000000; ">,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">read);<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(read </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />            </span><span style="color: #0000FF; ">break</span><span style="color: #000000; ">;<br />        ao_play(device,buffer,read);    <br />    }<br /><br />    mpg123_close(mpg123);<br /><br />    ao_close(device);<br />    ao_shutdown();<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />}</span></div><img src ="http://www.shnenglu.com/gaimor/aggbug/202333.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gaimor/" target="_blank">ccsdu2009</a> 2013-08-04 12:12 <a href="http://www.shnenglu.com/gaimor/archive/2013/08/04/202333.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>linux涓嬩嬌鐢╫ss鎾斁闊充箰http://www.shnenglu.com/gaimor/archive/2013/07/19/201978.htmlccsdu2009ccsdu2009Fri, 19 Jul 2013 14:11:00 GMThttp://www.shnenglu.com/gaimor/archive/2013/07/19/201978.htmlhttp://www.shnenglu.com/gaimor/comments/201978.htmlhttp://www.shnenglu.com/gaimor/archive/2013/07/19/201978.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/201978.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/201978.html#include <stdio.h>
#include 
<errno.h>
#include 
<string.h>
#include 
<unistd.h>
#include 
<fcntl.h>
#include 
<math.h>
#if defined(__OpenBSD__) || defined(__NetBSD__)
#include 
<soundcard.h>
#else
#include 
<sys/soundcard.h>
#endif
#include 
<sys/ioctl.h>
#include 
<sndfile.h>

#define BUFFER_LEN 4096

int _open_default_oss_device(char **dev_path,int id,int blocking);

int main(int argc,char *argv[])
{
    
if(argc<2)
        
return 0;

    SF_INFO info;
    SNDFILE
* file = sf_open(argv[1],SFM_READ,&info);
    
if(!file)
        
return 0;

    printf(
"samplerate:%d\n",info.samplerate);
    printf(
"channel:%d\n",info.channels);

    
char* dsp = NULL;
    
int dp = _open_default_oss_device(&dsp,0,0);
    if(dp < 0)
    {
        printf(
"dsp:%d\n",dp);
        perror("oss bad:");
        sf_close(file);
        return -1; 
    }
    
int tmp = info.channels;
    
int ret = ioctl(dp,SNDCTL_DSP_CHANNELS,&tmp);
    tmp 
= info.samplerate;
    ret 
= ioctl(dp,SNDCTL_DSP_SPEED,&tmp);
    tmp 
= AFMT_S16_LE;
    ioctl(dp,SNDCTL_DSP_SAMPLESIZE,
&tmp);

    
long  len = 0;
    
short buffer[BUFFER_LEN];
    
while((len=sf_read_short(file,buffer,BUFFER_LEN))!=0)
    {
        write(dp,(
char*)buffer,len*2);
    }

    close(dp);
    sf_close(file);
    free(dsp);
    
return 0;
}

int _open_default_oss_device(char **dev_path,int id,int blocking)
{
    
int fd;
    
char buf[80];

    
if(id>0)
    {
        sprintf(buf,
"/dev/sound/dsp%d",id);
        
if(!(*dev_path = strdup(buf)))
            
return -1;
    }
    
else
    {
        
if(!(*dev_path = strdup("/dev/sound/dsp")))
            
return -1;
    }

#ifdef BROKEN_OSS
    fd 
= open(*dev_path, O_WRONLY | O_NONBLOCK);
#else
    fd 
= open(*dev_path, O_WRONLY);
#endif

    
if(fd < 0)
    {
        free(
*dev_path);
        
if(id>0)
        {
            sprintf(buf,
"/dev/dsp%d",id);
            
if(!(*dev_path = strdup(buf)))
                
return -1;
        }
        
else
        {
            
if(!(*dev_path = strdup("/dev/dsp")))
                
return -1;
        }
#ifdef BROKEN_OSS
        fd 
= open(*dev_path, O_WRONLY | O_NONBLOCK);
#else
        fd 
= open(*dev_path, O_WRONLY);
#endif
    }

#ifdef BROKEN_OSS
    
if(fd >= 0 && blocking)
    {
        
if(fcntl(fd, F_SETFL, 0< 0)
        {
            close(fd);
            fd 
= -1;
        }
    }
#endif
    
if(fd < 0)
    {
        free(
*dev_path);
        
*dev_path = NULL;
    }
    
return fd;
}

鍙槸鍦ㄧ殑鎴戠殑ubuntu13.0.4涓嬫墽琛屾墽琛?./text music.wav 浼氭彁紺洪敊璇?榪斿洖-1 鎻愮ず no such directory
鍦ㄧ綉涓婃悳鏈変漢璇撮渶瑕佸姞杞絪nd_pcm_oss
modprobe snd_pcm_oss
鍙垜鍔犺澆鐨勬椂鍊欐彁紺?br />
FATAL: Module snd_pcm_oss not found.
璋佺煡閬撹繖涓浣曞紕錛?br />
鍙﹀鏌ヤ簡涓嬪彲浠ュ姞杞絘lsa-oss
涔嬪悗璋冪敤aoss ./text music.wav鏉ユ挱鏀鵑煶涔?br />鍙互榪欎釜涓嶆槸鎴戣鐨勶紝闈炲懡浠よ涓嬩笉鑳藉姞榪欎釜鍓嶇紑


ccsdu2009 2013-07-19 22:11 鍙戣〃璇勮
]]>
gaudio鏄竴涓熀浜嶤/C++娣峰悎緙栫▼鐨勯煶棰戝簱~http://www.shnenglu.com/gaimor/archive/2013/07/11/201711.htmlccsdu2009ccsdu2009Thu, 11 Jul 2013 14:49:00 GMThttp://www.shnenglu.com/gaimor/archive/2013/07/11/201711.htmlhttp://www.shnenglu.com/gaimor/comments/201711.htmlhttp://www.shnenglu.com/gaimor/archive/2013/07/11/201711.html#Feedback2http://www.shnenglu.com/gaimor/comments/commentRss/201711.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/201711.htmlgaudio鏄竴涓熀浜嶤/C++娣峰悎緙栫▼鐨勮法騫沖彴闊抽搴?褰撳墠鏀寔windows32鎿嶄綔緋葷粺鍜宭inux32浣嶆搷浣滅郴緇?br />
淇敼璁板綍
1.2013.04.01
    鍒濇鍙戝竷
2.2013.04.10
    瀹屾垚瀵箇av鏍煎紡閲囨牱棰戠巼8000-48000,閲囨牱鏍煎紡4,8,16,24,32鐨勬敮鎸?    
3.2013.05.01
    a.鐗堟湰鎻愬崌涓?.4.0.8
    b.淇敼涓涓鍑哄紓甯?br />    c.鏀寔浜屾簮娣烽煶
    d.浣跨敤杞藉叆鎻掍歡鐨勬柟寮忔彁渚涘wav鎾斁鐨勬敮鎸?br />    e.澧炲姞瀵筧u鏍煎紡鐨勬敮鎸?br />    f.澧炲姞echo闊蟲晥
    g.澧炲姞bassboost闊蟲晥
    h.澧炲姞鍑芥暟gaudio_address_get
    i.澧炲姞浣跨敤渚嬪瓙:echo/mixer/stream/boost
    j.鎶婅緗?鑾峰彇闊蟲簮涓夌淮絀洪棿淇℃伅鐨勫嚱鏁拌皟鏁翠負: gaudio_source_set_float3,gaudio_source_get_float3
    k.淇敼瑙g爜鍣ㄧ粨鏋勪負鍥炶皟妯″紡
4.2013.05.10
    a.鐗堟湰鎻愬崌涓?.6.8.0
    b.浼樺寲閮ㄥ垎浠g爜
    c.澧炲姞speedchanger闊蟲晥
    d.澧炲姞闊抽緲昏漿(g168)
    e.澧炲姞闊抽澹伴亾浜ゆ崲(g168)
    f.澧炲姞澹伴亾鍚堝茍(g168)
    g.澧炲姞speedchanger/invert嫻嬭瘯鐢ㄤ緥
    h.澧炲姞vc璋冪敤闈欐侀摼鎺ュ簱libgaudio.lib
    i.澧炲姞璋冨埗闊蟲晥鍜屾祴璇曚緥瀛?br />    j.淇敼瑙g爜鍣ㄦ鏋?br />    k.淇敼鑾峰彇闊抽閲囨牱緙栫爜鏍煎紡涓嶆紜殑闂
    l.瑙e喅seek瀹氫綅涓嶅噯鐨勯棶棰?br />    m.澧炲姞闊蟲晥閾炬祴璇曚緥瀛?br />    n.澧炲姞鍑芥暟gaudio_set_long,gaudio_get_long
    o.淇敼stream渚嬪瓙
    p.鏀寔鍘嬬緝mpc闊抽鏍煎紡
    q.鏀寔ogg/vorbis鏍煎紡
    r.淇敼鑾峰彇閲囨牱鏍煎紡閿欒鐨刡ug
    t.澧炲姞鎺ュ彛璇存槑鏂囨。    
5.2013.06.10
    a.鐗堟湰鎻愬崌涓?.7.2.0
    b.gaudio_source_set_error_callback鍥炶皟鍑芥暟澧炲姞闊蟲簮鍙傛暟
    c.gaudio_source_set_finish_callback鍥炶皟鍑芥暟澧炲姞闊蟲簮鍙傛暟
    d.縐婚櫎gaudio_get_version鍑芥暟
    e.gaudio_effect_setcallback鍑芥暟璋冩暣涓篻audio_effect_set_callback
    f.浣跨敤鎻掍歡寮忕殑闊抽椹卞姩妯″紡 - gwinmm
    g.gaudio浠g爜浼樺寲
    h.澧炲姞闊抽婧愮爜鐜囩殑鑾峰彇
    i.澧炲姞feature鑼冧緥
    j.瀹屽杽鏂囨。
    k.澧炲姞瀵筸p3鐨勬敮鎸?br />    l.縐婚櫎invert/modulator/bassboost渚嬪瓙
    m.澧炲姞balance
6.2013.07.07
    a.鐗堟湰鎻愬崌鍒?.8.0.2
    b.澧炲姞瀵逛氦鎹㈡枃浠禷iff鐨勬敮鎸?br />    c.淇敼闊抽椹卞姩鎻掍歡瀹炵幇
    d.澧炲姞縐葷浉鍣ㄩ煶鏁?br />    e.淇敼閮ㄥ垎API鎺ュ彛浣跨敤鐨刲ong涓篿nt32_t浠ユ柟渚跨Щ妞?br />    f.澧炲姞code::blocks嫻嬭瘯宸ョ▼
    g.澧炲姞msvc2008嫻嬭瘯宸ョ▼
    h.澧炲姞鍑芥暟鎺ュ彛gaudio_source_create_from_buffer2浠ユ挱鏀緍aw闊抽鏁版嵁
    i.鎶婂悇涓煶鏁堝弬鏁版彁鍒板崟鐙枃浠?br />    j.綆鍖杦av瑙g爜
    k.淇敼鍑犲鍐呭瓨娉勬紡
    l.澧炲姞闊抽鍥炲綍鍔熻兘,杈撳嚭鏍煎紡MP2,MP3,APE,WV,AAC,WAV,AU,AIFF,VOC,CAF,OGG
    褰撳墠褰曞埗淇℃伅:16浣嶉煶棰?鍙屽0閬?閲囨牱棰戠巼44100
    m.澧炲姞闊抽鍥炲綍鐨勪緥瀛恟ecorder
    n.嫻嬭瘯渚嬪瓙浣跨敤getopt鍜寀sage鎻愮ず
    o.澧炲姞瀵箃ta鏍煎紡鐨勬敮鎸?nbsp;   
7.2013.07.28
    a.鐗堟湰鎻愬崌鍒?.9.8.6                   
    b.瑙e喅浜唚av,au,aiff鎾斁榪涘害涓嶅噯鐨勬晠闅?
    c.浼樺寲wav/au/aiff瑙g爜鎬ц兘        
    d.澧炲姞distortion闊蟲晥              
    e.澧炲姞foldback distortion闊蟲晥       
    f.澧炲姞distortion闊蟲晥浣跨敤渚嬪瓙       
    g.澧炲姞澹伴煶絀塊忓姏                      
    h.淇敼緇撴瀯鏈澶ф敮鎸佸叓澹伴亾             
    i.澧炲姞portaudio鎻掍歡椹卞姩(win32&linux)  
    j.瀹屾垚g168,bassbost鐨刲iux鐗堟湰     
    k.瀹屾垚wav,au闊抽鏍煎紡鐨刲inux鐗堟湰      
    l.浠g爜澧炲姞閮ㄥ垎娉ㄩ噴(鏈畬鎴?            
    m.灝濊瘯鎬ф敮鎸乴inux鎿嶄綔緋葷粺             
    n.鏀寔midi/mid闊充箰鏍煎紡             
    o.瑙e喅浜唌ixer娣烽煶閫鍑烘姤閿欑殑闂
    p.skip id3v2    
8.2013.08.16
    a.鐗堟湰鎻愬崌鍒?.0.0.1                    
    b.鍙橀噺瀹忓鍔燗UDIO_ENUM鍓嶇紑
    c.澧炲姞闈炴爣鍑嗘彃浠秅sndfile鏀寔flac/ogg/au/wav/aiff/voc/caf/..鍩轟簬(sndfile)
    d.鏀圭敤mpg123瑙g爜mp3
    e.鏀寔FFT棰戣氨
9.2013.09.08
    a.鐗堟湰鎻愬崌鍒?.0.6.0
    b.淇敼CROSSFEED瀹忓拰鐩稿叧    
    c.寮曞叆200鍙鋒彃浠舵敮鎸乻3m/mod/it/xm闊抽鏍煎紡
    d.鏁寸悊嫻嬭瘯鐢ㄤ緥
    e.澧炲姞autowah闊蟲晥
    f.澧炲姞椹卞姩媯嫻?br />10.2015.12.10 鐗堟湰2.2.1.0
鏀寔甯歌闊抽鏍煎紡鍜岄煶鏁堬紝浣跨敤瓚呯駭鏂逛究
涓嬭澆鍦ㄨ繖閲?/Files/gaimor/gaudio-sdk-2.2.1.0.zip

    
 


ccsdu2009 2013-07-11 22:49 鍙戣〃璇勮
]]>
浣跨敤LIBMAD鎾斁MP3鐨勪緥瀛?/title><link>http://www.shnenglu.com/gaimor/archive/2013/06/09/200905.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Sun, 09 Jun 2013 13:14:00 GMT</pubDate><guid>http://www.shnenglu.com/gaimor/archive/2013/06/09/200905.html</guid><wfw:comment>http://www.shnenglu.com/gaimor/comments/200905.html</wfw:comment><comments>http://www.shnenglu.com/gaimor/archive/2013/06/09/200905.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/gaimor/comments/commentRss/200905.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gaimor/services/trackbacks/200905.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">stdio.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #0000FF; ">string</span><span style="color: #000000; ">.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">ao</span><span style="color: #000000; ">/</span><span style="color: #000000; ">ao.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">libmad</span><span style="color: #000000; ">/</span><span style="color: #000000; ">mad.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">math.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">limits.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /><br />signed </span><span style="color: #0000FF; ">short</span><span style="color: #000000; "> to_short(mad_fixed_t </span><span style="color: #0000FF; ">fixed</span><span style="color: #000000; ">)<br />{<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">fixed</span><span style="color: #000000; ">>=</span><span style="color: #000000; ">MAD_F_ONE)<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">(SHRT_MAX);<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">fixed</span><span style="color: #000000; "><=-</span><span style="color: #000000; ">MAD_F_ONE)<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">(</span><span style="color: #000000; ">-</span><span style="color: #000000; ">SHRT_MAX);<br />    </span><span style="color: #0000FF; ">fixed</span><span style="color: #000000; ">=</span><span style="color: #0000FF; ">fixed</span><span style="color: #000000; ">>></span><span style="color: #000000; ">(MAD_F_FRACBITS</span><span style="color: #000000; ">-</span><span style="color: #000000; ">15</span><span style="color: #000000; ">);<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">((signed </span><span style="color: #0000FF; ">short</span><span style="color: #000000; ">)</span><span style="color: #0000FF; ">fixed</span><span style="color: #000000; ">);<br />}<br /><br />unsigned </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> inputBuffer[</span><span style="color: #000000; ">4096</span><span style="color: #000000; "> </span><span style="color: #000000; ">+</span><span style="color: #000000; "> MAD_BUFFER_GUARD];<br /><br /></span><span style="color: #0000FF; ">class</span><span style="color: #000000; "> libMP3<br />{<br /></span><span style="color: #0000FF; ">public</span><span style="color: #000000; ">:<br />    libMP3(</span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">char</span><span style="color: #000000; ">*</span><span style="color: #000000; "> filename)<br />    {   <br />        file </span><span style="color: #000000; ">=</span><span style="color: #000000; "> fopen(filename,</span><span style="color: #000000; ">"</span><span style="color: #000000; ">rb</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        mad_stream_init(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">stream);<br />        mad_frame_init(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">frame);    <br />        mad_synth_init(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">synth);<br />        mad_timer_reset(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">timer);            <br />    }<br />    <br />    </span><span style="color: #000000; ">~</span><span style="color: #000000; ">libMP3()<br />    {<br />        mad_synth_finish(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">synth);<br />        mad_frame_finish(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">frame);<br />        mad_stream_finish(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">stream); <br />        fclose(file);            <br />    }   <br />    <br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> setup()<br />    {<br />        size_t    remaining;<br />        unsigned </span><span style="color: #0000FF; ">char</span><span style="color: #000000; ">*</span><span style="color: #000000; "> read;<br /><br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(stream.next_frame</span><span style="color: #000000; ">!=</span><span style="color: #000000; ">NULL)<br />        {<br />           remaining</span><span style="color: #000000; ">=</span><span style="color: #000000; ">stream.bufend</span><span style="color: #000000; ">-</span><span style="color: #000000; ">stream.next_frame;<br />           memmove(inputBuffer,stream.next_frame,remaining);<br />           read </span><span style="color: #000000; ">=</span><span style="color: #000000; "> inputBuffer</span><span style="color: #000000; ">+</span><span style="color: #000000; ">remaining;<br />           readsize </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">4096</span><span style="color: #000000; ">-</span><span style="color: #000000; ">remaining;<br />        }<br />        </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "><br />           readsize </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">4096</span><span style="color: #000000; ">,<br />        read </span><span style="color: #000000; ">=</span><span style="color: #000000; "> inputBuffer,<br />        remaining</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /><br />        readsize </span><span style="color: #000000; ">=</span><span style="color: #000000; "> fread(read,</span><span style="color: #000000; ">1</span><span style="color: #000000; ">,readsize,file);<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(readsize</span><span style="color: #000000; "><=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />        {</span><span style="color: #008000;"><br /></span><span style="color: #000000; ">           </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />        }<br />        <br />        mad_stream_buffer(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">stream,inputBuffer,readsize</span><span style="color: #000000; ">+</span><span style="color: #000000; ">remaining);<br />        </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> dest[</span><span style="color: #000000; ">100</span><span style="color: #000000; ">];<br />        mad_timer_string(timer, dest, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">%02lu:%02u:%02u</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, MAD_UNITS_HOURS, MAD_UNITS_MILLISECONDS, </span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br />        stream.error</span><span style="color: #000000; ">=</span><span style="color: #000000; ">(mad_error)</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;        <br />    }<br />    </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> readFrame(unsigned </span><span style="color: #0000FF; ">char</span><span style="color: #000000; ">*</span><span style="color: #000000; "> pcm)<br />    {<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(stream.buffer </span><span style="color: #000000; ">==</span><span style="color: #000000; "> NULL)<br />        {<br />           </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(setup() </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">) <br />               </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />        }<br />    </span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(mad_frame_decode(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">frame,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">stream) </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br />    {<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(MAD_RECOVERABLE(stream.error))<br />        {<br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(stream.error</span><span style="color: #000000; ">!=</span><span style="color: #000000; ">MAD_ERROR_LOSTSYNC)<br />            {</span><span style="color: #000000; "><br />            }<br />            </span><span style="color: #0000FF; ">continue</span><span style="color: #000000; ">;<br />        }<br />        </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "><br />            </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(stream.error</span><span style="color: #000000; ">==</span><span style="color: #000000; ">MAD_ERROR_BUFLEN)<br />            { </span><span style="color: #008000; "><br /></span><span style="color: #000000; ">                </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (setup() </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />                </span><span style="color: #0000FF; ">continue</span><span style="color: #000000; ">;<br />            }<br />            </span><span style="color: #0000FF; ">else</span><span style="color: #000000; "><br />            {<br />                </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />            }<br />    }<br />    mad_synth_frame(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">synth,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">frame);<br /><br />    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">! 鑾峰彇棰戠巼<br />    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">freq = synth.pcm.samplerate; <br />    <br />    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">bitrate = frame.header.bitrate;<br />    </span><span style="color: #008000; ">//</span><span style="color: #008000; ">channels = (frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2;</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">    <br />    mad_timer_add(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">timer,frame.header.duration);</span><span style="color: #000000; "><br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> j </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /> <br />    </span><span style="color: #0000FF; ">for</span><span style="color: #000000; ">(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> i</span><span style="color: #000000; ">=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">;i</span><span style="color: #000000; "><</span><span style="color: #000000; ">synth.pcm.length;i</span><span style="color: #000000; ">++</span><span style="color: #000000; ">)<br />    {<br />        signed </span><span style="color: #0000FF; ">short</span><span style="color: #000000; ">    sample;<br />        sample</span><span style="color: #000000; ">=</span><span style="color: #000000; ">to_short(synth.pcm.samples[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">][i]);<br />        pcm[j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">] </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sample</span><span style="color: #000000; ">&</span><span style="color: #000000; ">0xff</span><span style="color: #000000; ">;<br />        pcm[j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">] </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sample</span><span style="color: #000000; ">>></span><span style="color: #000000; ">8</span><span style="color: #000000; ">;<br />        </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(MAD_NCHANNELS(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">frame.header)</span><span style="color: #000000; ">==</span><span style="color: #000000; ">2</span><span style="color: #000000; ">)<br />            sample</span><span style="color: #000000; ">=</span><span style="color: #000000; ">to_short(synth.pcm.samples[</span><span style="color: #000000; ">1</span><span style="color: #000000; ">][i]);<br />        pcm[j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">] </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sample</span><span style="color: #000000; ">&</span><span style="color: #000000; ">0xff</span><span style="color: #000000; ">;<br />        pcm[j</span><span style="color: #000000; ">++</span><span style="color: #000000; ">] </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sample</span><span style="color: #000000; ">>></span><span style="color: #000000; ">8</span><span style="color: #000000; ">;<br />    }<br /><br />    </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> dest[</span><span style="color: #000000; ">120</span><span style="color: #000000; ">];<br />    mad_timer_string(timer,dest, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">%lu:%02lu.%03u</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, MAD_UNITS_MINUTES, MAD_UNITS_MILLISECONDS, </span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> j;        <br />    }<br /></span><span style="color: #0000FF; ">private</span><span style="color: #000000; ">:<br />    </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> mad_stream    stream;<br />    </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> mad_frame    frame;<br />    </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> mad_synth    synth;<br />    </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> mad_header   header;<br />    mad_timer_t            timer;    <br />    FILE</span><span style="color: #000000; ">*</span><span style="color: #000000; "> file;            <br />    </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> readsize;     <br />};<br /><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> argc, </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> </span><span style="color: #000000; ">**</span><span style="color: #000000; ">argv)<br />{       <br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> rate </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">44100</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> channels </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">2</span><span style="color: #000000; ">;<br /> <br />    unsigned </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> data[</span><span style="color: #000000; ">4096</span><span style="color: #000000; ">];<br />    ao_device </span><span style="color: #000000; ">*</span><span style="color: #000000; ">device;<br />    ao_sample_format format;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> default_driver;<br />    ao_initialize();<br /><br />    default_driver </span><span style="color: #000000; ">=</span><span style="color: #000000; "> ao_default_driver_id();<br />    memset(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">format,</span><span style="color: #000000; ">0</span><span style="color: #000000; ">,</span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(format));<br />    format.bits </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">16</span><span style="color: #000000; ">;<br />    format.channels </span><span style="color: #000000; ">=</span><span style="color: #000000; "> channels;<br />    format.rate </span><span style="color: #000000; ">=</span><span style="color: #000000; "> rate;<br />    format.byte_format </span><span style="color: #000000; ">=</span><span style="color: #000000; "> AO_FMT_LITTLE;<br />    <br />    libMP3 mp3(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">鎴戝彧鍦ㄤ箮浣?mp3</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />    <br />    device </span><span style="color: #000000; ">=</span><span style="color: #000000; "> ao_open_live(default_driver,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">format,NULL);<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(device </span><span style="color: #000000; ">==</span><span style="color: #000000; "> NULL) <br />    {<br />        fprintf(stderr,</span><span style="color: #000000; ">"</span><span style="color: #000000; ">error opening device.\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    }<br />    <br />    </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> len </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />    unsigned </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> buffer[</span><span style="color: #000000; ">4096</span><span style="color: #000000; ">*</span><span style="color: #000000; ">2</span><span style="color: #000000; ">];<br />    </span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(len </span><span style="color: #000000; ">=</span><span style="color: #000000; "> mp3.readFrame(buffer))<br />    {<br />        ao_play(device,(</span><span style="color: #0000FF; ">char</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)buffer,len);          <br />    }<br />    <br />    ao_close(device);<br />    ao_shutdown();<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> (</span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br />}</span></div><img src ="http://www.shnenglu.com/gaimor/aggbug/200905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gaimor/" target="_blank">ccsdu2009</a> 2013-06-09 21:14 <a href="http://www.shnenglu.com/gaimor/archive/2013/06/09/200905.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍙戜竴涓垜鍐欑殑闊抽搴?/title><link>http://www.shnenglu.com/gaimor/archive/2013/06/02/200755.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Sun, 02 Jun 2013 04:41:00 GMT</pubDate><guid>http://www.shnenglu.com/gaimor/archive/2013/06/02/200755.html</guid><wfw:comment>http://www.shnenglu.com/gaimor/comments/200755.html</wfw:comment><comments>http://www.shnenglu.com/gaimor/archive/2013/06/02/200755.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/gaimor/comments/commentRss/200755.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gaimor/services/trackbacks/200755.html</trackback:ping><description><![CDATA[<div>gaudio鏄竴涓嬌鐢ㄦ渶鏂逛究鐨勯煶棰戞挱鏀懼簱</div>淇敼璁板綍<br />1.2013.04.01<br />    鍒濇鍙戝竷<br />2.2013.04.10<br />    瀹屾垚瀵箇av鏍煎紡閲囨牱棰戠巼8000-48000,閲囨牱鏍煎紡4,8,16,24,32鐨勬敮鎸?    <br />3.2013.05.01<br />    a.鐗堟湰鎻愬崌涓?.4.0.8<br />    b.淇敼涓涓鍑哄紓甯?br />    c.鏀寔浜屾簮娣烽煶<br />    d.浣跨敤杞藉叆鎻掍歡鐨勬柟寮忔彁渚涘wav鎾斁鐨勬敮鎸?br />    e.澧炲姞瀵筧u鏍煎紡鐨勬敮鎸?br />    f.澧炲姞echo闊蟲晥<br />    g.澧炲姞bassboost闊蟲晥<br />    h.澧炲姞鍑芥暟gaudio_address_get<br />    i.澧炲姞浣跨敤渚嬪瓙:echo/mixer/stream/boost<br />    j.鎶婅緗?鑾峰彇闊蟲簮涓夌淮絀洪棿淇℃伅鐨勫嚱鏁拌皟鏁翠負: gaudio_source_set_float3,gaudio_source_get_float3<br />    k.淇敼瑙g爜鍣ㄧ粨鏋勪負鍥炶皟妯″紡<br />4.2013.05.10<br />    a.鐗堟湰鎻愬崌涓?.6.8.0<br />    b.浼樺寲閮ㄥ垎浠g爜<br />    c.澧炲姞speedchanger闊蟲晥<br />    d.澧炲姞闊抽緲昏漿(g168)<br />    e.澧炲姞闊抽澹伴亾浜ゆ崲(g168)<br />    f.澧炲姞澹伴亾鍚堝茍(g168)<br />    g.澧炲姞speedchanger/invert嫻嬭瘯鐢ㄤ緥<br />    h.澧炲姞vc璋冪敤闈欐侀摼鎺ュ簱libgaudio.lib<br />    i.澧炲姞璋冨埗闊蟲晥鍜屾祴璇曚緥瀛?br />    j.淇敼瑙g爜鍣ㄦ鏋?br />    k.淇敼鑾峰彇闊抽閲囨牱緙栫爜鏍煎紡涓嶆紜殑闂<br />    l.瑙e喅seek瀹氫綅涓嶅噯鐨勯棶棰?br />    m.澧炲姞闊蟲晥閾炬祴璇曚緥瀛?br />    n.澧炲姞鍑芥暟gaudio_set_long,gaudio_get_long<br />    o.淇敼stream渚嬪瓙<br />    p.鏀寔鍘嬬緝mpc闊抽鏍煎紡<br />    q.鏀寔ogg/vorbis鏍煎紡<br />    r.淇敼鑾峰彇閲囨牱鏍煎紡閿欒鐨刡ug<br />    t.澧炲姞鎺ュ彛璇存槑鏂囨。    <br />5.2013.06.01<br />    a.鐗堟湰鎻愬崌涓?.7.2.0<br />    b.gaudio_source_set_error_callback鍥炶皟鍑芥暟澧炲姞闊蟲簮鍙傛暟<br />    c.gaudio_source_set_finish_callback鍥炶皟鍑芥暟澧炲姞闊蟲簮鍙傛暟<br />    d.縐婚櫎gaudio_get_version鍑芥暟<br />    e.gaudio_effect_setcallback鍑芥暟璋冩暣涓篻audio_effect_set_callback<br />    f.浣跨敤鎻掍歡寮忕殑闊抽椹卞姩妯″紡(gwinmm)浠ユ柟渚挎敮鎸乴inux鍜宮ac<br />    g.gaudio浠g爜浼樺寲<br />    h.澧炲姞闊抽婧愮爜鐜囩殑鑾峰彇<br />    i.淇敼gfeature鑼冧緥<br />    j.瀹屽杽鏂囨。<br /><br />readmap<br />1.鏍煎紡:瀵筸p3鐨勬敮鎸?br />2.闊蟲晥:绔嬩綋澹板寮?br />3.澶勭悊鏁呴殰/浼樺寲浠g爜    <br /><br />target<br />1.鏀寔甯歌闊抽鏍煎紡<br />2.鏀寔甯歌闊蟲晥<br />3.鏀寔3D鎾斁妯″紡<br />4.鏈澶ф敮鎸?-8涓煶婧愬悓鏃舵挱鏀?br />5.鏀寔闊抽杞崲<br />6.鏀寔褰曢煶<br />7.鏀寔闊抽緹庡寲<br />8.璺ㄥ鉤鍙?nbsp;   <img src ="http://www.shnenglu.com/gaimor/aggbug/200755.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gaimor/" target="_blank">ccsdu2009</a> 2013-06-02 12:41 <a href="http://www.shnenglu.com/gaimor/archive/2013/06/02/200755.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>WAVPACK闊抽緙栫爜http://www.shnenglu.com/gaimor/archive/2013/02/09/197786.htmlccsdu2009ccsdu2009Sat, 09 Feb 2013 10:57:00 GMThttp://www.shnenglu.com/gaimor/archive/2013/02/09/197786.htmlhttp://www.shnenglu.com/gaimor/comments/197786.htmlhttp://www.shnenglu.com/gaimor/archive/2013/02/09/197786.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/197786.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/197786.html
  typedef int (*WavpackBlockOutput)(void *id, void *data, int32_t bcount);

where the "id" is used to differentiate the regular WavPack data "wv" from the correction data "wvc" (or for the case of multiple streams running at the same time). The return value is simply TRUE for success and FALSE for error. An example of this function can be found in wavpack.c called write_block().

The basic procedure for creating WavPack files is this:

  1. get a context and set block output function with WavpackOpenFileOutput()
  2. set the data format and specify modes with WavpackSetConfiguration()
  3. optionally write a RIFF header with WavpackAddWrapper()
  4. allocate buffers and prepare for packing with WavpackPackInit()
  5. actually compress audio and write blocks with WavpackPackSamples()
  6. flush final samples into blocks with WavpackFlushSamples()
  7. optionally write MD5 sum with WavpackStoreMD5Sum()
  8. optionally write RIFF trailer with WavpackAddWrapper()
  9. if MD5 sum or RIFF trailer written, call WavpackFlushSamples() again
  10. optionally append metadata tag with functions in next section
  11. optionally update number of samples with WavpackUpdateNumSamples()
  12. close the context with WavpackCloseFile()

Note that this does not show opening and closing the output files which is done by the application itself.

  WavpackContext *WavpackOpenFileOutput (WavpackBlockOutput blockout,void *wv_id, void *wvc_id);
  -----------------------------------------------------------------

Open context for writing WavPack files. The returned context pointer is used in all following calls to the library. The "blockout" function will be used to store the actual completed WavPack blocks and will be called with the id pointers containing user defined data (one for the wv file and one for the wvc file). A return value of NULL indicates that memory could not be allocated for the context.

  int WavpackSetConfiguration (WavpackContext *wpc,WavpackConfig *config,uint32_t total_samples);
  ----------------------------------------------------

Set configuration for writing WavPack files. This must be done before sending any actual samples, however it is okay to send wrapper or other metadata before calling this. The "config" structure contains the following *required* information:

 config->bytes_per_sample     see WavpackGetBytesPerSample() for info
 config->bits_per_sample      see WavpackGetBitsPerSample() for info
 config->channel_mask         Microsoft standard (mono = 4, stereo = 3)
 config->num_channels         self evident
 config->sample_rate          self evident

Be particularly careful with the "channel_mask" field. If this is not set to the correct value (3 or 4) then everything will still appear to work
correctly, but the resulting WavPack file will have undefined channel assignments. When this file is unpacked back to WAV it will then get a
WAVEFORMATEXTENSIBLE header which some programs refuse to recognize.

Specifying these 5 parameters alone would create a default lossless WavPack file, identical to the one produced by using the command-line program without options. For optional configuration, the following fields and flags may be set:

 config->flags:
 --------------
 o CONFIG_HYBRID_FLAG         select hybrid mode (must set bitrate)
 o CONFIG_JOINT_STEREO        select joint stereo (must set override also)
 o CONFIG_JOINT_OVERRIDE      override default joint stereo selection
 o CONFIG_HYBRID_SHAPE        select hybrid noise shaping (set override & shaping_weight != 0.0)
 o CONFIG_SHAPE_OVERRIDE      override default hybrid noise shaping (set CONFIG_HYBRID_SHAPE and shaping_weight)
 o CONFIG_DYNAMIC_SHAPING     force dynamic noise shaping even when WavPack
                               would not use it (no need to set any of the
                               other shaping flags when using this one)
 o CONFIG_FAST_FLAG           "fast" compression mode (same as -f)
 o CONFIG_HIGH_FLAG           "high" compression mode (same as -h)
 o CONFIG_VERY_HIGH_FLAG      "very high" compression mode (same as -hh)
 o CONFIG_BITRATE_KBPS        hybrid bitrate is kbps, not bits / sample
 o CONFIG_CREATE_WVC          create correction file
 o CONFIG_OPTIMIZE_WVC        maximize bybrid compression (same as -cc)
 o CONFIG_CALC_NOISE          calc noise in hybrid mode
 o CONFIG_EXTRA_MODE          extra processing mode (same as -x)
 o CONFIG_SKIP_WVX            no wvx stream for floats & large ints (same as -p)
 o CONFIG_MD5_CHECKSUM        specify if you plan to store MD5 signature (the sum is calculated by the application, NOT by the library)
 o CONFIG_CREATE_EXE          specify if you plan to prepend sfx module
 o CONFIG_OPTIMIZE_MONO       detect and optimize for mono files posing as
                               stereo (uses a more recent stream format that
                               is not compatible with decoders < 4.3)

 config->bitrate              hybrid bitrate in either bits/sample or kbps
 config->shaping_weight       hybrid noise shaping coefficient override
 config->block_samples        force samples per WavPack block (0 = use default, else 1-131072)
 config->float_norm_exp       select floating-point data (127 for +/-1.0)
 config->xmode                extra mode processing value override (1-6)

If the number of samples to be written is known then it should be passed here.
If the duration is not known then pass -1. In the case that the size is not
known (or the writing is terminated early) then it is suggested that the
application retrieve the first block written and let the library update the
total samples indication. A function is provided to do this update and it
should be done to the "correction" file also. If this cannot be done (because
a pipe is being used, for instance) then a valid WavPack will still be created
(assuming the initial duration was set to -1), but when applications want to
access that file they will have to seek all the way to the end to determine the
actual duration (the library takes care of this). Also, if a RIFF header has
been included then it should be updated as well or the WavPack file will not be
directly unpackable to a valid wav file (although it will still be usable by
itself). A return of FALSE indicates an error (use WavpackGetErrorMessage() to
find out what happened).

  int WavpackPackInit (WavpackContext *wpc);
  -----------------------------------------

Prepare to actually pack samples by determining the size of the WavPack blocks
and allocating sample buffers and initializing each stream. Call after
WavpackSetConfiguration() and before WavpackPackSamples(). A return of FALSE
indicates an error.

  int WavpackPackSamples (WavpackContext *wpc,
                          int32_t *sample_buffer,
                          uint32_t sample_count);
  ----------------------------------------------

Pack the specified samples. Samples must be stored in 32-bit longs in the
native endian format of the executing processor. The number of samples specified
indicates composite samples (sometimes called "frames"). So, the actual number
of data points would be this "sample_count" times the number of channels. Note
that samples are accumulated here until enough exist to create a complete
WavPack block (or several blocks for multichannel audio). If an application
wants to break a block at a specific sample, then it just calls
WavpackFlushSamples() to force an early termination. Completed WavPack blocks
are sent to the function provided in the initial call to
WavpackOpenFileOutput(). A return of FALSE indicates an error (which most likely
indicates the that user-supplied blockout function returned an error).

  int WavpackFlushSamples (WavpackContext *wpc);
  ---------------------------------------------

Flush all accumulated samples into WavPack blocks. This is normally called after
all samples have been sent to WavpackPackSamples(), but can also be called to
terminate a WavPack block at a specific sample (in other words it is possible
to continue after this operation). This also must be called to dump non-audio
blocks like those holding metadata for MD5 sums or RIFF trailers. A return of
FALSE indicates an error.

  void WavpackUpdateNumSamples (WavpackContext *wpc, void *first_block);
  ---------------------------------------------------------------------

Given the pointer to the first block written (to either a .wv or .wvc file),
update the block with the actual number of samples written. If the wav header
was generated by the library, then it is updated also. This should be done if
WavpackSetConfiguration() was called with an incorrect number of samples (or
-1). This should also be done in the case where the application did not provide
the RIFF header but did add some chunks for a RIFF trailer (see the section
on adding RIFF metadata). It is the responsibility of the application to read
and rewrite the block. An example of this can be found in the Audition filter
or in the command-line packer when the -i option is used. ON MACHINES WITH
ALIGNMENT REQUIREMENTS, BE SURE THAT THE PASSED POINTER IS PROPERLY ALIGNED!

  int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16]);
  -------------------------------------------------------------

Store computed MD5 sum in WavPack metadata. Note that the user must compute the
16 byte sum; it is not done here. It is also required that WavpackFlushSamples()
be called after this to make sure the block containing the MD5 sum is actually
written. A return of FALSE indicates an error.

  WavpackContext *WavpackCloseFile (WavpackContext *wpc);
  ------------------------------------------------------

Close the specified WavPack file and release all resources used by it.
Returns NULL.


With respect to the RIFF WAV wrapper that is inormally appended to the WavPack
file, there are three options available for the application to handle this.

The first is the simplest, and that is for the application to simply do
nothing. The library will automatically create a RIFF header appropriate for
the audio data (including WAVEFORMATEXTENSIBLE if needed) and store this
in the WavPack file. If the application does not know the actual number of
samples beforehand and needs to reread the first block and have the library
update it, then the library will handle updating its own RIFF header also.
In this scenario, there will be no trailing RIFF data. For the vast majority
of applications, this will be all that is required.

However, some applications may want to store a custom RIFF header (and trailer)
so that they can store extra RIFF chunks in there or perhaps they want to
create an exact copy of a .wav file (like the WavPack command-line program
does). To accomplish this, functions are provided (see below) to add RIFF
metadata to a WavPack file being written. In this case, the application must
provide a verbatim copy of all the RIFF data from the initial "RIFF" at the
beginning of the file up to (and including) the size field of the "data"
chunk. If any trailing RIFF data is desired, then this is appended after all
samples have been packed and flushed. This wrapper data will be *exactly*
what wvunpack will use to restore an original WAV file. In no circumstances
does the WavPack library parse, verify, or otherwise use this data.

If the RIFF header information needs to be updated after packing (because the
total file size or the data chunk size need to be update) then the first
block must be reread and the function WavpackGetWrapperLocation() must be
called to find the wrapper in the block (it would be possible to find it by
searching for the "RIFF", but using this function is significantly less ugly).
The WavPack library will not touch a wrapper that it did not create when
calling WavpackUpdateNumSamples().

The third option for including RIFF data chunks is a hybrid between these
two methods and is useful if an application wants to add a few specific RIFF
chunks and does not mind if the chunks appear at the end of the WAV file. In
this method, the application does not send any RIFF header before packing the
audio data which forces the library to create and store a standard RIFF header.
However, when all samples have been packed, the application sends the RIFF
chunks that it wants to add at the end of the file (RIFF trailer). Then, after
flushing, it must reread the first block and call WavpackUpdateNumSamples() so
that the library can update the RIFF header to reflect the added chunks (even
if the number of samples was correct). Because the library created the header,
it will update it, and will take into account the RIFF chunks added to the end.

All of this wrapper stuff can be a little confusing. It is a good idea to
test that the final application is working correctly and creating WavPack
files that will unpack to valid WAV files (even if the RIFF info is totally
wrong, the files will still work perfectly well as WavPack files because,
again, the RIFF wrapper is just informational). The first test is to use the
-ss option on WvUnpack to make sure the RIFF wrapper is reported correctly.
Then, unpack the WavPack file into a WAV using WvUnpack and repack it again
with the standard WavPack command-line program (without options). If it
doesn't complain about anything then there is a good chance that all the
wrapper information is valid.

Here are the appropriate functions:

  int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount);
  ------------------------------------------------------------------------

Add wrapper (currently RIFF only) to WavPack blocks. This should be called
before sending any audio samples in the case of the RIFF header or after all
samples have been sent (and flushed) for any RIFF trailer. It is also
required that WavpackFlushSamples() be called again after specifying a RIFF
trailer to make sure it is actually written to the file.

If the exact contents of the RIFF header are not known because, for example,
the file duration is uncertain or trailing chunks are possible, simply write
a "dummy" header of the correct length. When all data has been written it
will be possible to read the first block written and update the header
directly. An example of this can be found in the Audition filter. A return of
FALSE indicates an error.

  void *WavpackGetWrapperLocation (void *first_block, uint32_t *size);
  -------------------------------------------------------------------

Given the pointer to the first block written to a WavPack file, this function
returns the location of the stored RIFF header that was originally written with
WavpackAddWrapper(). This would normally be used to update the wav header to
indicate that a different number of samples was actually written or if
additional RIFF chunks are written at the end of the file. The "size" parameter
can be set to non-NULL to obtain the exact size of the RIFF header, and the
function will return FALSE if the header is not found in the block's metadata
(or it is not a valid WavPack block). Note that the size of the RIFF header
cannot be changed and it is the responsibility of the application to read and
rewrite the block. An example of this can be found in the Audition filter.


******************************************************************************
*************************   5.0 TAGGING FUNCTIONS   **************************
******************************************************************************

The WavPack library contains rudimentary support to read and write metadata tags
on WavPack files. This includes creating new APEv2 tags during WavPack file
creation, reading text fields from both ID3v1 and APEv2 tags on existing
WavPack files, and editing data in APEv2 tags.

Users should be aware of the following limitations of this functionality:

1. ID3v1 tags are read-only, and cannot be accessed if there is an APEv2 tag
   prior to them in the file. ID3v1 tags are lost if the prior APEv2 tag is
   edited.

2. The text items in APEv2 tags are UTF-8 encoded. The functionality of
   converting to/from any local or multi-byte encoding must be handled by the
   calling application.

3. The binary items of APEv2 tags can now (version 4.60+) be read and written.
   To implement this in a backward-compatible way, the existing functions for
   accessing text tag items were simply duplicated as versions handling only
   binary tags items. The versions for text tag items work exactly as before
   (ignoring binary items) and the binary versions ignore text items.

   The convention for binary tag items in APEv2 tags is that the data starts
   with a NULL-terminated string representing a filename. After the terminating
   NULL, the actual binary data starts. In the WavPack code this filename has
   only the extension of the actual file; the name portion is made up of the
   tag item name. NOTE THAT THIS FUNCTIONALITY IS NOT HANDLED IN THE LIBRARY.
   THE LIBRARY ONLY STORES AND RETRIEVES A BINARY IMAGE AND IT IS UP TO THE
   CALLING APPLICATION TO APPEND AND HANDLE THIS FILENAME.

4. When APEv2 tags are edited and the resulting tags are shorter than the
   original tags, the tag is padded with zeros at the front rather than having
   the file shortened, and this padding cannot be reclaimed by future editing.
   The net result of this is that repeated editing of tags will cause the file
   to grow indefinitely (although this will only happen when the tag is
   actually made smaller).

In these descriptions the meaning of the word "tag" refers to the whole bundle
that is appended to the end of the WavPack file. This bundle may contain many
individual items, each consisting of a key/value pair. The key is referred to
here as the "item", meaning the item's name (like "artist"). Some people refer
to the individual items as "tags", but that usage is not used here. Also note
that APEv2 tags store the case of tag item names and values, but are not case
sensitive when locating tag item names (and this is carried here into the
lookup of ID3v1 tag item names).


  int WavpackGetNumTagItems (WavpackContext *wpc);
  int WavpackGetNumBinaryTagItems (WavpackContext *wpc);
  ------------------------------------------------------

Count and return the total number of tag items (either text or binary) in the
specified file. This works with either ID3v1 tags or APEv2 tags (although ID3V1
tags do not have binary items).

  int WavpackGetTagItem (WavpackContext *wpc,
                         const char *item,
                         char *value,
                         int size);

  int WavpackGetBinaryTagItem (WavpackContext *wpc,
                               const char *item,
                               char *value,
                               int size)
  ------------------------------------------------------------

Attempt to get the specified item from the specified file's ID3v1 or APEv2 tag.
The "size" parameter specifies the amount of space available at "value", if the
desired text item will not fit in this space then ellipses (...) will be
appended and the string terminated (binary tag data is simply truncated). The
actual length of the string (or binary data) is returned (or 0 if no matching
value found). Note that with APEv2 text tags the length might not be the same
as the number of characters because UTF-8 encoding is used. Also, APEv2 text
tags can have multiple (NULL separated) strings for a single value (this is why
the length is returned). If this function is called with a NULL "value" pointer
(or a zero "length") then only the actual length of the value data is returned
(not counting the terminating NULL of text tag items). This can be used to
determine the actual memory to be allocated beforehand.

For ID3v1 tags the only "item" names supported are "title", "artist", "album",
"year", "comment" and "track" (which is converted to numeric text by the
library).

  int WavpackGetTagItemIndexed (WavpackContext *wpc,
                                int index,
                                char *item,
                                int size);

  int WavpackGetBinaryTagItemIndexed (WavpackContext *wpc,
                                      int index,
                                      char *item,
                                      int size);
  -------------------------------------------------

This function looks up the tag item name by index and is used when the
application wants to access all the items in the file's ID3v1 or APEv2 tag.
Note that this function accesses only the item's name; WavpackGetTagItem()
still must be called to get the actual value. The "size" parameter specifies
the amount of space available at "item", if the desired item will not fit in
this space then ellipses (...) will be appended and the string terminated.
The actual length of the string is returned (or 0 if no item exists for index).
If this function is called with a NULL "value" pointer (or a zero "length")
then only the actual length of the item name is returned (not counting the
terminating NULL). This can be used to determine the actual memory to be
allocated beforehand.

  int WavpackAppendTagItem (WavpackContext *wpc,
                            const char *item,
                            const char *value,
                            int vsize);

  int WavpackAppendBinaryTagItem (WavpackContext *wpc,
                                  const char *item,
                                  const char *value,
                                  int vsize);
  ---------------------------------------------

This function is used to append (or replace) the specified field to the tag
being created or edited. If no tag has been started, then an empty one will be
allocated first. When finished adding all the items to the tag, use
WavpackWriteTag() to write the completed tag to the file. Note that ID3 tags
are not supported. A size parameter is included so that text values containing
multiple (NULL separated) strings (and binary data) can be written. A FALSE
return indicates an error.

  int WavpackDeleteTagItem (WavpackContext *wpc, const char *item);
  ----------------------------------------------------------------

Delete the specified tag item from the APEv2 tag being created or edited. This
function works with either text or binary fields. Returns TRUE to indicate that
an item was actually deleted from the tag.

  int WavpackWriteTag (WavpackContext *wpc);
  -----------------------------------------

Once a APEv2 tag has been created (or edited) using WavpackAppendTagItem()
(and WavpackDeleteTagItem()), this function is used to write the completed tag
to the end of the WavPack file. Note that this is NOT done for EACH item in the
tag, but only after ALL items have been added to the tag.

If this function is called when creating a WavPack file, then it uses the same
"blockout" function that is used to write regular WavPack blocks (and should be
called after flushing all the audio data and writing any WavPack metadata like
RIFF trailers and MD5 sums). It may call the blockout function multiple times
to write the tag.

If this function is called when editing an existing APEv2 tag, then it will
seek to the correct position and write the tag using the WavpackStreamReader
function that has been added for this purpose (write_bytes) or using its
own standard I/O functions (if the WavpackStreamReader is not being used).
Because there is not currently a method implemented to truncate an existing
file to a shorter length, this function will pad the file with 0's in front
of a tag that had been edited to a shorter length.


******************************************************************************
**********************   6.0 HANDLING WAVPACK STREAMS   **********************
******************************************************************************

In some applications (for example streaming applications and some filters, or
cases where WavPack data might be embedded into another multimedia container)
it is required for the audio file parsing functions to be separated from the
decoding functions. This is accomplished in two steps with the WavPack library.

First, the parsing functions are implemented outside the WavPack library. It is
very straightforward to parse WavPack files because the WavPack block header is
easy to recognize, and contains easy to parse and interpret information about
the block's contents and its relation to the whole WavPack file (or stream). The
exact file and block formats are described in detail in the file_format.txt
document. The wputils.c module also contains helper functions and a useful
seeking function that may also be useful in creating a WavPack parser.

Next, the individual parsed blocks are decoded to PCM audio by the library. To
accomplish this a "file" is opened with WavpackOpenFileInputEx() where the
specified WavpackStreamReader is a function that will feed the raw WavPack
block's bytes into the library when requested. The flags parameter should have
the OPEN_STREAMING bit set so that the decoder will ignore the position and any
other "whole file" information in the block headers. The decoder will suck up
the first block (through the stream reader) that actually contains audio and
stop, ready to decode. The next step is to call WavpackUnpackSamples() to
unpack the actual number of samples in the block (which should be known by the
parser).

Normally, the entire block would be unpacked and then the decoder would be
ready for the next block. If a single additional sample is requested past the
size of the current block the decoder will attempt to read the next block, so
it is important to request the exact number of samples (unless this behavior is
okay). If it is not desired to finish decoding the block then there are two
options. The easiest would be to simply decode the rest of the block anyway and
discard the results. Another option would be to close the context with the
function WavpackCloseFile() and then open another context when needed.

This procedure will also work fine for multichannel WavPack files. The decoder
will have to suck up all the blocks for the various channels before decoding may
begin.


******************************************************************************
**************************   7.0 ZIP FORMAT USAGE   **************************
******************************************************************************

With version 11.0, WinZip Computing has added WavPack Audio to the official ZIP
file format standard as compression method 97, as described here:

    http://www.winzip.com/ppmd_info.htm

The WavPack library can easily be used to create or decode the WavPack images
stored in the ZIP files. Some issues to keep in mind:

1. Only lossless mode is used. WinZip's implementation uses the "very high"
   mode with no extra processing, although there is no reason that a different
   profile could not be employed as they would still be fully compatible (for
   example, the new "high" mode and/or the new "extra" mode could be used).

2. All bitdepths (including 32-bit floating-point) are supported. However,
   bitdepths that are not multiples of 8 should be rounded up to the next
   multiple of 8 to ensure that all samples (even illegal ones) are encoded
   losslessly (this is described in more detail in the WinZip document).

3. Multichannel data (with or without WAVEFORMATEXTENSIBLE) is fully supported.

4. CONFIG_OPTIMIZE_MONO is not available during decoding and therefore should
   not be used for encoding.

5. The WavPack data must have RIFF headers (to generate .wav files) and may
   optionally have RIFF trailers. It would not be appropriate to have WavPack
   generate the RIFF headers (either during encode or decode) because of the
   obvious danger of generating files that don't match exactly.

6. The WavPack data should probably NOT have metadata tags or MD5 sums added
   to it. This information would be discarded during decoding anyway and could
   possibly trigger an error condition in a decoder.

The easiest way of using the WavPack library to decode the embedded WavPack
data would be to open a WavPack context using WavpackOpenFileInputEx() and
provide a WavpackStreamReader that would read the appropriate part of the
ZIP file by using an offset. If only the standard unpacking operations are
used, then the WavPack library will not attempt to seek during a decode. The
only flag to use for the "open" call would be OPEN_WRAPPER.

The most critical aspect of creating WavPack images to embed in ZIP files is
making sure that the decoded data will exactly match the source. This is in
contrast to the case of WavPack command-line programs where some invalid WAV
files may not encode (or exactly decode) for one reason or another. For this
reason it is important to check the parameters in the WAV header carefully and
allow only a well-defined set of known good combinations. The size of the audio
data should be checked to make sure it contains the correct number of whole
composite samples (or if it doesn't then this is properly handled). Since
WavPack cannot properly decode WavPack files that contain no audio data (i.e.
zero samples), this case should also be avoided. In all situations where some
question exists, the prudent choice would be to default to some other (more
genereralized) data compression method.


ccsdu2009 2013-02-09 18:57 鍙戣〃璇勮
]]>
姝g‘鐨刦fmpeg閾炬帴嬈″簭http://www.shnenglu.com/gaimor/archive/2012/12/29/196818.htmlccsdu2009ccsdu2009Sat, 29 Dec 2012 13:33:00 GMThttp://www.shnenglu.com/gaimor/archive/2012/12/29/196818.htmlhttp://www.shnenglu.com/gaimor/comments/196818.htmlhttp://www.shnenglu.com/gaimor/archive/2012/12/29/196818.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/196818.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/196818.htmllibavcodec
libavutil

ccsdu2009 2012-12-29 21:33 鍙戣〃璇勮
]]>
FFmpeg windows騫沖彴緙栬瘧 - 杞澆http://www.shnenglu.com/gaimor/archive/2012/12/29/196815.htmlccsdu2009ccsdu2009Sat, 29 Dec 2012 11:53:00 GMThttp://www.shnenglu.com/gaimor/archive/2012/12/29/196815.htmlhttp://www.shnenglu.com/gaimor/comments/196815.htmlhttp://www.shnenglu.com/gaimor/archive/2012/12/29/196815.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/196815.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/196815.htmlFFmpeg鏄湪Linux騫沖彴涓嬪紑鍙戠殑錛屼絾瀹冨悓鏍蜂篃鍙互鍦ㄥ叾瀹冩搷浣滅郴緇熺幆澧冧腑緙栬瘧榪愯錛屾湰鏂囦粙緇嶇殑灝辨槸鍦╳indowsXP涓嬬紪璇慒Fmpeg銆?/span>
涓 鍑嗗鐜錛?/span>

1 涓嬭澆 mingw 鍜?MSYS

鍘?http://sourceforge.net/projects/mingw/  涓嬭澆

A 鐐瑰嚮“DownLoad mingw-get-inst-...exe”錛?/span>

B 鍒囨崲鍒伴〉闈細download? Check your browser's security bar, or try a direct link, or try another mirror. 錛?/span>

C 鐐瑰嚮“direct link”涓嬭澆綾諱技錛歮ingw-get-inst-20110802.exe 鐨勬枃浠躲?/span>

鎻愮ず錛歮sys姝ゅ灝變笉鐢ㄤ笅杞戒簡錛宮ingw-get-inst-20110802.exe 涓凡緇忓寘鍚簡msys1.0,鍚庨潰瀹夎鐨勬椂鍊欏氨鍙互鐪嬪埌璇ラ夐」銆?/span>

2 涓嬭澆 yasm

ffmpeg緙栬瘧閲岄潰鐨勬眹緙栦唬鐮侀渶瑕亂asm.exe  

鍘誨畼緗戯細http://yasm.tortall.net/Download.html 涓嬭澆

鐩存帴涓嬭澆錛歐in32 .exe (for general use on 32-bit Windows)

鏂囦歡鍚嶄負錛歽asm-1.1.0-win32.exe

3 涓嬭澆 ffmpeg

ffmpeg鍙互鍒?http://www.ffmpeg.org/releases/ 涓嬭澆

鏈漢閫夋嫨鐨勬槸鏈鏂扮増鏈細ffmpeg-0.8.5.tar.gz

鏂囦歡鍚嶄負錛歠fmpeg-0.8.5.tar.gz

4 涓嬭澆 SDL

SDL涓嬭澆鍙互鍒幫細http://www.libsdl.org/download-1.2.php

閫夋嫨錛歋DL-1.2.14.tar.gz - GPG signed

姝ょ増鏈渶瑕佽嚜宸辯紪璇戯紝鍚庨潰浼氳В閲婁負浠涔堜笅杞借鐗堟湰錛岃屼笉涓嬭澆緙栬瘧濂界殑SDL-devel-1.2.14-mingw32.tar.gz (Mingw32)

5 涓嬭澆 pthreadGC2.dll
pthreadgc2.dll 鏄姛鑳藉己澶х殑澶勭悊鏁板瓧鍖栧獎瑙嗕綔鍝佺紪杈戣蔣浠秔remiere6榪愯鎵闇鐨勪竴涓狣LL鏂囦歡銆傝繖鏄竴涓棤濞佽儊鏂囦歡銆傚睘浜嶰pen Source Software community project鐨勬枃浠躲傜洿鎺ュ幓baidu.com涓夋悳绱笅杞藉氨鍙互浜嗐?/span>

浜?緙栬瘧姝ラ

1 瀹夎 mingw 鍜?msys

    鎵ц涓嬭澆鏂囦歡錛歮ingw-get-inst-20110802.exe錛?/span>

    鍦ㄧ3姝ラ夋嫨“Download latest repository catalogues”

    閫夋嫨瀹夎璺緞錛欳:\MinGW錛堟垜鐩存帴閲囩敤榛樿璺緞錛屾湭鍋氫慨鏀癸級

    鍦?#8220;Select Components”姝ラ涓夋嫨錛?/span>

    √  C Compiler (榛樿涓斾竴瀹氶夋嫨)

    √  C++ Compiler

    √  MSYS Basic System錛堥夋嫨姝ら」灝嗕細瀹夎msys錛宮sys鍒欎笉闇瑕佸彟澶栧畨瑁咃級

    √  MinGW Developer ToolKit

    絳夊緟瀹夎瀹屾垚錛侊紙闇瑕佺瓑寰呬竴瀹氱殑鏃墮棿錛屽洜涓哄畨瑁呰繃紼嬮渶瑕佷笅杞芥枃浠訛紝鍙兂鑰岀煡錛岀綉閫熻秺蹇紝瀹夎瓚婂揩錛?/span>

    瀹夎瀹屾垚鍚庯紝鍦–:\MinGW鐩綍涓嬪彲浠ョ湅鍒?msys 鏂囦歡澶癸紝msys涔熷凡緇忓畨瑁呫?/span>

2 閰嶇疆 msys.bat 鎵瑰鐞嗘枃浠?/span>

    涓轟簡鏂逛究VS200X浠ュ強VS2010璋冪敤ffmpeg鐨勫姩鎬佸簱錛屽彲浠ラ氳繃閰嶇疆璁ゝfmpeg緙栬瘧鏃朵駭鐢焪indows涓嬭皟鐢╠ll瀵瑰簲鐨刲ib錛屽綋鐒訛紝濡傛灉浣犳病鏈夎繖涓渶瑕侊紝閭d箞灝卞彲浠ョ渷鐣ヤ互涓嬪鐞嗭紝鐩存帴榪涘叆姝ラ3銆?/span>

    榪涘叆錛欳:\MinGW\msys\1.0\鏂囦歡澶癸紝浣跨敤UltraEdit鎵撳紑msys.bat鏂囦歡錛屽湪鏂囦歡鐨勬渶鏈鍓嶉潰鍔犲叆濡備笅涓琛岋細

    call "D:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"

    鍏朵腑“D:\Program Files\Microsoft Visual Studio 10.0”涓轟綘鏈哄櫒涓婂畨瑁匳S200X鎴朧S2010鐨勭洰褰曪紝鎴戠殑鐢佃剳瀹夎鐨勬槸VS2010錛屽茍涓斿畨瑁呭湪浜咲鐩樸傛枃浠朵慨鏀瑰悗淇濆瓨鍗沖彲銆?/span>

3 閰嶇疆 yasm

    涓轟簡鍑忓皯閰嶇疆鐜鍙橀噺鐨勯夯鐑︼紝鏈鐩存帴鎶?yasm-1.1.0-win32.exe 鏂囦歡鍚嶄慨鏀規垚錛歽asm.exe錛屽茍鏀懼埌緋葷粺鐩綍涓嬶細C:\WINDOWS\system32銆?/span>

4 瑙e帇ffmpeg 涓?SDL

    ffmpeg-0.8.5.tar.gz 鐨勮В鍘嬬洰褰曟偍鍙互鐩存帴閫夋嫨錛屾湰浜鴻В鍘嬪埌錛欴:\ffmpeg涓紝瑙e帇鍚庣洰褰曚負錛欴:\ffmpeg\ffmpeg-0.8.5

    SDL-1.2.14.tar.tar 瑙e帇鍒?D:\ffmpeg\ffmpeg-0.8.5 鐩綍涓嬶紝瑙e帇鍚庣殑鐩綍緇撴瀯涓猴細D:\ffmpeg\ffmpeg-0.8.5\SDL-1.2.14

5 緙栬瘧SDL

    鍙屽嚮“C:\MinGW\msys\1.0\msys.bat”錛屽惎鍔?#8220;MinGW32”錛?/span>

    鍒囨崲鍒癝DL鐩綍錛欴:\ffmpeg\ffmpeg-0.8.5\SDL-1.2.14錛屽垏鎹㈡柟娉曞涓嬶細

    $ cd /d

    $ cd ffmpeg

    $ cd ffmpeg-0.8.5

    $ cd SDL-1.2.14

    鍐嶆墽琛屼互涓嬪懡浠わ細

    $ ./configure --prefix=/usr 鍥炶濺絳夊緟…

    $ Make 鍥炶濺絳夊緟…

    $ make install 鍥炶濺絳夊緟…

    緙栬瘧瀹屾垚鍚庯紝鍦–:\MinGW\msys\1.0鐨刡in銆乮nclude鍜宭ib鏂囦歡澶逛笅鍙互鐪嬪埌緙栬瘧緇撴灉銆?/span>

    鐩存帴緙栬瘧ffmpeg鏃訛紝鍙戠幇鏈敓鎴恌fplay.exe錛?/span>

    configure鐨勬椂鍊欐彁紺轟俊鎭涓嬶細

    SDL support  no

    鎵浠ラ渶瑕佸紑鍚疭DL錛屾湰浜哄ご澶╂帴瑙﹁繖涓滆タ錛屼笉鐭ラ亾浣跨敤浠涔堟柟娉曞彲浠ュ紑鍚紝浣嗛氳繃緙栬瘧SDL鍚?/span>

    SDL support  yes

    濡傛灉浣犵殑 SDL 宸茬粡鏄紑鍚姸鎬侊紝浣犲彲浠ョ洿鎺ヤ嬌鐢ㄤ笅杞戒腑鎻愬埌鐨勭紪璇戝ソ鐨勫帇緙╁寘SDL-devel-1.2.14-mingw32.tar.gz錛岀洿鎺ヨВ鍘嬶紝騫舵妸瑙e帇鍖呬腑鐨?bin銆乮nclude鍜宭ib鏂囦歡澶逛腑鐨勬枃浠跺鍒跺埌D:\ffmpeg\ffmpeg-0.8.5錛屼笌姝ラ鍏浉鍚岋紝鍙槸涓嶅湪浠嶤:\MinGW \msys\1.0涓鍒躲?/span>

6 鎷瘋礉緙栬瘧緇撴灉錛?/span>

    C:\MinGW\msys\1.0  鍒?c:/mingw涓?瑕嗙洊

    bin涓嬬殑SDL.dll銆乻dl-config鎷瘋礉鍒?bin涓?/span>

    include涓嬬殑 SDL鏂囦歡澶規嫹璐濆埌 include涓?/span>

    lib涓嬬殑libSDL.a銆乴ibSDL.dll.a銆乴ibSDL.la鍜宭ibSDLmain.a鎷瘋礉鍒?lib涓?/span>

7 淇敼sdl-config閰嶇疆鏂囦歡

    浣跨敤UltraEdit鎵撳紑D:\ffmpeg\ffmpeg-0.8.5\bin涓嬬殑 sdl-config鏂囦歡

    鎶?prefix=/usr 璇ユ垚錛?prefix=c:/mingw

    鍏朵腑錛歝:/mingw 涓?mingw鐨勫畨瑁呰礬寰勶紝璇鋒牴鎹綘鐨勫畨瑁呰繘琛屼慨鏀廣?/span>

8 緙栬瘧 ffmpeg

    鍙屽嚮“C:\MinGW\msys\1.0\msys.bat”錛屽惎鍔?#8220;MinGW32”錛?/span>

    鍒囨崲鍒癝DL鐩綍錛欴:\ffmpeg\ffmpeg-0.8.5\SDL-1.2.14錛?/span>

    鍒囨崲鏂規硶濡備笅錛?/span>

    $ cd /d

    $ cd ffmpeg

    $ cd ffmpeg-0.8.5

    濡傛灉浣犵殑“MinGW32”娌℃湁鍏抽棴錛屽彲浠ョ洿鎺ュ垏鎹㈣礬寰勫埌錛欴:\ffmpeg\ffmpeg-0.8.5銆?/span>

    鍐嶆墽琛屼互涓嬪懡浠わ細

    $ ./configure --enable-shared --disable-static --enable-memalign-hack

    璇瘋愬績絳夊緟涓孌墊椂闂?/p>

  $ make

   闇瑕佺瓑寰呭緢闀夸竴孌墊椂闂達紝絳夊緟緙栬瘧緇撴潫銆?/p>
    涓轟簡姹囨葷紪璇戠粨鏋滐紝璇風戶緇墽琛屼互涓嬪懡浠わ細

    $ make install

    絳夊緟瀹屾垚錛屽湪C:\MinGW\msys\1.0\local涓皢浼氱敓鎴?bin銆乮nclude銆乴ib絳夋枃浠跺す錛屽叾涓寘鍚簡ffmpeg.exe銆乫fplay.exe銆乫fprobe.exe銆乨ll銆乴ib鍜屽ご鏂囦歡絳夈?/span>

9 榪愯嫻嬭瘯

鐩存帴鍙屽嚮榪愯”ffplay.exe”錛屽鏋滄彁紺烘病鏈?#8220;pthreadGC2.dll”鏂囦歡錛屼綘鍙互鍖?#8220;pthreadGC2.dll”鐩存帴鎷瘋礉鍒板綋鍓嶇洰褰曪紝涔熷彲鏀懼埌緋葷粺鐩綍C:\WINDOWS\system32涓?/span>
avcodec.lib avformat.lib swscale.lib avutil.lib

ccsdu2009 2012-12-29 19:53 鍙戣〃璇勮
]]>
闊抽娣烽煶http://www.shnenglu.com/gaimor/archive/2012/06/05/177686.htmlccsdu2009ccsdu2009Tue, 05 Jun 2012 11:15:00 GMThttp://www.shnenglu.com/gaimor/archive/2012/06/05/177686.htmlhttp://www.shnenglu.com/gaimor/comments/177686.htmlhttp://www.shnenglu.com/gaimor/archive/2012/06/05/177686.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/177686.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/177686.html絎竴縐嶆槸
閽堝杈撳叆鐨勬暟鎹畁 bite鏁版嵁A,B姣斿short綾誨瀷
If both A and B are negative Y = A + B - (A * B / (-(2 pow(n-1) -1))) 
Else Y = A + B - (A * B / (2 pow(n-1))
鍙﹀涓縐嶅姙娉曟槸閲囩敤鏃墮棿鐗囦氦鏇跨殑鏂瑰紡


ccsdu2009 2012-06-05 19:15 鍙戣〃璇勮
]]>
浣跨敤libao搴撴挱鏀鵑煶涔?/title><link>http://www.shnenglu.com/gaimor/archive/2012/03/20/168444.html</link><dc:creator>ccsdu2009</dc:creator><author>ccsdu2009</author><pubDate>Tue, 20 Mar 2012 14:38:00 GMT</pubDate><guid>http://www.shnenglu.com/gaimor/archive/2012/03/20/168444.html</guid><wfw:comment>http://www.shnenglu.com/gaimor/comments/168444.html</wfw:comment><comments>http://www.shnenglu.com/gaimor/archive/2012/03/20/168444.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/gaimor/comments/commentRss/168444.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gaimor/services/trackbacks/168444.html</trackback:ping><description><![CDATA[綆鍗曠殑渚嬪瓙濡備笅:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">stdio.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">ao</span><span style="color: #000000; ">/</span><span style="color: #000000; ">ao.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">sndfile.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">math.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main(</span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> argc, </span><span style="color: #0000FF; ">char</span><span style="color: #000000; "> </span><span style="color: #000000; ">**</span><span style="color: #000000; ">argv)<br />{   <br />    SNDFILE</span><span style="color: #000000; ">*</span><span style="color: #000000; ">    infile </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />    SF_INFO        sfinfo;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">            readcount;<br />    <br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> rate </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">44100</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> channels </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">2</span><span style="color: #000000; ">;<br />    <br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(</span><span style="color: #000000; ">!</span><span style="color: #000000; ">(infile </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sf_open(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">rock.wav</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,SFM_READ,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">sfinfo)))<br />    {   <br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">  </span><span style="color: #000000; ">1</span><span style="color: #000000; "> ;<br />    };<br />    <br />    rate </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sfinfo.samplerate;<br />    printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">rate %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,rate);<br />    channels </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sfinfo.channels;<br />    printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">channels %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,channels);<br />    printf(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">format %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">,sfinfo.format);<br /> <br />    </span><span style="color: #0000FF; ">short</span><span style="color: #000000; "> data[</span><span style="color: #000000; ">4096</span><span style="color: #000000; ">];<br />    ao_device </span><span style="color: #000000; ">*</span><span style="color: #000000; ">device;<br />    ao_sample_format format;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> default_driver;<br />    </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> i;<br /><br />    ao_initialize();<br /><br />    default_driver </span><span style="color: #000000; ">=</span><span style="color: #000000; "> ao_default_driver_id();<br />    memset(</span><span style="color: #000000; ">&</span><span style="color: #000000; ">format, </span><span style="color: #000000; ">0</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(format));<br />    format.bits </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">16</span><span style="color: #000000; ">;<br />    format.channels </span><span style="color: #000000; ">=</span><span style="color: #000000; "> channels;<br />    format.rate </span><span style="color: #000000; ">=</span><span style="color: #000000; "> rate;<br />    format.byte_format </span><span style="color: #000000; ">=</span><span style="color: #000000; "> AO_FMT_LITTLE;<br /><br />    device </span><span style="color: #000000; ">=</span><span style="color: #000000; "> ao_open_live(default_driver,</span><span style="color: #000000; ">&</span><span style="color: #000000; ">format, NULL);<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(device </span><span style="color: #000000; ">==</span><span style="color: #000000; "> NULL) <br />    {<br />        fprintf(stderr,</span><span style="color: #000000; ">"</span><span style="color: #000000; ">error opening device.\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br />        </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    }<br />     <br />    </span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">((readcount </span><span style="color: #000000; ">=</span><span style="color: #000000; "> sf_read_short(infile,data,</span><span style="color: #000000; ">4096</span><span style="color: #000000; ">)))<br />    {   <br />        ao_play(device,data,readcount</span><span style="color: #000000; ">*</span><span style="color: #000000; ">2</span><span style="color: #000000; ">);<br />    };<br /><br />    sf_close (infile) ;<br />    ao_close(device);<br />    ao_shutdown();<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> (</span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br />}<br /></span></div><img src ="http://www.shnenglu.com/gaimor/aggbug/168444.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gaimor/" target="_blank">ccsdu2009</a> 2012-03-20 22:38 <a href="http://www.shnenglu.com/gaimor/archive/2012/03/20/168444.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>闊蟲晥緙栫▼:Echo闊蟲晥http://www.shnenglu.com/gaimor/archive/2011/05/12/146289.htmlccsdu2009ccsdu2009Thu, 12 May 2011 14:18:00 GMThttp://www.shnenglu.com/gaimor/archive/2011/05/12/146289.htmlhttp://www.shnenglu.com/gaimor/comments/146289.htmlhttp://www.shnenglu.com/gaimor/archive/2011/05/12/146289.html#Feedback1http://www.shnenglu.com/gaimor/comments/commentRss/146289.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/146289.html涓涓湡姝f剰涔変笂鐨凟cho鏄崟鍙嶅皠鐨勩傚叾鏃墮棿闂撮殧灝辨槸澹伴煶鐨勯熺巼

寰堟樉鐒朵竴鑸殑Echo鍏鋒湁2涓弬鏁?br>涓涓槸寤惰繜錛屼竴涓槸琛板噺

鍦ㄦ煇涓鏃跺埢錛屼漢鍚埌鐨勫0闊蟲槸姝ゆ椂闊蟲簮澹伴煶鍜屽歡榪熷墠闊蟲簮澹伴煶鐨勬販鍚堥煶銆?br>鏄劇劧涓涓畝鍗曠殑琛ㄨ揪寮忔槸:
data+=data_prev*decay
榪欏氨鏄疎cho闊蟲晥鍩烘湰鐨勫嚱鏁拌〃杈懼紡

榪欐槸絎洓綃囧叧浜庨煶鏁堝鐞嗙殑鏂囨。
鍏朵粬綾諱技闊蟲晥涓嶆墦綆楀啀鍐欎簡

闇瑕佽鐨勫氨鏄?瀹為檯緙栫▼騫舵病鏈夋兂璞′腑鐨勯偅涔堝鏉?

鍦ㄩ煶棰戣繖鍧楀枖宸茬粡鍋氬畬浜?br>1.acc鏍煎紡緙栬В鐮?br>2.wma緙栬В鐮?br>3.fadein,fadeout,echo,reverb絳夐煶鏁堢畻娉?br>4.闊抽棰戣氨鍒嗘瀽
5.EQ璁劇疆

鏈夌┖鏁寸悊涓嬪搱

ccsdu2009 2011-05-12 22:18 鍙戣〃璇勮
]]>
闊蟲晥緙栫▼(3)-FadeOut鍜孎adeIn闊蟲晥 http://www.shnenglu.com/gaimor/archive/2011/05/10/146148.htmlccsdu2009ccsdu2009Tue, 10 May 2011 15:14:00 GMThttp://www.shnenglu.com/gaimor/archive/2011/05/10/146148.htmlhttp://www.shnenglu.com/gaimor/comments/146148.htmlhttp://www.shnenglu.com/gaimor/archive/2011/05/10/146148.html#Feedback1http://www.shnenglu.com/gaimor/comments/commentRss/146148.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/146148.html
浜岃呴兘鍒嗗埆鎺у埗闊充箰鐨勬貳鍑哄拰娣″叆

瑙i噴涓嬫貳鍑烘晥鏋滅殑鍚箟:灝卞湪鏄煶涔愭挱鏀懼嵆灝嗙粨鏉熶箣鍓嶉氳繃涓瀹氱殑鎵嬫硶鎺у埗闊充箰鍝嶅害-鐩磋嚦緇撴潫銆?br>
寰堟樉鐒訛紝浣跨敤綰挎у叧緋誨熀鏈彲浠ヨ揪鍒扮洰鐨?br>鍋囧畾鏁版嵁鍏崇郴涓簓 = kx + b;
鍙﹀闇瑕佹帶鍒舵貳鍑虹殑鍧″害,鎴栬呯洿鎺ヨ闇瑕佺煡閬撲粠緇撴潫涔嬪墠澶氬皯涓暟鎹紑濮嬮渶瑕佷嬌鐢‵adeOut闊蟲晥銆傛墍浠ユ垜浠渶瑕佷竴涓弬鏁發en銆?br>鍋囧畾鎴戜滑浣跨敤涓嬪垪鐨勪竴鍙ヨ瘽綆楁硶鏉ヨ鏄庨棶棰?
for(int i = 0; i != len ;i++)
    bufer[i]
*= (a-i)*b;
鍏朵腑a,b涓哄緟瀹氬弬鏁?br>鍥犱負鏈変竴涓墠鎻?褰搃 = len-1鐨勬椂鍊檅uffer[len-1] = 0;
鎵浠ユ湁a=len-1
鍙﹀褰揻adeout鍙戞尌浣滅敤涔嬪墠buffer鏁版嵁騫舵湭鍙樺寲錛屾晠鏈?br>b=(len-1)
鏁呭熀鏈殑Fadeout鏍稿績綆楁硶灝辨槸涓鍙?
y=y*(1-t/k)
綆鍗曞惂銆?br>鐞嗘墍褰撶劧
鍩烘湰鐨凢adeIn鏍稿績綆楁硶灝辨槸
y*=(t/k-1)

铏界劧鍦ㄥ叿浣撳満鍚堬紝綆楁硶鏈夋墍鍙樺艦錛屼絾鏄熀鏈殑鍘熺悊灝辨槸榪欎釜鏍峰瓙

PS:鍩烘湰鐨勫嚱鏁板叧緋昏櫧鐒剁畝鍗曪紝浣嗘槸姣旇緝瀹炵敤

浠ュ悗鏈夌┖榪樹細璁睧cho,Reverb,Treble Booster,Compressor,High Filter絳夐煶鏁堝師鐞?br>銆傚彧鏄爺絀墮煶鏁堢殑鍚屽織浠笉澶氥傛病鐨勮璁?br> 



ccsdu2009 2011-05-10 23:14 鍙戣〃璇勮
]]>
闊蟲晥緙栫▼浜?Tremolo闊蟲晥http://www.shnenglu.com/gaimor/archive/2011/04/26/145089.htmlccsdu2009ccsdu2009Tue, 26 Apr 2011 14:42:00 GMThttp://www.shnenglu.com/gaimor/archive/2011/04/26/145089.htmlhttp://www.shnenglu.com/gaimor/comments/145089.htmlhttp://www.shnenglu.com/gaimor/archive/2011/04/26/145089.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/145089.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/145089.htmlTremolo闊蟲晥姣旇緝閰風殑闊蟲晥錛屽惉涓婂幓鎰熻鏄嬌鐢ㄧ數瀛愪箰鍣ㄦ紨紺虹殑銆?br>浠庢劅瀹樹笂灝員remolo(棰ら煶)闊蟲晥鏄噸鍑諱竴涓煶絎︾劧鍚庡揩閫熸彁楂橈紝鍑忓皬闊抽噺

涓嬮潰鏄ⅳ闊抽煶鏁堢殑鍑犱釜鍙傛暟:
1.娣卞害鎺у埗:鐢ㄦ潵鎺у埗闊抽噺澧炲噺閫熷害
2.闃堝兼暟鎹?璇存槑鎺у埗闊抽噺鐨勯鐜囧?br>3.娉㈠艦

鍏跺熀鏈暟瀛﹁〃杈懼紡涓?
data = data * (1.0 + depth * sin(k* rate * index));

綆鏄撶殑c++浠g爜濡備笅:

class Tremolo : public AudioEffect
{
public:
    
static double def_depth;
    
static double def_rate;
    
double depth;
    
double rate;
    
double k;
    Tremole();
    std::vector
<float> Filter(const std::vector<float>& _data)
    {   
        data 
= _data;
        
for(int i = 0; i < data.size();i++)
           data[i] 
*= (1.0 + depth * sin(2.0 * PI * rate * i / k);
        
return data;   
    }    
};
褰撶劧鏈塲ava鐗堟湰鐨勫寲搴旇鏄涓嬭繖涓牱瀛?
public class Tremolo extends AudioEffect
{
    
private static double final def_depth = ;
    
private static double final def_rate = ;
    
private double depth = def_depth;
    
private double rate = def_rate;
    Tremolo()
    {
       
    }
    
    
double[] Filter(double[] _data)
    {
        
int len = _data.length;
        
double[] ret = new double[len];
        
for(int i = 0;i<len;i++)
            ret[i] 
= _data[i]*(1+depth*Math.Sin(2*Math.PI*rate*i/k));
        
return ret;        
    }
}    
鍩烘湰鐨勬簮鐮佸氨榪欎釜鏍峰瓙
涓嶈繃鏈変竴涓棶棰樺氨鏄挱鏀鵑煶鏁堟湁灝戣鏉傞煶-涓嶈繃涓嶆槸澶ч棶棰?

ccsdu2009 2011-04-26 22:42 鍙戣〃璇勮
]]>
闊蟲晥緙栫▼(1)-Distortion闊蟲晥http://www.shnenglu.com/gaimor/archive/2011/04/25/145002.htmlccsdu2009ccsdu2009Mon, 25 Apr 2011 14:48:00 GMThttp://www.shnenglu.com/gaimor/archive/2011/04/25/145002.htmlhttp://www.shnenglu.com/gaimor/comments/145002.htmlhttp://www.shnenglu.com/gaimor/archive/2011/04/25/145002.html#Feedback0http://www.shnenglu.com/gaimor/comments/commentRss/145002.htmlhttp://www.shnenglu.com/gaimor/services/trackbacks/145002.html涔嬪墠鍋氱殑闊抽API閮芥槸浣跨敤鐨勭涓夋柟鐨勫簱鎴栬呬唬鐮?br>涓嶈繃榪欐鏃墮棿涓鐩存瘮杈冨繖
娌′粈涔堟椂闂存潵鐜╃帺闊抽寮曟搸浜?br>
涓嶈繃涓轟簡涓嶈嚦浜庢湰鍗氬闀胯崏
鎴戝氨鏁寸悊涓嬩互鍓嶆帴瑙﹁繃鐨勯煶棰戝鐞嗚繖鍧楀惂

棣栧厛涓婁竴涓畝鍗曠殑闊蟲晥鍩虹被鍚?/p>
class AudioEffect
{
public:
   
virtual ~AudioEffect(){}
   
virtual std::vector<float> Filter(const std::vector<float>& data) = 0;
protected:
   std::vector
<float> data;    
};

閫氳繃璋冪敤Filter灝卞彲浠ヨ幏鍙栫粰瀹歱cm澶勭悊鍚庣殑闊蟲晥鏁版嵁

鐒跺悗鍐嶈皥涓嬩粈涔堟槸Distortion闊蟲晥
Distortion涓昏浣跨敤浜庣數鍚変粬絳夌數瀛愮被涔愬櫒錛?br>
Distortion闊蟲晥涓昏鏈変互涓嬪弬鏁?
1.edge 涓寸晫鍊?br>2.gain 澧炵泭
3.浣庨氬壀鍒囧?褰撶劧榪樻湁鍏朵粬鍑犱釜鍙傛暟,...)

鍏剁畝鏄撳寲鐨勯煶鏁堝鐞嗗師鍒欏氨鏄?br>浣跨敤浣跨敤緇欏畾涓寸晫鍊煎鍘熸湁鏁版嵁鍋欳lamp澶勭悊

綆鍗曠殑渚嬪瓙濡備笅:
#define DISTORTION_RATE 100.0
#define DISTORTION_THRESHOLD 0.4

class Distortion : public AudioEffect
{
public
    Distortion()
    {
        gain 
= DISTORTION_RATE;
        value 
= DISTORTION_THRESHOLD;
    }
    std::vector
<float> Filter(const std::vector<float>& data_)
    {
       
this->data.clear();
       
for(int i = 0; i < data_.size(); i++)
       {
           
float v = data_[i]*gain;
           
if(v > value)
               v 
= value;
           
if(v < - value)
               v 
= -value;
           data.push_back(v);  
       }
       reutrn data;
    }
private:
    
float gain;
    
float value;
};

鐪嬩笂鍘諱技涔庡緢綆鍗?br>
閭e鐞嗗悗鐨勯煶鏁堝浣? 璇曡瘯灝辯煡閬撲簡

鎺ヤ笅鏉ヨ繕鏈塺everb,ring,echo,chorus絳夐煶鏁堢畻娉曞拰闊抽鍌呴噷鍙跺彉鎹㈢瓑
絳夊紕瀹屼簡榪欎簺錛岄煶棰戝紩鎿庝篃灝辮鍗囩駭浜?鎴戞棭宸叉瀯鎬濆ソ浜嗕笅涓増鏈殑闊抽API鍔熻兘浜?

涓嬬瘒tremolo闊蟲晥

ccsdu2009 2011-04-25 22:48 鍙戣〃璇勮
]]>
精品国产91久久久久久久| 国产精品久久成人影院| 亚洲综合精品香蕉久久网97| 欧美日韩精品久久免费| 久久精品无码av| 久久国产成人午夜aⅴ影院| 国产精品美女久久久久久2018| 久久久精品国产免大香伊 | 国产69精品久久久久观看软件 | 久久99精品国产麻豆宅宅| 亚洲乱码精品久久久久..| 久久强奷乱码老熟女网站| 一本色综合久久| 久久精品免费一区二区| 久久久久人妻一区二区三区| 伊人久久无码中文字幕| 色婷婷综合久久久中文字幕| 久久综合精品国产二区无码| 久久久久无码精品国产不卡| 99精品久久精品一区二区| 精品国产福利久久久| 91亚洲国产成人久久精品| 国产69精品久久久久99尤物| 久久久国产精品| 久久乐国产综合亚洲精品| 久久精品国产亚洲av麻豆图片| 亚洲国产另类久久久精品黑人| 人妻丰满AV无码久久不卡| 久久久av波多野一区二区| 大伊人青草狠狠久久| 国产成人精品久久综合| 久久精品国产精品亜洲毛片| 美女久久久久久| 久久99九九国产免费看小说| 一本色道久久综合狠狠躁| 国产成人精品久久二区二区| 久久99精品国产一区二区三区| 久久久91精品国产一区二区三区| 国产精品一区二区久久精品无码| 久久久久99这里有精品10 | 国内精品久久久久影院免费|