基于Linux粤嵌GEC6818开发板的电子乐队程序设计
(四种模式:和弦模式、键盘模式、鼓点模式、编曲模式)
三种音源独立设计:钢琴、钢琴和弦、鼓点
四种模式:和弦模式、键盘模式、鼓点模式、编曲模式
键盘模式包含16个按键 包含所有音名 所有调式皆可弹奏
和弦模式包含C/Am调式常用的16个和弦 包括不协和音程进行
GEC6818开发板是粤嵌公司提供的
资源:
download.csdn.net/download/weixin_53403301/66915088
所有音源资源:
music.163.com/#/album?id=130101018
先上和弦模式、键盘模式、鼓点模式、编曲模式的四个模式实物图:
和弦模式16键,键盘模式16键,鼓点模式8键,编曲模式16键。
每个按键上都写有此按键的对应音名。
切换、按下其他按键时有声音淡出功能
摘要:
本次所进行的系统设计名为《基于GEC6818开发板的电子乐队系统设计》,诣在通过程序的编写、编译,在基于Linux系统的GEC6818开发板上实现电子乐队系统。
此系统诣在为对音乐感兴趣的人提供一个方便的、小巧的、简洁的应用程序,使其能够进行演奏、音乐试验等。虽然功能上不如专业的电钢琴、MIDI键盘等乐器,但更便于携带,也适合多人乐队使用。
该电子乐队系统具有模式多,音色多,音源质量好等特点,与同类产品相比,具有以下特色和创新。
该电子乐队系统是基于搭载Linux系统内核的GEC6818开发板所实现的,程序代码部分由C语言所编写。
该电子乐队系统共有和弦模式、键盘模式、鼓点模式和编曲模式四个模式。
该电子乐队系统具有多种模式,占用资源少,界面简洁,成本低廉,制作容易,音色质量高,音源音高准确,并可替换和更新音源,还能进行简单的编曲,能够演奏现代音乐系统中的所有调式(包括中国古典乐调式),能用多台设备实现简单的乐队演奏,不同于市场上常见的或其他小组设计的普通Linux系统开发板电子乐器系统。
普通Linux系统开发板电子乐器系统多具有音色单一、按键数量少、可演奏的调式唯一、不可编曲、不可更新音源等缺点。此电子乐队系统也可以作为市场上的电子乐器系统的改进和升级版本。
关键词:Linux,电子乐队,GEC6818,编曲,C语言,电子乐器。
功能及特色:
和弦模式、键盘模式、鼓点模式、编曲模式。
和弦模式16键,键盘模式16键,鼓点模式8键,编曲模式16键。
每个按键上都写有此按键的对应音名。
切换、按下其他按键时有声音淡出功能
可选择钢琴、电子鼓、吉他、贝司等所有可添加的音色。
采用FL Studio 12软件进行编曲混音制成音源。
此软件本身需付费使用(也可进行破解免费使用),音源也须付费购买,本身音源质量高,再经过混音后导出的音源听起来更舒服、质量更高。
采用mplayer播放器,播放16位WAV顶级无损格式,采样率44100,比特率1411kbps。
音频有效频率范围为0-22050Hz,能使人感受到部分超声波。
音高频率为国际七音十二等律音阶频率标准,绝对音高准确,每一个音阶的频率都为上一个音阶频率的√(12&2)倍;相邻音区、相同音名的音频频率倍数关系为2。
A4音的频率为440Hz。
现代音乐七音十二等律音阶系统中Ionian调式(自然大调)、Dorian调式,Phrygian调式、Lydian调式、Mixolydian调式、Aeolian调式(自然小调)、Locrian调式、和声小调、旋律小调中所对应的C、C#、D、D#、E、F、F#、G、G#、A、A#、B调式,共108种调式。
以及中国现代古典乐七音十二等律音阶系统的宫(C)、商(D)、角(E)、变徵(Gb)、徵(G)、羽(A)、变宫(B或Cb)调式中所对应的C、C#、D、D#、E、F、F#、G、G#、A、A#、B调式,共84种调式。
或其他十二等律音阶系统中的调式。
多个模式循环切换,能弹奏旋律,能快速弹奏和弦,能进行编曲并播放编曲后的伴奏,能打鼓点节奏。
能在弹奏一个音源时调节音量。
按键响应快、非常灵敏,能弹奏出琶音、连音等操作,快速弹奏时不卡顿。
能用于乐队演出,同时弹奏多种音色、旋律、鼓点节奏。
可添加、更新音源,增加更多音色、模式。
所有对音乐感兴趣的人,包括但不限于乐队、启蒙者、初学者、编曲工作者、作曲家、歌手、DJ、娱乐K歌者等。
主要面向乐队、编曲工作者、娱乐K歌者、歌手、DJ等。
也可用于简单的音乐教学。
程序编写中,函数的调用方式中多达18个线程,其中和弦模式、键盘模式和鼓点模式各4个线程,编曲模式6个线程。
使用多线程模式调用函数,可以有效降低系统的延时,达到灵敏度高的特点。在快速演奏时,不会因为速度过快造成发音不全的现象,可以演奏出琶音、连音等高端操作。
此电子乐队系统适用于所有对音乐有兴趣爱好的人,不仅可以给刚刚初学音乐的人使用,弹奏简单的C自然大调旋律,也可以给作曲家、乐队使用。适用人群广泛。
乐队可以通过多设备协调使用,达到演出的目的;初学者可以弹奏键盘模式下的简单旋律;作曲家、编曲工作者、DJ可以通过此系统试验自己所写的旋律、节奏、鼓点、Demo;歌手、娱乐K歌者可以通过此系统的和弦模式和编曲模式弹奏和弦,达到弹唱的目的;音乐启蒙者也可以通过此系统启蒙学习音乐,并且音名规范、音高频率标准。
使用并推广此系统,也可以感染更多的人来喜欢音乐、玩音乐、加强对音乐的兴趣。且界面简洁,便于操作,功能方面比市面上的大多数产品都要强大,推广到市场上绝对能大卖。
代码:
# include <stdio.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <unistd.h>
# include <sys/mman.h>
# include <strings.h>
# include <linux/input.h>
# include <stdlib.h>
# include <pthread.h>
int tx,ty;
int flag=0;
int ins,bet;
char *kill = "killall -SIGKILL mplayer";
char *mkpp = "mkfifo /pipe";
char *chpp = "chmod 777 /pipe";
char *play_up = "echo seek +5 > /pipe";
char *play_down = "echo seek -5 > /pipe";
char *sound_up = "echo volume +10 > /pipe";
char *sound_down = "echo volume -10 > /pipe";
char *play_pause = "echo pause > /pipe";
char *sound_down_20 = "echo volume -20 > /pipe";
char *sound_down_30 = "echo volume -30 > /pipe";
char *sound_down_50 = "echo volume -50 > /pipe";
int fade_out(void)
{
system(sound_down_20);
system(sound_down_30);
system(sound_down_50);
return 0;
}
struct chord_image{
char bmppath[20];
int x;
int y;
int w;
int h;
};
struct chord_image chord_img[16] = {
{.bmppath = "C7.bmp",.x=0,.y=0,.w=100,.h=240},
{.bmppath = "C.bmp",.x=0,.y=240,.w=100,.h=240},
{.bmppath = "Dm7.bmp",.x=100,.y=0,.w=100,.h=240},
{.bmppath = "Dm.bmp",.x=100,.y=240,.w=100,.h=240},
{.bmppath = "Em7.bmp",.x=200,.y=0,.w=100,.h=240},
{.bmppath = "Em.bmp",.x=200,.y=240,.w=100,.h=240},
{.bmppath = "Fm.bmp",.x=300,.y=0,.w=100,.h=240},
{.bmppath = "F.bmp",.x=300,.y=240,.w=100,.h=240},
{.bmppath = "G7.bmp",.x=400,.y=0,.w=100,.h=240},
{.bmppath = "G.bmp",.x=400,.y=240,.w=100,.h=240},
{.bmppath = "Am7.bmp",.x=500,.y=0,.w=100,.h=240},
{.bmppath = "Am.bmp",.x=500,.y=240,.w=100,.h=240},
{.bmppath = "Dsus4.bmp",.x=600,.y=0,.w=100,.h=240},
{.bmppath = "D7.bmp",.x=600,.y=240,.w=100,.h=240},
{.bmppath = "Gsus4.bmp",.x=700,.y=0,.w=100,.h=240},
{.bmppath = "E7.bmp",.x=700,.y=240,.w=100,.h=240}
};
struct key_image{
char bmppath[20];
int x;
int y;
int w;
int h;
};
struct key_image key_img[16] = {
{.bmppath = "Db4.bmp",.x=0,.y=0,.w=100,.h=240},
{.bmppath = "C4.bmp",.x=0,.y=240,.w=100,.h=240},
{.bmppath = "Eb4.bmp",.x=100,.y=0,.w=100,.h=240},
{.bmppath = "D4.bmp",.x=100,.y=240,.w=100,.h=240},
{.bmppath = "Fb4.bmp",.x=200,.y=0,.w=100,.h=240},
{.bmppath = "E4.bmp",.x=200,.y=240,.w=100,.h=240},
{.bmppath = "Gb4.bmp",.x=300,.y=0,.w=100,.h=240},
{.bmppath = "F4.bmp",.x=300,.y=240,.w=100,.h=240},
{.bmppath = "Ab4.bmp",.x=400,.y=0,.w=100,.h=240},
{.bmppath = "G4.bmp",.x=400,.y=240,.w=100,.h=240},
{.bmppath = "Bb4.bmp",.x=500,.y=0,.w=100,.h=240},
{.bmppath = "A4.bmp",.x=500,.y=240,.w=100,.h=240},
{.bmppath = "Cb5.bmp",.x=600,.y=0,.w=100,.h=240},
{.bmppath = "B4.bmp",.x=600,.y=240,.w=100,.h=240},
{.bmppath = "Db5.bmp",.x=700,.y=0,.w=100,.h=240},
{.bmppath = "C5.bmp",.x=700,.y=240,.w=100,.h=240}
};
struct beat_image{
char bmppath[20];
int x;
int y;
int w;
int h;
};
struct beat_image beat_img[8] = {
{.bmppath = "Kick.bmp",.x=0,.y=0,.w=200,.h=240},
{.bmppath = "SnareC.bmp",.x=0,.y=240,.w=200,.h=240},
{.bmppath = "Snare.bmp",.x=200,.y=0,.w=200,.h=240},
{.bmppath = "Crash.bmp",.x=200,.y=240,.w=200,.h=240},
{.bmppath = "Hat.bmp",.x=400,.y=0,.w=200,.h=240},
{.bmppath = "SnareA.bmp",.x=400,.y=240,.w=200,.h=240},
{.bmppath = "Clap.bmp",.x=600,.y=0,.w=200,.h=240},
{.bmppath = "Ride.bmp",.x=600,.y=240,.w=200,.h=240}
};
struct chord_music{
char wavplay[60];
};
struct chord_music chord_wav[16] = {
{.wavplay = "mplayer -slave -quiet -input file=/pipe C7.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe C.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Dm7.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Dm.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Em7.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Em.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Fm.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe F.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe G7.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe G.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Am7.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Am.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Dsus4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe D7.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Gsus4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe E7.wav &"}
};
struct key_music{
char wavplay[60];
};
struct key_music key_wav[16] = {
{.wavplay = "mplayer -slave -quiet -input file=/pipe Db4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe C4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Eb4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe D4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Fb4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe E4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Gb4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe F4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Ab4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe G4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Bb4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe A4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Cb5.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe B4.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Db5.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe C5.wav &"}
};
struct beat_music{
char wavplay[60];
};
struct beat_music beat_wav[8] = {
{.wavplay = "mplayer -slave -quiet -input file=/pipe Kick.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe SnareC.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Snare.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Crash.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Hat.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe SnareA.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Clap.wav &"},
{.wavplay = "mplayer -slave -quiet -input file=/pipe Ride.wav &"}
};
int open_jugg(int i)
{
if (i< 0)
{
return 0;
}
else
{
return 1;
}
}
int lcd_display(int x, int y, int w, int h, int b, int g, int r, int tou)
{
int lcd = open("/dev/fb0",O_RDWR);
int i,j;
char *buf = mmap(NULL,800*480*4,PROT_WRITE,MAP_SHARED,lcd,0);
for(j=y;j<(y+h);j++)
{
for(i=x;i<(x+w);i++)
{
buf[0+4*i+800*4*j] = b;
buf[1+4*i+800*4*j] = g;
buf[2+4*i+800*4*j] = r;
buf[3+4*i+800*4*j] = tou;
}
}
write(lcd,buf,800*480*4);
close(lcd);
munmap(buf,800*480*4);
return 0;
}
int lcd_dis_bmp(char *bmppath, int x, int y, int w, int h, int tou)
{
int lcd = open("/dev/fb0",O_RDWR);
int bmp = open(bmppath,O_RDWR);
lseek(bmp,54,SEEK_SET);
char bmpbuf[w*h*3];
read(bmp,bmpbuf,w*h*3);
int i,j;
char *buf = mmap(NULL,800*480*4,PROT_WRITE,MAP_SHARED,lcd,0);
for(j=y;j<y+h;j++)
{
for(i=x;i<x+w;i++)
{
buf[0+4*i+800*4*j] = bmpbuf[0+3*(i-x)+w*3*(h-1-j+y)];
buf[1+4*i+800*4*j] = bmpbuf[1+3*(i-x)+w*3*(h-1-j+y)];
buf[2+4*i+800*4*j] = bmpbuf[2+3*(i-x)+w*3*(h-1-j+y)];
buf[3+4*i+800*4*j] = tou;
}
}
write(lcd,buf,800*480*4);
close(lcd);
close(bmp);
munmap(buf,800*480*4);
}
int touch_scan()
{
int tsfd = open("/dev/input/event0",O_RDWR);
printf("TOUCH=%d\n",open_jugg(tsfd));
struct input_event ts;
bzero(&ts,sizeof(ts));
while(1)
{
read(tsfd,&ts,sizeof(ts));
if(ts.type == EV_ABS)
{
if(ts.code == ABS_X)
{
tx = ts.value;
flag++;
}
if(ts.code == ABS_Y)
{
ty = ts.value;
flag++;
}
}
if (ty>100)
{
int a=tx/100;
int b=ty/240;
int c=tx/200;
if(b==0)
{
ins=a*2;
bet=c*2;
}
if(b==1)
{
ins=a*2+1;
bet=c*2+1;
}
}
if (flag == 2)
{
flag=0;
break;
}
}
return 0;
}
int ex_i=0;
int exbuf[50];
int ex=0;
float bpm_one=6.0;
int ex_result=0;
int ex_j=4;
void *chord_ex(void *arg)
{
fade_out();
system(kill);
system(chord_wav[exbuf[ex]].wavplay);
if(tx>450&&tx<550&&ty>0&&ty<100)
{
system(sound_up);
}
if(tx>250&&tx<350&&ty>0&&ty<100)
{
system(sound_down);
}
}
void *chord_play(void *arg)
{
system(chord_wav[ins].wavplay);
if(tx>450&&tx<550&&ty>0&&ty<100)
{
system(sound_up);
}
if(tx>250&&tx<350&&ty>0&&ty<100)
{
system(sound_down);
}
}
void *chord_res(void *arg)
{
lcd_display(chord_img[ins].x+10,chord_img[ins].y+180,80,45,255,255,255,0);
lcd_dis_bmp(chord_img[ins].bmppath,chord_img[ins].x,chord_img[ins].y,chord_img[ins].w,chord_img[ins].h,0);
lcd_dis_bmp(chord_img[ins].bmppath,chord_img[ins].x,chord_img[ins].y,chord_img[ins].w,chord_img[ins].h,0);
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *chord_jugg(void *arg)
{
if (ty>100)
{
fade_out();
system(kill);
pthread_t chordplay;
pthread_create(&chordplay,NULL,chord_play,NULL);
pthread_t chordres;
pthread_create(&chordres,NULL,chord_res,NULL);
}
}
void *chord_resex(void *arg)
{
lcd_display(chord_img[ins].x+10,chord_img[ins].y+180,80,45,255,255,255,0);
lcd_dis_bmp(chord_img[ins].bmppath,chord_img[ins].x,chord_img[ins].y,chord_img[ins].w,chord_img[ins].h,0);
lcd_dis_bmp(chord_img[ins].bmppath,chord_img[ins].x,chord_img[ins].y,chord_img[ins].w,chord_img[ins].h,0);
lcd_display(350,0,100,100,255,0,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *chord_juggex(void *arg)
{
if (ty>100)
{
fade_out();
system(kill);
pthread_t chordplay;
pthread_create(&chordplay,NULL,chord_play,NULL);
pthread_t chordresex;
pthread_create(&chordresex,NULL,chord_resex,NULL);
}
}
void *key_play(void *arg)
{
system(key_wav[ins].wavplay);
if(tx>450&&tx<550&&ty>0&&ty<100)
{
system(sound_up);
}
if(tx>250&&tx<350&&ty>0&&ty<100)
{
system(sound_down);
}
}
void *key_res(void *arg)
{
lcd_display(key_img[ins].x+10,key_img[ins].y+180,80,45,255,255,255,0);
lcd_dis_bmp(key_img[ins].bmppath,key_img[ins].x,key_img[ins].y,key_img[ins].w,key_img[ins].h,0);
lcd_dis_bmp(key_img[ins].bmppath,key_img[ins].x,key_img[ins].y,key_img[ins].w,key_img[ins].h,0);
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *key_jugg(void *arg)
{
if (ty>100)
{
fade_out();
system(kill);
pthread_t keyplay;
pthread_create(&keyplay,NULL,key_play,NULL);
pthread_t keyres;
pthread_create(&keyres,NULL,key_res,NULL);
}
}
void *beat_play(void *arg)
{
system(beat_wav[bet].wavplay);
if(tx>450&&tx<550&&ty>0&&ty<100)
{
system(sound_up);
}
if(tx>250&&tx<350&&ty>0&&ty<100)
{
system(sound_down);
}
}
void *beat_res(void *arg)
{
lcd_display(beat_img[bet].x+15,beat_img[bet].y+185,150,45,255,255,255,0);
lcd_dis_bmp(beat_img[bet].bmppath,beat_img[bet].x,beat_img[bet].y,beat_img[bet].w,beat_img[bet].h,0);
lcd_dis_bmp(beat_img[bet].bmppath,beat_img[bet].x,beat_img[bet].y,beat_img[bet].w,beat_img[bet].h,0);
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *beat_jugg(void *arg)
{
if (ty>100)
{
fade_out();
system(kill);
pthread_t beatplay;
pthread_create(&beatplay,NULL,beat_play,NULL);
pthread_t beatres;
pthread_create(&beatres,NULL,beat_res,NULL);
}
}
void *chord_disex(void *arg)
{
lcd_dis_bmp("Chords_All.bmp",0,0,800,480,0);
lcd_dis_bmp("Chords_All.bmp",0,0,800,480,0);
lcd_display(350,0,100,100,255,0,0,0);
lcd_display(750,0,50,50,0,0,255,0);
lcd_display(0,0,50,50,0,0,255,0);
}
void *chord_dis(void *arg)
{
lcd_dis_bmp("Chords_All.bmp",0,0,800,480,0);
lcd_dis_bmp("Chords_All.bmp",0,0,800,480,0);
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *key_dis(void *arg)
{
lcd_dis_bmp("Keys_All.bmp",0,0,800,480,0);
lcd_dis_bmp("Keys_All.bmp",0,0,800,480,0);
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *beat_dis(void *arg)
{
lcd_dis_bmp("Beats_All.bmp",0,0,800,480,0);
lcd_dis_bmp("Beats_All.bmp",0,0,800,480,0);
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
}
void *ex_play(void *arg)
{
int l;
for(l=0;l<ex_j;l++)
{
pthread_t chordex;
pthread_create(&chordex,NULL,chord_ex,NULL);
sleep(bpm_one);
}
}
int main(void)
{
system(mkpp);
system(chpp);
system(kill);
while(1)
{
pthread_t chorddis;
pthread_create(&chorddis,NULL,chord_dis,NULL);
while(1)
{
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
touch_scan();
if(tx>350&&tx<450&&ty>0&&ty<100)
{
fade_out();
system(kill);
tx=0;
ty=0;
break;
}
if(tx>750&&tx<800&&ty>0&&ty<50)
{
fade_out();
system(kill);
return 0;
}
pthread_t chords;
pthread_create(&chords,NULL,chord_jugg,NULL);
}
pthread_t keydis;
pthread_create(&keydis,NULL,key_dis,NULL);
while(1)
{
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
touch_scan();
if(tx>350&&tx<450&&ty>0&&ty<100)
{
fade_out();
system(kill);
tx=0;
ty=0;
break;
}
if(tx>750&&tx<800&&ty>0&&ty<50)
{
fade_out();
system(kill);
return 0;
}
pthread_t keys;
pthread_create(&keys,NULL,key_jugg,NULL);
}
pthread_t beatdis;
pthread_create(&beatdis,NULL,beat_dis,NULL);
while(1)
{
lcd_display(350,0,100,100,0,255,0,0);
lcd_display(750,0,50,50,0,0,255,0);
touch_scan();
if(tx>350&&tx<450&&ty>0&&ty<100)
{
fade_out();
system(kill);
tx=0;
ty=0;
break;
}
if(tx>750&&tx<800&&ty>0&&ty<50)
{
fade_out();
system(kill);
return 0;
}
pthread_t beats;
pthread_create(&beats,NULL,beat_jugg,NULL);
}
pthread_t chorddisex;
pthread_create(&chorddisex,NULL,chord_disex,NULL);
while(1)
{
lcd_display(350,0,100,100,255,0,0,0);
lcd_display(750,0,50,50,0,0,255,0);
lcd_display(0,0,50,50,0,0,255,0);
touch_scan();
if(tx>350&&tx<450&&ty>0&&ty<100)
{
fade_out();
system(kill);
tx=0;
ty=0;
break;
}
if(tx>750&&tx<800&&ty>0&&ty<50)
{
fade_out();
system(kill);
return 0;
}
if(tx>0&&tx<50&&ty>0&&ty<50)
{
ex_result=1;
}
if(ex_i>0&&ex_result==1)
{
fade_out();
system(kill);
if(exbuf[ex_i-3]<1)
{
bpm_one=6.0;
}
else
{
bpm_one=6/exbuf[ex_i-3];
}
int j,k;
if(exbuf[ex_i-2]<1)
{
j=1;
}
else
{
j=exbuf[ex_i-2];
}
if(exbuf[ex_i-1]<1)
{
ex_j=4;
}
else
{
ex_j=exbuf[ex_i-1];
}
for(k=0;k<j;k++)
{
for(ex=0;ex<ex_i-3;ex++)
{
pthread_t explay;
pthread_create(&explay,NULL,ex_play,NULL);
sleep(bpm_one*ex_j);
}
}
ex_i=0;
ex_result=0;
}
else
{
pthread_t chordsex;
pthread_create(&chordsex,NULL,chord_juggex,NULL);
exbuf[ex_i]=ins;
ex_i++;
}
}
}
return 0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)