📄 mixer.h
字号:
// -*- tab-width: 4 -*-
// TRAXMOD Audio Mixer
//
// 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 __MIXER_H
#define __MIXER_H
#include "audio.h"
#include "types.h"
#include "stdlib.h"
#include "modplay/music.h"
#define CHANNELS 4
#define MAXVOLUME 64
//#define GRAPHDBG(x) uart0Putch(x)
#define GRAPHDBG(x)
// WARNING: DO NOT MODIFY THE ORDER OF EXISTING MEMBERS OF THIS STRUCTURE.
// Otherwise, you will have to fix isr.S so that it can reach the readingData->Length variable.
typedef struct
{
eint8* Data; // RAM buffer for sample data to be mixed.
int iSDLoc; // sample offset (iLoc) that beginning of RAM buffer corresponds to.
eint16 Length; // current number of samples that have been read into the RAM buffer.
eint16 Channel; // Channel number this data belongs to.
} StreamDataType;
extern StreamDataType StreamData[];
extern StreamDataType* readingData; // data that is being read into RAM
extern StreamDataType* mixingData; // data that has been fully read into RAM and ready for mixing
extern StreamDataType* waitingData; // data that is has been read into RAM, but is not being mixed until the mixingData buffer is finished mixing.
typedef struct
{
eint16* outputPointer; // pointer into the main output audio buffer where this channel is currently mixing into.
unsigned int iSDLocation; // physical SD Card location for the beginning of the sample
int iEnd;
int iLoopStart;
int iStep;
int iStepFract;
int iLoc;
unsigned int iLocFract;
euint16 iVolLeft;
euint16 iVolRight;
unsigned bActive :1;
unsigned bLoop :1;
unsigned int mixingFrame;
// unsigned bBiDi :1;
// unsigned b16 :1;
// unsigned bStereo :1;
} MixChannelType;
extern MixChannelType MixChannel[];
extern unsigned int iFramePeriod;
extern int frameCountdown;
extern eint16* framePointer;
extern unsigned int waitForFrame;
extern int skipMisaligned;
void stopSD(void);
void doFrameWatch(void);
int doMix(void);
void initMixer(void);
void copyEventToChannel(MixChannelType* mixChannel, EventChannelType* eventChannel);
//void PostProcess(unsigned int iPtr, unsigned int iLength);
int bufferLength(eint16* mixPtr /* tail */, eint16* playPtr /* head */);
void startNextReader(void);
void finishReading(void);
void printStatus(int i);
#endif // __MIXER_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -