Files
2026-07-09 11:27:59 +08:00

286 lines
6.8 KiB
C

#ifndef commonstructH
#define commonstructH
#ifdef _WIN32
#pragma once
#else
#include "typedef.h"
#endif
#include <string.h>
enum EClientType{
e_Ac_Windows,
e_CZ_Android,
e_CZ_iOS,
e_Ac_Android,
e_Ac_iOS,
e_Web,
e_Pro_Windows,
e_SM_Checker,
e_Pro_Lite
};
enum EStyleState{
e_OffLine = -2, //下线
e_CheckFail, //审核未通过
e_Checking, //待审核
e_Distribute, //发布
e_UnDownload, //未下载
e_Downloading, //在下载
e_Downloaded //已下载
};
enum EStyleType{
e_ST_BEGIN,
e_ST_Origin,
e_ST_Temp,
e_ST_Share,
e_ST_END
};
enum ESoundEffectPreset{
e_SE_echo,
e_SE_distorition,
e_SE_reverbMaxium,
e_SE_reverbMiddle,
e_SE_reverbMinium,
e_SE_rotate,
e_SE_compressMaxium,
e_SE_compressMiddle,
e_SE_compressMinium,
e_SE_wah,
e_SE_phaser,
e_SE_EQ
};
enum EPaymentOperation{
e_PO_Pay4Basic = 0x01, //基本功能费
e_PO_Pay4Compose = 0x02, //保存编曲
e_PO_Pay4Midi = 0x04, //导出MIDI
e_PO_Pay4Audios = 0x08, //多音轨输出
e_PO_Pay4Fonts = 0x10, //多音色库
e_PO_End
};
#pragma pack (2)
/////////////////////////////////////////////////////////
// 通道信息
typedef struct tagChan{
char no; //通道号
char prog; //乐器号
char vol; //音量
tagChan(){
no = prog = vol = -1;
}
}TCHAN, *PTCHAN;
//风格详细信息结构体
typedef struct tagStyleDetail{
int size;
int idAuthor; //作者ID
short iTempo; //原速
short iTimesignature; //节拍 ( 0=4/4, 1=3/4, 2=2/4, 3=6/8 )
char type[4]; //风格分类
char nSegNum[4]; //伴奏/加花/前奏/尾奏个数
//以下部分可变长度传输和存储
char strAuthor[40]; //作者名称 UTF8
char strStyleName[40]; //风格名称 UTF8
char strDescription[120]; //风格描述 UTF8
char aIntroBars[8]; //前奏小节数
char aEndingBars[8]; //尾奏小节数
char chordRecom[8]; //推荐和声进行
TCHAN tracks[4][8][16]; //伴奏/加花/前奏/尾奏轨道信息 (前/尾奏0/2/4/6大调 1/3/5/7小调)
tagStyleDetail(){
size = sizeof(tagStyleDetail);
idAuthor = iTempo = iTimesignature = 0;
memset( type, -1, sizeof(type) );
memset( nSegNum, 0, sizeof(nSegNum) );
memset( strAuthor, 0, sizeof(strAuthor) );
memset( strStyleName, 0, sizeof(strStyleName) );
memset( strDescription, 0, sizeof(strDescription) );
memset( aIntroBars, 0, sizeof(aIntroBars) );
memset( aEndingBars, 0, sizeof(aEndingBars) );
memset( chordRecom, -1, sizeof(chordRecom) );
}
}TSTYLEDETAIL, *PTSTYLEDETAIL;
//风格信息结构体
typedef struct tagStyleInfo{
UINT idStyle; //风格ID
short cost; //使用消费
short score; //评分 (score/100)10分制
int paid; //支付次数
int state; //状态
TSTYLEDETAIL detail; //详细信息
tagStyleInfo(){
idStyle = 0;
cost = 0;
score = 0;
paid = 0;
state = 0;
}
}TSTYLEINFO, *PTSTYLEINFO;
//制作风格信息结构体
typedef struct tagMakeStyleInfo{
short price; //购买消费
short cost; //使用消费
TSTYLEDETAIL detail; //详细信息
tagMakeStyleInfo(){
price = 0;
cost = 0;
}
}TMAKESTYLEINFO, *PMAKETSTYLEINFO;
//版本结构体
typedef struct
{
WORD majorVersion; //主版本号
WORD minorVersion; //次版本号
WORD modifyVersion; //修改版本号
WORD buildVersion; //编译版本号
}TVERSION, *PTVERSION;
#define MAX_DESCRIB_LENGTH 1024
//软件信息结构体
typedef struct tSoftwareInfo{
int size;
TVERSION version;
UINT nFileSize;
UINT tIssueDate;
char strDescribe[MAX_DESCRIB_LENGTH];
tSoftwareInfo(){
memset( this, 0, sizeof(tSoftwareInfo) );
size = sizeof(tSoftwareInfo);
};
} TSOFTWAREINFO, *PTSOFTWAREINFO;
#pragma pack (4)
//发布风格更新结构体
typedef struct tStyleUpdate{
UINT idStyle; //风格ID
short cost; //使用消费
short score; //评分 (score/100)10分制
int paid; //支付次数
} TSTYLEUPDATE, *PTSTYLEUPDATE;
//账户信息结构体
typedef struct tAccountInfo{
UINT ID; //用户ID
UINT authority; //用户权限
int balance; //帐户余额(唱作音符)
int pops; //魅力值
int fans; //粉丝数
int songs; //歌曲数
int vipPeriod; //VIP时长:-1=终身 0=非VIP 其它=vip剩余秒数
tAccountInfo(){
memset( this, 0, sizeof(tAccountInfo) );
};
}TACCOUNTINFO, *PTACCOUNTINFO;
//用户信息结构体
typedef struct tUserInfo{
char strUserName[32];
char strPassword[80];
char strNickName[32];
char strIconFile[32];
TACCOUNTINFO accountInfo; //账户信息
int ownStyleNum; //已购买风格数
int arrStyleId[16]; //已购买风格ID数组
tUserInfo(){
memset( strUserName, 0, 32 );
memset( strPassword, 0, 80 );
memset( strNickName, 0, 32 );
memset( strIconFile, 0, 32 );
memset( arrStyleId, 0, 16 );
ownStyleNum = 0;
};
}TUSERINFO,*PTUSERINFO;
//字符串对结构体
typedef struct tStringPair{
char str1[320];
char str2[640];
tStringPair(){
memset( str1, 0, 320 );
memset( str2, 0, 640 );
}
} TSTRINGPAIR, *PTSTRINGPAIR;
//上传歌曲信息结构体
typedef struct tSongInfo{
int size; //结构大小
char strSongName[64]; //歌曲名
int iTempo; //速度
char iTS; //节拍
char iCreation; //创作类型 (1:原创 3:改编)
char iSubmit; //提交审核状态(0:不提交,1:自动提交)
char iSingerType; //演唱人类别 (1:男;2:女;3:组合;4:其他;0:未知)
char strSinger[32]; //演唱
char strOriginal[32]; //原唱
char strLyricist[32]; //作词
char strComposer[32]; //作曲
char strArranger[32]; //编曲
char iMusicStyle[4]; //曲风
UINT aStyleIDs[32]; //使用的风格ID
char strDescription[640];//歌曲描述
char* strLyric; //歌词
char* strMp3Name; //mp3临时文件
char* strIconName; //封面临时文件
//上传工程文件
UINT cpjVersion; //工程版本号
int cpjPrice; //下载收费
char* strCpjName; //工程文件名
tSongInfo(){
memset( this, 0, sizeof(tSongInfo) );
memset( iMusicStyle, -1, 4 );
size = sizeof(tSongInfo);
};
~tSongInfo(){
if( strLyric )
delete[] strLyric;
if( strMp3Name )
delete[] strMp3Name;
if( strIconName )
delete[] strIconName;
if( strCpjName )
delete[] strCpjName;
};
} TSONGINFO, *PTSONGINFO;
//上传歌曲返回分享信息结构
typedef struct tShareInfo{
UINT idSong; //歌曲ID
char strSongURL[256]; //歌曲文件URL
char strCoverURL[256]; //歌曲封面URL
tShareInfo(){
memset( this, 0, sizeof(tShareInfo) );
};
} TSHAREINFO, *PTSHAREINFO;
#pragma pack()
#endif //_COMMONSTRUCT_H_