资源简介

盛大开源哼唱识别代码,该版本是2.0,1.0的代码还未公开,期待中

资源截图

代码片段和文件信息


#include 
#include 
#include 
#include “midifile.h“

/*
 * Data Types
 */

struct MidiFile
{
int file_format;
MidiFileDivisionType_t division_type;
int resolution;
int number_of_tracks;
struct MidiFileTrack *first_track;
struct MidiFileTrack *last_track;
struct MidiFileEvent *first_event;
struct MidiFileEvent *last_event;
};

struct MidiFileTrack
{
struct MidiFile *midi_file;
int number;
long end_tick;
struct MidiFileTrack *previous_track;
struct MidiFileTrack *next_track;
struct MidiFileEvent *first_event;
struct MidiFileEvent *last_event;
};

struct MidiFileEvent
{
struct MidiFileTrack *track;
struct MidiFileEvent *previous_event_in_track;
struct MidiFileEvent *next_event_in_track;
struct MidiFileEvent *previous_event_in_file;
struct MidiFileEvent *next_event_in_file;
long tick;
MidiFileEventType_t type;

union
{
struct
{
int channel;
int note;
int velocity;
}
note_off;

struct
{
int channel;
int note;
int velocity;
}
note_on;

struct
{
int channel;
int note;
int amount;
}
key_pressure;

struct
{
int channel;
int number;
int value;
}
control_change;

struct
{
int channel;
int number;
}
program_change;

struct
{
int channel;
int amount;
}
channel_pressure;

struct
{
int channel;
int value;
}
pitch_wheel;

struct
{
int data_length;
unsigned char *data_buffer;
}
sysex;

struct
{
int number;
int data_length;
unsigned char *data_buffer;
}
meta;
}
u;

int should_be_visited;
};

/*
 * Helpers
 */

static signed short interpret_int16(unsigned char *buffer)
{
return ((signed short)(buffer[0]) << 8) | (signed short)(buffer[1]);
}

static signed short read_int16(FILE *in)
{
unsigned char buffer[2];
fread(buffer 1 2 in);
return interpret_int16(buffer);
}

static void write_int16(FILE *out signed short value)
{
unsigned char buffer[2];
buffer[0] = (unsigned char)((value >> 8) & 0xFF);
buffer[1] = (unsigned char)(value & 0xFF);
fwrite(buffer 1 2 out);
}

static unsigned short interpret_uint16(unsigned char *buffer)
{
return ((unsigned short)(buffer[0]) << 8) | (unsigned short)(buffer[1]);
}

static unsigned short read_uint16(FILE *in)
{
unsigned char buffer[2];
fread(buffer 1 2 in);
return interpret_uint16(buffer);
}

static void write_uint16(FILE *out unsigned short value)
{
unsigned char buffer[2];
buffer[0] = (unsigned char)((value >> 8) & 0xFF);
buffer[1] = (unsigned char)(value & 0xFF);
fwrite(buffer 1 2 out);
}

static unsigned long interpret_uint32(unsigned char *buffer)
{
return ((unsigned long)(buffer[0]) << 24) | ((unsigned long)(buffer[1]) << 16) | ((unsigned long)(buffer[2]) << 8) | (unsigned long)(buffer[3]);
}

static unsigned long read_uint32(FILE *in)
{

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2010-11-03 14:07  sdhumming\
     目录           0  2010-11-03 14:07  sdhumming\bin\
     目录           0  2010-11-03 14:07  sdhumming\bin\SDHBuildModel\
     文件      204800  2010-09-30 09:04  sdhumming\bin\SDHBuildModel\SDHBuildModel.exe
     目录           0  2010-11-03 14:07  sdhumming\bin\SDHumming\
     文件      128000  2010-09-30 09:04  sdhumming\bin\SDHumming\0ef43554d_768.wav
     文件      182612  2010-09-30 09:04  sdhumming\bin\SDHumming\QBHModel.dat
     文件        1144  2010-09-30 09:04  sdhumming\bin\SDHumming\QBHModel.info
     文件       32387  2010-09-30 09:04  sdhumming\bin\SDHumming\res.txt
     文件         711  2010-09-29 17:48  sdhumming\bin\SDHumming\result.txt
     文件          74  2010-09-30 09:04  sdhumming\bin\SDHumming\run.bat
     文件      104448  2010-09-30 09:04  sdhumming\bin\SDHumming\SDFuzzySearch.dll
     文件       65536  2010-09-30 09:04  sdhumming\bin\SDHumming\SDHumming.exe
     文件      120354  2010-09-30 10:03  sdhumming\bin\SDHumming\test.wav
     文件       35193  2010-09-30 10:51  sdhumming\COPYRIGHT.txt
     目录           0  2010-11-03 14:07  sdhumming\demo\
     文件        1164  2010-09-30 09:24  sdhumming\demo\100Songs.txt
     文件      136192  2010-09-30 12:48  sdhumming\demo\README.doc
     文件      119830  2010-09-30 16:44  sdhumming\demo\README.pdf
     文件     4422371  2010-09-30 16:25  sdhumming\demo\SDHummingDemoSetup.exe
     目录           0  2010-11-03 14:07  sdhumming\lib\
     文件         374  2010-09-30 10:04  sdhumming\lib\README.txt
     目录           0  2010-11-03 14:07  sdhumming\lib\win32\
     文件       36864  2010-09-29 21:20  sdhumming\lib\win32\SDFuzzySearch.dll
     文件        2104  2010-09-29 21:20  sdhumming\lib\win32\SDFuzzySearch.lib
     目录           0  2010-11-03 14:07  sdhumming\lib\win64\
     文件       25600  2010-09-29 21:08  sdhumming\lib\win64\SDFuzzySearch.dll
     文件        2102  2010-09-29 21:08  sdhumming\lib\win64\SDFuzzySearch.lib
     目录           0  2010-11-03 14:07  sdhumming\model\
     文件        1164  2010-09-30 09:24  sdhumming\model\100Songs.txt
     文件      182616  2010-09-16 00:19  sdhumming\model\QBH.Model
............此处省略28个文件信息

评论

共有 条评论