Mercurial > hg > dmlib
view jssplr.h @ 60:f28cd66356f6
Initial work for bitmapped fonts and text drawing. Also moved TTF header
stuff to dmtext.h.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 01 Oct 2012 09:46:56 +0300 |
parents | e0e470c3fc8e |
children | 2884a611042b |
line wrap: on
line source
/* * miniJSS - Module playing routines * Programmed and designed by Matti 'ccr' Hamalainen * (C) Copyright 2006-2007 Tecnic Software productions (TNSP) */ #ifndef JSSPLR_H #define JSSPLR_H #include "jss.h" #include "jssmod.h" #include "jssmix.h" // Player general constants #define mpMinVol (0) #define mpMaxVol (64) #define mpPanCenter (0) #define mpMaxFadeoutVol (65535) // Channel New-Data flags #define cdfNONE (0x00) // Set nothing #define cdfNewInstr (0x01) // Set a new instrument #define cdfNewPitch (0x02) // Set a new pitch #define cdfNewPos (0x04) // Set a new position #define cdfNewVolume (0x08) // Set a new volume #define cdfNewPanPos (0x10) // Set a new panning position #define cdfNewGlobalVol (0x20) // Set a new global volume #define cdfStop (0x80) // Stop channel playing // Player channel structure typedef struct { int iPatLoopRow, // Pattern loop start row iPatLoopCount, // Pattern loop count iLastPortaParam, // Last portamento effect parameter iLastPortaToNoteParam, // Last porta-to-note parameter iLastPortaToNotePitch, // Last porta-to-note pitch iVibratoPos, // Vibrato waveform position iVibratoSpeed, // Vibrato speed iVibratoDepth, // Vibrato depth iVibratoWC, // Vibrato wave control iTremoloPos, // Tremolo waveform position iTremoloSpeed, // Tremolo speed iTremoloDepth, // Tremolo depth iTremoloWC, // Tremolo wave control iLastTremorParam, iTremorCount, iLastSampleOffset, iLastRetrigParam, iLastVolSlideParam, iRetrigNDFlags, // For retrig-effect iSaveNDFlags; // For notedelay-effect // Current channel data JSSInstrument *iCInstrument; // Instrument JSSExtInstrument *iCExtInstrument; // ExtInstrument int iCInstrumentN, iCExtInstrumentN, iCNote, // Current note iCPitch, // Pitch (NOT actual frequency!) iCOldPitch, iCPosition, // Sample position iCVolume, // Volume iCPanning, // Panning position iCNewDataFlags, // New data flags iCFadeOutVol, iCPanEnv, iCVolEnv, iCAutoVib_Frames, iCPanEnv_Frames, iCVolEnv_Frames, iCLastFineVolumeslideUpParam, iCLastFineVolumeslideDownParam, iCLastExtraFinePortamentoUpParam, iCLastExtraFinePortamentoDownParam, iCLastFinePortamentoUpParam, iCLastFinePortamentoDownParam; BOOL iCPanEnv_Exec, iCVolEnv_Exec, iCKeyOff; } JSSPlayerChannel; // Struct holding all player related information typedef struct { // General variables int tempo, // Current values speed, tick, order, npattern, row, globalVol, options; // Playing option flags BOOL isPlaying; // Are we playing? int newOrder, // NEW order number newRow; // NEW row number BOOL newOrderSet, // TRUE if new order has been set newRowSet; // TRUE if new row has been set int patternDelay, // Pattern delay tick-counter lastPatLoopRow; // Latest set pattern loop row (any channel) // All channels for this player // int nchannels; JSSPlayerChannel channels[jsetNChannels]; // Parameters for effects, etc BOOL jumpFlag, // Pattern jump flag breakFlag; // Pattern break flag // Module and sounddevice specific JSSModule *module; // Current module in this player JSSPattern *pattern; // Current pattern JSSMixer *device; // Pointer to mixing device structure #ifdef JSS_SUP_THREADS DMMutex *mutex; #endif } JSSPlayer; /* External functions for end users */ int jmpPlayOrder(JSSPlayer *, int); int jmpPlayPattern(JSSPlayer *, int); void jmpStop(JSSPlayer *); void jmpResume(JSSPlayer *); void jmpSetModule(JSSPlayer *, JSSModule *); JSSPlayer * jmpInit(JSSMixer *); int jmpClose(JSSPlayer *); void jmpExec(void *, void *); /* Helper macros */ #define JMPMAKEPARAM(AIVAL, AVALX, AVALY) { AVALX = (((AIVAL) >> 4) & 0x0f); AVALY = ((AIVAL) & 0x0f); } #define JMPSETNDFLAGS(IVAL) chn->iCNewDataFlags |= IVAL #define JMPUNSETNDFLAGS(IVAL) chn->iCNewDataFlags &= (~(IVAL)) #define JMPGETNOTE(MNOTE, MROW, MCHAN) assert(mp); assert(mp->pattern); assert((MROW) >= 0); assert((MROW) < mp->pattern->nrows); MNOTE = &mp->pattern->data[(mp->pattern->nchannels * MROW) + (MCHAN)] #define JMPGETEFFECT(MEFF, MIEFF) if ((MIEFF >= 0) && (MIEFF < jmpNMODEffectTable)) MEFF = jmpMODEffectTable[MIEFF]; else MEFF = 0 #define JMPGETMODFLAGS(Q, Z) ((Q->module->defFlags & (Z)) == (Z)) /* Debugging macros */ #if !defined(JSS_LIGHT) && defined(JSS_DEBUG) # define JMPDEBUG(QQ) { fprintf(stderr, "[o=%03d:p=%03d:r=%03d] (%c/%x:%x) %s\n", mp->iOrder, mp->iPattern, mp->iRow, effect, currNote->effect, currNote->param, QQ ); } #else # define JMPDEBUG(QQ) // stub #endif #endif // JSSPLR_H