forked from len0rd/rockbox
Move all of midiplay into its subdir and add a Makefile for it, add header files as necessary.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14841 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e24975a35f
commit
0e49605aaa
15 changed files with 377 additions and 195 deletions
|
@ -5,6 +5,7 @@
|
|||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2005 Stepan Moskovchenko
|
||||
*
|
||||
|
@ -15,134 +16,23 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#define BYTE unsigned char
|
||||
|
||||
//Data chunk ID types, returned by readID()
|
||||
#define ID_UNKNOWN -1
|
||||
#define ID_MTHD 1
|
||||
#define ID_MTRK 2
|
||||
#define ID_EOF 3
|
||||
#define ID_RIFF 4
|
||||
|
||||
|
||||
//MIDI Commands
|
||||
#define MIDI_NOTE_OFF 128
|
||||
#define MIDI_NOTE_ON 144
|
||||
#define MIDI_AFTERTOUCH 160
|
||||
#define MIDI_CONTROL 176
|
||||
#define MIDI_PRGM 192
|
||||
#define MIDI_PITCHW 224
|
||||
|
||||
|
||||
//MIDI Controllers
|
||||
#define CTRL_VOLUME 7
|
||||
#define CTRL_BALANCE 8
|
||||
#define CTRL_PANNING 10
|
||||
#define CHANNEL 1
|
||||
|
||||
//Most of these are deprecated.. rampdown is used, maybe one other one too
|
||||
#define STATE_ATTACK 1
|
||||
#define STATE_DECAY 2
|
||||
#define STATE_SUSTAIN 3
|
||||
#define STATE_RELEASE 4
|
||||
#define STATE_RAMPDOWN 5
|
||||
|
||||
//Loop states
|
||||
#define STATE_LOOPING 7
|
||||
#define STATE_NONLOOPING 8
|
||||
|
||||
//Various bits in the GUS mode byte
|
||||
#define LOOP_ENABLED 4
|
||||
#define LOOP_PINGPONG 8
|
||||
#define LOOP_REVERSE 16
|
||||
|
||||
#define LOOPDIR_FORWARD 0
|
||||
#define LOOPDIR_REVERSE 1
|
||||
|
||||
#include "plugin.h"
|
||||
#include "midiutil.h"
|
||||
|
||||
extern struct plugin_api * rb;
|
||||
|
||||
int printf(const char *fmt, ...);
|
||||
|
||||
int chVol[16] IBSS_ATTR; /* Channel volume */
|
||||
int chPanLeft[16] IBSS_ATTR; /* Channel panning */
|
||||
int chPanRight[16] IBSS_ATTR;
|
||||
int chPat[16] IBSS_ATTR; /* Channel patch */
|
||||
int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */
|
||||
|
||||
|
||||
struct GPatch * gusload(char *);
|
||||
struct GPatch * patchSet[128];
|
||||
struct GPatch * drumSet[128];
|
||||
|
||||
struct Event
|
||||
{
|
||||
unsigned int delta;
|
||||
unsigned char status, d1, d2;
|
||||
unsigned int len;
|
||||
unsigned char * evData;
|
||||
};
|
||||
|
||||
struct Track
|
||||
{
|
||||
unsigned int size;
|
||||
unsigned int numEvents;
|
||||
unsigned int delta; /* For sequencing */
|
||||
unsigned int pos; /* For sequencing */
|
||||
void * dataBlock;
|
||||
};
|
||||
|
||||
|
||||
struct MIDIfile
|
||||
{
|
||||
int Length;
|
||||
unsigned short numTracks;
|
||||
unsigned short div; /* Time division, X ticks per millisecond */
|
||||
struct Track * tracks[48];
|
||||
unsigned char patches[128];
|
||||
int numPatches;
|
||||
};
|
||||
|
||||
/*
|
||||
struct SynthObject
|
||||
{
|
||||
struct GWaveform * wf;
|
||||
unsigned int delta;
|
||||
unsigned int decay;
|
||||
unsigned int cp;
|
||||
unsigned char state, loopState, loopDir;
|
||||
unsigned char note, vol, ch, isUsed;
|
||||
int curRate, curOffset, targetOffset;
|
||||
unsigned int curPoint;
|
||||
};
|
||||
*/
|
||||
|
||||
struct SynthObject
|
||||
{
|
||||
struct GWaveform * wf;
|
||||
int delta;
|
||||
int decay;
|
||||
unsigned int cp; /* unsigned int */
|
||||
int state, loopState, loopDir;
|
||||
int note, vol, ch, isUsed;
|
||||
int curRate, curOffset, targetOffset;
|
||||
int curPoint;
|
||||
signed short int volscale;
|
||||
};
|
||||
|
||||
struct SynthObject voices[MAX_VOICES] IBSS_ATTR;
|
||||
|
||||
void sendEvent(struct Event * ev);
|
||||
inline void setPoint(struct SynthObject * so, int pt);
|
||||
struct Event * getEvent(struct Track * tr, int evNum);
|
||||
int readTwoBytes(int file);
|
||||
int readFourBytes(int file);
|
||||
int readVarData(int file);
|
||||
int midimain(void * filename);
|
||||
|
||||
|
||||
void *alloc(int size)
|
||||
{
|
||||
static char *offset = NULL;
|
||||
|
@ -180,7 +70,6 @@ void *alloc(int size)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Rick's code */
|
||||
/*
|
||||
void *alloc(int size)
|
||||
|
@ -267,3 +156,4 @@ void exit(int code)
|
|||
{
|
||||
code = code; /* Stub function, kill warning for now */
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue