我来我网
https://5come5.cn
 
您尚未 登录  注册 | 菠菜 | 软件站 | 音乐站 | 邮箱1 | 邮箱2 | 风格选择 | 更多 » 
 

本页主题: [求助]怎样用C++读入MIDI格式音乐 隐藏签名 | 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

sunxj





性别: 帅哥 状态: 该用户目前不在线
等级: 品行端正
发贴: 249
威望: 0
浮云: 1044
在线等级:
注册时间: 2005-01-01
最后登陆: 2007-06-27

5come5帮你背单词 [ realization /riəlai'zeiən/ n. 实现,认识到,深刻了解 ]


[求助]怎样用C++读入MIDI格式音乐

小弟在这拜求了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
望各位高手指点一二
要求是分析MIDI音乐里的音高,音长,频率等
我这有初步程序,
但要改一下,各位看看
#include<stdio.h>
#include<stdlib.h>
void main( )
{

int rdmid(void* userdata;
  FILE*fp;
  int no_sysex_merge;
/* The following 21 arguments are function pointers to your event handers(ot NULL).*/
/* 3 handlers for header and tracks.*/
int (*eh_header) (void*userdata,int format,   /* 0,1,or2.*/
                        int track,
                        int division);
int (*eh_trackstart)(void*userdata, int track);
  int (*eh_trackend) (void*userdata, int track);
  /*7 channel messages:*/
  /*0<=time=<2^31*/
int (*eh_note_off) (void*userdata,long time,int channel,/*0<=channel<=15*/
                              int note,/*0<=note<=127.*/
                              int velocity);/*0<=velocity<=127*/
int (*eh_note_on) (void*userdata,long time,int channle,
                              int note,
                              int velocity);
int (*eh_poly_press) (void*userdata,long time,int channle,
                              int note,
                              int pressure);/*0<=pressure<=127.*/
int (eh*controller)(void*userdata,long time,int channel,
                              int number,/*0<=number<=127.*/
                              int value);/*0<=value<=127.*/
int (*eh_program) (void*userdata,long time,int channel,
                              int number);
int (*eh_chan_press) (void*userdata,long time,int channel,
                              int pressure);
int (*eh_pitchbend) (void*userdata,long time,int channel,
                              int bend);
    /*-8192<=bend<=+8191.*/
    /* 1 system exclusive message:*/
int (*eh_sysex) (void*userdata,long time,long lenth,
                              char*data);
    /*10 meta events*/


  int (*eh_seqnum) (void*userdata,long time,int number);
    /*0<=numbr<=65535.*/
int(*eh_text) (void*userdata,long time,int type,
                          long length,
                          char*data);
  int (eh*eot) (void*userdata,long time);/*End of track.*/
  int (*eh*tempo)(void*userdata,long time,long tempo);/*0<=tempo>=1677715.*/
                                    /*microsecs/quarter note.*/
  int (*eh_smpte)(void*userdata,long time,int hour,
                            int min,
                            int sec,
                            int frame,
                            int frac);
int(*eh_timesig) (void*userdata,long time,int number,
                            int denom, /*1,2,4,8,16,etc.*/
                            int mclck,
                            int m32);/* Often 8.*/
int (*eh_keysig) (void*userdata,long time,int sharps,/*-7<=sharps<=+7*/
                            int minor);/*0=major;1=minor*/
int (*eh_seq_spec) ( void*userdata,long time,long length,
                              char*data);
int(*eh_metamisc)(void*userdata,long time,int type,
                            long length,
                            char*data);
int(*eh_arbitrary)(void*userdata,long time,long length,
                              char*data);
)
fp=fopen("filename.c,"r");
if(fp=fopon("myfile","r"))==NULL)
{
  printf("Can't open this file!\n);
  exit(0);
}
else
/* 块处理函数*/
static int read_header(RDMID_PRIV*priv,unsigned short*tracks);
int my_header(void*userdata,int format,int tracks,int division);
static int read_track(RDMID_PRIV*priv,int track);
int my_trackstrat(void*userdata,int track);
int my_trackend(void*userdata,int track);
/*事件处理函数*/
static int meta_event(RDMID_PRIV*priv,long time,short type);
static int channel_message(RDMID_PRIV*priv,long time,int status,int c1,int c2);
int my_note_on(void*userdata,long time,int channel,int note,int velocity);
int my_note_off(void*userdata,long time,int channel,int note,int velocity);
int my_tempo(void*userdata,long time,long tempo);
int my_smpte(void*userdata,long time,int hour,int min,int sec,int frame,int frac);
int my_timesig(void*userdata,long time,int number,int denom,int mclck,int m32);
/*字节处理函数*/
static int check_string(FILE*fp,const char*s);
static int read_u32(FILE*fp,unsigned long*u32);
static int read_u16(FILE*fp,unsigned long*available,unsigned short*u16);
static int read_varlen(FILE*fp,unsigned long*available,unsigned long*u32);
}
顶端 Posted: 2007-04-30 20:48 | [楼 主]
我来我网·5come5 Forum » 程序员之家

Total 0.005526(s) query 4, Time now is:11-23 15:52, Gzip enabled
Powered by PHPWind v5.3, Localized by 5come5 Tech Team, 黔ICP备16009856号