锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 璇瘋愬績絳夊緟涓孌墊椂闂?/p> $ make 闇瑕佺瓑寰呭緢闀夸竴孌墊椂闂達紝絳夊緟緙栬瘧緇撴潫銆?/p> 铏界劧鍦ㄥ叿浣撳満鍚堬紝綆楁硶鏈夋墍鍙樺艦錛屼絾鏄熀鏈殑鍘熺悊灝辨槸榪欎釜鏍峰瓙 浠ュ悗鏈夌┖榪樹細璁睧cho,Reverb,Treble Booster,Compressor,High Filter絳夐煶鏁堝師鐞?br>銆傚彧鏄爺絀墮煶鏁堢殑鍚屽織浠笉澶氥傛病鐨勮璁?br>
(ffmpeg->formatCtx->start_time + time) * AV_TIME_BASE,
AVSEEK_FLAG_BACKWARD);
]]>
鏀寔甯歌闊抽鏍煎紡鍜岄煶鏁堬紝浣跨敤瓚呯駭鏂逛究
涓嬭澆鍦ㄨ繖閲?/Files/gaimor/gaudio-sdk-2.2.1.0.zip
]]>
褰撳墠鎬ц兘:
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
嬈㈣繋鎻愭剰瑙佸晩.
]]>
#include <ao/ao.h>
#include "mpg123.h"
int main(int argc, char *argv[])
{
ao_initialize();
mpg123_handle *mpg123 ;
int iMpg123_error;
if(MPG123_OK != (iMpg123_error = mpg123_init()))
{
printf("failed to init mpg123\n");
return -1;
}
mpg123 = mpg123_new(mpg123_decoders()[0], &iMpg123_error);
if(MPG123_OK != (iMpg123_error = mpg123_open(mpg123,argv[1])))
{
fprintf(stderr,"error in open mp3 file\n");
return -1;
}
int rate,channel,encoding;
mpg123_getformat(mpg123,&rate,&channel,&encoding);
int default_driver = ao_default_driver_id();
ao_sample_format format;
memset(&format,0,sizeof(format));
format.bits = 16;
format.channels = channel;
format.rate = rate;
format.byte_format = AO_FMT_LITTLE;
ao_device *device;
device = ao_open_live(default_driver,&format,NULL);
if(device == NULL)
{
fprintf(stderr,"error opening device.\n");
return 1;
}
short buffer[4096];
int read = 0;
while(1)
{
mpg123_read(mpg123,buffer,4096,&read);
if(read == 0)
break;
ao_play(device,buffer,read);
}
mpg123_close(mpg123);
ao_close(device);
ao_shutdown();
return 0;
}
]]>
#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
璋佺煡閬撹繖涓浣曞紕錛?br />
鍙﹀鏌ヤ簡涓嬪彲浠ュ姞杞絘lsa-oss
涔嬪悗璋冪敤aoss ./text music.wav鏉ユ挱鏀鵑煶涔?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
a.鐗堟湰鎻愬崌鍒?.0.0.1
b.鍙橀噺瀹忓鍔燗UDIO_ENUM鍓嶇紑
c.澧炲姞闈炴爣鍑嗘彃浠秅sndfile鏀寔flac/ogg/au/wav/aiff/voc/caf/..鍩轟簬(sndfile)
d.鏀圭敤mpg123瑙g爜mp3
e.鏀寔FFT棰戣氨
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
]]>
#include <string.h>
#include <ao/ao.h>
#include <libmad/mad.h>
#include <math.h>
#include <limits.h>
signed short to_short(mad_fixed_t fixed)
{
if(fixed>=MAD_F_ONE)
return(SHRT_MAX);
if(fixed<=-MAD_F_ONE)
return(-SHRT_MAX);
fixed=fixed>>(MAD_F_FRACBITS-15);
return((signed short)fixed);
}
unsigned char inputBuffer[4096 + MAD_BUFFER_GUARD];
class libMP3
{
public:
libMP3(const char* filename)
{
file = fopen(filename,"rb");
mad_stream_init(&stream);
mad_frame_init(&frame);
mad_synth_init(&synth);
mad_timer_reset(&timer);
}
~libMP3()
{
mad_synth_finish(&synth);
mad_frame_finish(&frame);
mad_stream_finish(&stream);
fclose(file);
}
int setup()
{
size_t remaining;
unsigned char* read;
if(stream.next_frame!=NULL)
{
remaining=stream.bufend-stream.next_frame;
memmove(inputBuffer,stream.next_frame,remaining);
read = inputBuffer+remaining;
readsize = 4096-remaining;
}
else
readsize = 4096,
read = inputBuffer,
remaining=0;
readsize = fread(read,1,readsize,file);
if(readsize<=0)
{
return -1;
}
mad_stream_buffer(&stream,inputBuffer,readsize+remaining);
char dest[100];
mad_timer_string(timer, dest, "%02lu:%02u:%02u", MAD_UNITS_HOURS, MAD_UNITS_MILLISECONDS, 0);
stream.error=(mad_error)0;
return 0;
}
long readFrame(unsigned char* pcm)
{
if(stream.buffer == NULL)
{
if(setup() == -1)
return -1;
}
while(mad_frame_decode(&frame,&stream) != 0)
{
if(MAD_RECOVERABLE(stream.error))
{
if(stream.error!=MAD_ERROR_LOSTSYNC)
{
}
continue;
}
else
if(stream.error==MAD_ERROR_BUFLEN)
{
if (setup() == -1) return -1;
continue;
}
else
{
return -1;
}
}
mad_synth_frame(&synth,&frame);
//! 鑾峰彇棰戠巼
//freq = synth.pcm.samplerate;
//bitrate = frame.header.bitrate;
//channels = (frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2;
mad_timer_add(&timer,frame.header.duration);
int j = 0;
for(int i=0;i<synth.pcm.length;i++)
{
signed short sample;
sample=to_short(synth.pcm.samples[0][i]);
pcm[j++] = sample&0xff;
pcm[j++] = sample>>8;
if(MAD_NCHANNELS(&frame.header)==2)
sample=to_short(synth.pcm.samples[1][i]);
pcm[j++] = sample&0xff;
pcm[j++] = sample>>8;
}
char dest[120];
mad_timer_string(timer,dest, "%lu:%02lu.%03u", MAD_UNITS_MINUTES, MAD_UNITS_MILLISECONDS, 0);
return j;
}
private:
struct mad_stream stream;
struct mad_frame frame;
struct mad_synth synth;
struct mad_header header;
mad_timer_t timer;
FILE* file;
long readsize;
};
int main(int argc, char **argv)
{
int rate = 44100;
int channels = 2;
unsigned char data[4096];
ao_device *device;
ao_sample_format format;
int default_driver;
ao_initialize();
default_driver = ao_default_driver_id();
memset(&format,0,sizeof(format));
format.bits = 16;
format.channels = channels;
format.rate = rate;
format.byte_format = AO_FMT_LITTLE;
libMP3 mp3("鎴戝彧鍦ㄤ箮浣?mp3");
device = ao_open_live(default_driver,&format,NULL);
if(device == NULL)
{
fprintf(stderr,"error opening device.\n");
return 1;
}
long len = 0;
unsigned char buffer[4096*2];
while(len = mp3.readFrame(buffer))
{
ao_play(device,(char*)buffer,len);
}
ao_close(device);
ao_shutdown();
return (0);
}
]]>
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.01
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)浠ユ柟渚挎敮鎸乴inux鍜宮ac
g.gaudio浠g爜浼樺寲
h.澧炲姞闊抽婧愮爜鐜囩殑鑾峰彇
i.淇敼gfeature鑼冧緥
j.瀹屽杽鏂囨。
readmap
1.鏍煎紡:瀵筸p3鐨勬敮鎸?br />2.闊蟲晥:绔嬩綋澹板寮?br />3.澶勭悊鏁呴殰/浼樺寲浠g爜
target
1.鏀寔甯歌闊抽鏍煎紡
2.鏀寔甯歌闊蟲晥
3.鏀寔3D鎾斁妯″紡
4.鏈澶ф敮鎸?-8涓煶婧愬悓鏃舵挱鏀?br />5.鏀寔闊抽杞崲
6.鏀寔褰曢煶
7.鏀寔闊抽緹庡寲
8.璺ㄥ鉤鍙?nbsp;
]]>
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.
]]>
libavutil
]]>
涓 鍑嗗鐜錛?/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
涓轟簡姹囨葷紪璇戠粨鏋滐紝璇風戶緇墽琛屼互涓嬪懡浠わ細
$ 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
]]>
閽堝杈撳叆鐨勬暟鎹畁 bite鏁版嵁A,B姣斿short綾誨瀷
Else Y = A + B - (A * B / (2 pow(n-1))
鍙﹀涓縐嶅姙娉曟槸閲囩敤鏃墮棿鐗囦氦鏇跨殑鏂瑰紡
]]>
#include <ao/ao.h>
#include <sndfile.h>
#include <math.h>
int main(int argc, char **argv)
{
SNDFILE* infile = 0;
SF_INFO sfinfo;
int readcount;
int rate = 44100;
int channels = 2;
if(!(infile = sf_open("rock.wav",SFM_READ,&sfinfo)))
{
return 1 ;
};
rate = sfinfo.samplerate;
printf("rate %d\n",rate);
channels = sfinfo.channels;
printf("channels %d\n",channels);
printf("format %d\n",sfinfo.format);
short data[4096];
ao_device *device;
ao_sample_format format;
int default_driver;
int i;
ao_initialize();
default_driver = ao_default_driver_id();
memset(&format, 0, sizeof(format));
format.bits = 16;
format.channels = channels;
format.rate = rate;
format.byte_format = AO_FMT_LITTLE;
device = ao_open_live(default_driver,&format, NULL);
if(device == NULL)
{
fprintf(stderr,"error opening device.\n");
return 1;
}
while((readcount = sf_read_short(infile,data,4096)))
{
ao_play(device,data,readcount*2);
};
sf_close (infile) ;
ao_close(device);
ao_shutdown();
return (0);
}
]]>
寰堟樉鐒朵竴鑸殑Echo鍏鋒湁2涓弬鏁?br>涓涓槸寤惰繜錛屼竴涓槸琛板噺
鍦ㄦ煇涓鏃跺埢錛屼漢鍚埌鐨勫0闊蟲槸姝ゆ椂闊蟲簮澹伴煶鍜屽歡榪熷墠闊蟲簮澹伴煶鐨勬販鍚堥煶銆?br>鏄劇劧涓涓畝鍗曠殑琛ㄨ揪寮忔槸:
data+=data_prev*decay
榪欐槸絎洓綃囧叧浜庨煶鏁堝鐞嗙殑鏂囨。
鍏朵粬綾諱技闊蟲晥涓嶆墦綆楀啀鍐欎簡
闇瑕佽鐨勫氨鏄?瀹為檯緙栫▼騫舵病鏈夋兂璞′腑鐨勯偅涔堝鏉?
鍦ㄩ煶棰戣繖鍧楀枖宸茬粡鍋氬畬浜?br>1.acc鏍煎紡緙栬В鐮?br>2.wma緙栬В鐮?br>3.fadein,fadeout,echo,reverb絳夐煶鏁堢畻娉?br>4.闊抽棰戣氨鍒嗘瀽
5.EQ璁劇疆
鏈夌┖鏁寸悊涓嬪搱
]]>
浜岃呴兘鍒嗗埆鎺у埗闊充箰鐨勬貳鍑哄拰娣″叆
瑙i噴涓嬫貳鍑烘晥鏋滅殑鍚箟:灝卞湪鏄煶涔愭挱鏀懼嵆灝嗙粨鏉熶箣鍓嶉氳繃涓瀹氱殑鎵嬫硶鎺у埗闊充箰鍝嶅害-鐩磋嚦緇撴潫銆?br>
寰堟樉鐒訛紝浣跨敤綰挎у叧緋誨熀鏈彲浠ヨ揪鍒扮洰鐨?br>鍋囧畾鏁版嵁鍏崇郴涓簓 = kx + b;
鍙﹀闇瑕佹帶鍒舵貳鍑虹殑鍧″害,鎴栬呯洿鎺ヨ闇瑕佺煡閬撲粠緇撴潫涔嬪墠澶氬皯涓暟鎹紑濮嬮渶瑕佷嬌鐢‵adeOut闊蟲晥銆傛墍浠ユ垜浠渶瑕佷竴涓弬鏁發en銆?br>鍋囧畾鎴戜滑浣跨敤涓嬪垪鐨勪竴鍙ヨ瘽綆楁硶鏉ヨ鏄庨棶棰?
bufer[i]*= (a-i)*b;
鎵浠ユ湁a=len-1
鍙﹀褰揻adeout鍙戞尌浣滅敤涔嬪墠buffer鏁版嵁騫舵湭鍙樺寲錛屾晠鏈?br>b=(len-1)
鏁呭熀鏈殑Fadeout鏍稿績綆楁硶灝辨槸涓鍙?
鍩烘湰鐨凢adeIn鏍稿績綆楁硶灝辨槸
y*=(t/k-1)
PS:鍩烘湰鐨勫嚱鏁板叧緋昏櫧鐒剁畝鍗曪紝浣嗘槸姣旇緝瀹炵敤
]]>
涓嬮潰鏄ⅳ闊抽煶鏁堢殑鍑犱釜鍙傛暟:
1.娣卞害鎺у埗:鐢ㄦ潵鎺у埗闊抽噺澧炲噺閫熷害
2.闃堝兼暟鎹?璇存槑鎺у埗闊抽噺鐨勯鐜囧?br>3.娉㈠艦
鍏跺熀鏈暟瀛﹁〃杈懼紡涓?
綆鏄撶殑c++浠g爜濡備笅:
{
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;
}
};
{
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;
}
}
涓嶈繃鏈変竴涓棶棰樺氨鏄挱鏀鵑煶鏁堟湁灝戣鏉傞煶-涓嶈繃涓嶆槸澶ч棶棰?
]]>
娌′粈涔堟椂闂存潵鐜╃帺闊抽寮曟搸浜?br>
涓嶈繃涓轟簡涓嶈嚦浜庢湰鍗氬闀胯崏
鎴戝氨鏁寸悊涓嬩互鍓嶆帴瑙﹁繃鐨勯煶棰戝鐞嗚繖鍧楀惂
棣栧厛涓婁竴涓畝鍗曠殑闊蟲晥鍩虹被鍚?/p>
{
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_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闊蟲晥
]]>