⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 music.h

📁 基于lpc2148(arm7)的wav音乐格式播放器的设计
💻 H
字号:
// -*- tab-width: 4 -*-
//
// Copyright (c) 2006-2008, K9spud LLC.
// http://www.k9spud.com/traxmod/
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef __MUSIC_H
#define __MUSIC_H

typedef struct
{	
	euint8 	iFinetune;
	euint8 	iVolume;
	euint32 iLoopStart;
	euint32 iLoopEnd;
	euint32 iLength;
	euint32 iSDLocation;		// physical SD Card location for the beginning of the sample
} SampleType;

typedef struct
{
	euint8 iEffect;
	euint8 iEffectData;
	euint8 iVolume;
	euint8 iPan;
	euint8 iFinetune;
	int iPeriod;
	int iPortaDest;
	euint8 iPortaSpeed;
	euint8 iVibratoSpeed;
	euint8 iVibratoPosition;
	euint8 iWaveform;
	euint8 iTremoloSpeed;
	euint8 iTremoloPosition;

	unsigned int flags;
	// Mixer parameters ---------------------------------------------------------------------
	SampleType* sample;
	int iStep;
	int iStepFract;
	int iLoc;
	unsigned int iLocFract;
	// --------------------------------------------------------------------------------------
} EventChannelType;

#define IS_ACTIVE		(1<<0)
#define SET_ACTIVE		(1<<1)
#define SET_SAMPLE		(1<<2)
#define SET_VOLUME		(1<<3)
#define SET_STEP		(1<<4)
#define SET_iLoc		(1<<5)
#define SET_iLocFract	(1<<6)

extern euint8 iTempoCount;
extern euint8 iTempoPeriod;
extern euint8 iRow;
extern euint8 iPattern;
extern euint8 iOrder;
extern euint8 iPatternDelay;

//extern eint16 PeriodTable[];
extern euint16 FinetuneTable[];

extern EventChannelType EventChannel[];

void initMusic(void);
void FrameInterrupt(void);
void DoMusic(void);

void LoadPattern(unsigned int iPatNum);
void SetOrder(euint8 iNewOrder);
void SetBPM(unsigned int iNewBPM);
void SetSample(EventChannelType* eventChannel, unsigned int iSample);
void SetPeriod(EventChannelType* eventChannel, int iPeriod);
void SetPeriodCheckLimits(EventChannelType* eventChannel, int iPeriod);
void SetVolume(EventChannelType* eventChannel, int iNewVolume);
inline euint8 Hex2Dec(euint8 iData);

#endif // __MUSIC_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -