music.h

#ifndef MUSIC_H_INCLUDED
#define MUSIC_H_INCLUDED

#include <reg52.h>
#include <string.h>
#include "utilities.h"

typedef struct music {
    char * pNote;
    char * pDur;
} Music;

uchar code twoTigerNote[] = {      //音名
    1, 2, 3, 1,
    1, 2, 3, 1,
    3, 4, 5,
    3, 4, 5,
    5, 6, 5, 4, 3, 1,
    5, 6, 5, 4, 3, 1,
    1, 5, 1,
    1, 5, 1,
    '\0'
};
uchar code twoTigerDuration[] = {       //音名对应的时值,4表示4分音符,8表示8分音符,16表示16分音符
    4, 4, 4, 4,
    4, 4, 4, 4,
    4, 4, 2,
    4, 4, 2,
    FuDian(8), 16, FuDian(8), 16, 4, 4,
    FuDian(8), 16, FuDian(8), 16, 4, 4,
    4, 4, 2,
    4, 4, 2,
    '\0'
};
uchar code baheNote[] = {
    5, 1, 2, 3, 4,
    5, 1, 1,
    6, 4, 5, 6, 7,
    8, 1, 1,
    4, 5, 4, 3, 2,
    3, 4, 3, 2, 1,
    7, 1, 2, 3, 1,
    3, 2,
    5, 1, 2, 3, 4,
    5, 1, 1,
    6, 4, 5, 6, 7,
    8, 1, 1,
    4, 5, 4, 3, 2,
    3, 4, 3, 2, 1,
    2, 3, 2, 1, 7,
    1,
    '\0'
};
uchar code baheDur[] = {
    4, 8, 8, 8, 8,
    4, 4, 4,
    4, 8 ,8 ,8, 8,
    4, 4, 4,
    4, 8, 8, 8, 8,
    4, 8, 8, 8, 8,
    4, 8, 8, 8, 8,
    4, 2,
    4, 8, 8, 8, 8,
    4, 4, 4,
    4, 8 ,8 ,8, 8,
    4, 4, 4,
    4, 8, 8, 8, 8,
    4, 8, 8, 8, 8,
    4, 8, 8, 8, 8,
    4,
    '\0'
};
Music musicSet[] = {
    {twoTigerNote, twoTigerDuration},
    {baheNote, baheDur},
};

#endif // MUSIC_H_INCLUDED

你可能感兴趣的:(music.h)