XFuXMPlayer_internal.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# XFuXMPlayer_internal.h

Go to the documentation of this file.

    00001 /*! \file
    00002  * X-Forge Util <br>
    00003  * Copyright 2000-2003 Fathammer Ltd
    00004  *
    00005  * \brief XM player internal structures header file
    00006  *
    00007  * $Id: XFuXMPlayer_internal.h,v 1.16 2003/10/10 11:34:51 toni Exp $
    00008  * $Date: 2003/10/10 11:34:51 $
    00009  * $Revision: 1.16 $
    00010  */
    00011
    00012 #ifndef XFUXMPLAYER_INTERNAL_H_INCLUDED
    00013 #define XFUXMPLAYER_INTERNAL_H_INCLUDED
    00014
    00015
    00016 const UINT16 XMFORMAT_SIZEOF_ENVELOPE = 325;
    00017 const UINT16 XMFORMAT_SIZEOF_WAVEFORM = 64;
    00018 const UINT16 XMFORMAT_SIZEOF_KEYBOARD = 96;
    00019
    00020 const UINT16 XMFORMAT_SAMPLE_16BIT = 16;
    00021
    00022 //! Fixed point accuracy.
    00023 const INT32 FP_BITS = 12;
    00024 const INT32 FP_VALUE = (1 << FP_BITS);
    00025
    00026 const INT32 VOLUME_FP_BITS = 16;
    00027
    00028 const INT32 VOLUME_RAMP_WIDTH = 32;
    00029
    00030 enum XMPLAYER_LOOP_TYPE
    00031 {
    00032     LOOP_FORWARD = 1,
    00033     LOOP_PINGPONG = 2
    00034 };
    00035
    00036 enum XMPLAYER_ENVELOPE_TYPE
    00037 {
    00038     ENVELOPE_ON = 1,
    00039     ENVELOPE_SUSTAIN = 2,
    00040     ENVELOPE_LOOP = 4
    00041 };
    00042
    00043 enum XMPLAYER_WAVEFORM
    00044 {
    00045     WAVEFORM_SINEWAVE = 0,
    00046     WAVEFORM_RAMPDOWN = 1,
    00047     WAVEFORM_SQUAREWAVE = 2,
    00048     WAVEFORM_NO_RETRIG = 4
    00049 };
    00050
    00051 enum XMPLAYER_XM_VIBRATO_WAVEFORM
    00052 {
    00053     XM_VIBRATO_WAVEFORM_SINEWAVE = 0,
    00054     XM_VIBRATO_WAVEFORM_SQUAREWAVE = 1,
    00055     XM_VIBRATO_WAVEFORM_RAMPDOWN = 2,
    00056     XM_VIBRATO_WAVEFORM_RAMPUP = 3
    00057 };
    00058
    00059
    00060 class XFuXMFormatAtom
    00061 {
    00062 public:
    00063     UINT8 mNote;
    00064     UINT8 mInstrumentNb;
    00065     UINT8 mVolume;
    00066     UINT8 mEffectType;
    00067     UINT8 mEffectValue;
    00068 };
    00069
    00070
    00071 class XFuXMFormatHeader
    00072 {
    00073 public:
    00074     UINT8 mIdString[17 + 1];    //!< ID text: 'Extended module: ' (+ extra byte for \0).
    00075     UINT8 mModuleName[20 + 1];  //!< Module name (+ extra byte for \0).
    00076     UINT8 mH1A;                 //!< $1A.
    00077     UINT8 mTrackerName[20 + 1]; //!< Tracker name  (+ extra byte for \0).
    00078     UINT16 mVersion;            //!< Version number, hi-UINT8 major, lo-UINT8 minor.
    00079
    00080     UINT32 mHeaderSize;         //!< Header size.
    00081
    00082     UINT16 mSongLength;         //!< Song length in pattern order table.
    00083     UINT16 mRestartPosition;    //!< Song restart position.
    00084     UINT16 mNbChannels;         //!< Number of channels.
    00085     UINT16 mNbPatterns;         //!< Number of patterns.
    00086     UINT16 mNbInstruments;      //!< Number of instruments.
    00087
    00088     /*! Bit 0:
    00089      * \li 0 = Amiga frequency table
    00090      * \li 1 = Linear frequency table
    00091      */
    00092     UINT16 mFlags;
    00093
    00094     UINT16 mTempo;            //!< Default tempo (0..31).
    00095     UINT16 mBpm;              //!< Default bpm (0..255).
    00096
    00097     UINT8 mOrderTable[256];   //!< Pattern order table.
    00098 };
    00099
    00100
    00101 class XFuXMFormatPatternHeader
    00102 {
    00103 public:
    00104     UINT32 mHeaderLength;               //!< Pattern header length.
    00105     UINT8 mPackingType;                 //!< Packing type, always 0.
    00106     UINT16 mNbRows;                     //!< Number of rows in pattern (0..256).
    00107     UINT16 mSize;                       //!< Packed patterndata size.
    00108 };
    00109
    00110
    00111 class XFuXMFormatInstrumentHeader
    00112 {
    00113 public:
    00114     UINT32 mSize;                       //!< Instrument size.
    00115     UINT8 mInstrumentName[22 + 1];      //!< Instrument name (+ extra byte for \0).
    00116     UINT8 mType;                        //!< Instrument type, always 0.
    00117     UINT16 mNbSamples;                  //!< Number of samples in instrument.
    00118 };
    00119
    00120
    00121 class XFuXMFormatInstrument
    00122 {
    00123 public:
    00124     UINT32 mSampleHeaderSize;       //!< Sample header size.
    00125
    00126     UINT8 mKeyboard[96];            //!< Sample number for all notes.
    00127
    00128     UINT16 mVolumeEnvelope[24];     //!< Points for volume envelope.
    00129     UINT16 mPanningEnvelope[24];    //!< Points for panning envelope.
    00130     UINT8 mNbVolEnvPoints;          //!< Number of volume envelope points.
    00131     UINT8 mNbPanEnvPoints;          //!< Number of panning envelope points.
    00132     UINT8 mVolEnvSustain;           //!< Volume envelope sustain point.
    00133     UINT8 mVolEnvLoopStart;         //!< Volume envelope loop start point.
    00134     UINT8 mVolEnvLoopEnd;           //!< Volume envelope loop end point.
    00135     UINT8 mPanEnvSustain;           //!< Panning envelope sustain point.
    00136     UINT8 mPanEnvLoopStart;         //!< Panning envelope loop start point.
    00137     UINT8 mPanEnvLoopEnd;           //!< Panning envelope loop end point.
    00138     //! Volume envelope type.
    00139     /*! \li Bit 0: On
    00140      *  \li Bit 1: Sustain
    00141      *  \li Bit 2: Loop
    00142      */
    00143     UINT8 mVolEnvType;
    00144     //! Panning envelope type.
    00145     /*! \li Bit 0: On
    00146      *  \li Bit 1: Sustain
    00147      *  \li Bit 2: Loop
    00148      */
    00149     UINT8 mPanEnvType;
    00150
    00151     UINT8 mVibratoType;             //!< Vibrato type.
    00152     UINT8 mVibratoSweep;            //!< Vibrato sweep.
    00153     UINT8 mVibratoDepth;            //!< Vibrato depth.
    00154     UINT8 mVibratoRate;             //!< Vibrato rate.
    00155
    00156     UINT16 mVolumeFadeout;          //!< Volume fadeout speed.
    00157
    00158     UINT16 mReserved;               //!< Reserved.
    00159 };
    00160
    00161
    00162 class XFuXMFormatSample
    00163 {
    00164 public:
    00165     UINT32 mSampleLength;       //!< Sample length.
    00166     UINT32 mLoopStart;          //!< Sample loop start.
    00167     UINT32 mLoopLength;         //!< Sample loop length.
    00168     UINT8 mVolume;              //!< Volume.
    00169     INT8 mFinetune;             //!< Finetune (signed byte -128..+127).
    00170     //! Sample type.
    00171     /*! Bit 0-1:
    00172      * \li 0 = No loop
    00173      * \li 1 = Forward loop
    00174      * \li 2 = Ping-pong loop
    00175      * \par Bit 4: 16-bit sample data
    00176      */
    00177     UINT8 mType;
    00178
    00179     UINT8 mPan;                 //!< Panning (0..255).
    00180     INT8 mRelativeNote;         //!< Relative note number (signed byte).
    00181
    00182     UINT8 mReserved;            //!< Reserved.
    00183
    00184     UINT8 mSampleName[22 + 1];  //!< Sample name (+ extra byte for \0).
    00185 };
    00186
    00187
    00188 class XFuXMSong
    00189 {
    00190 public:
    00191     UINT8 *mOrderTable;                 //!< Pattern order table, MAX_ORDERS.
    00192     UINT16 mSongLength;                 //!< Song length in pattern order table.
    00193     UINT16 mRestartPosition;            //!< Song restart position.
    00194
    00195     UINT16 mNbPatterns;                 //!< Number of patterns.
    00196     UINT16 mNbChannels;                 //!< Number of channels.
    00197     UINT16 mNbInstruments;              //!< Number of instruments.
    00198
    00199     UINT16 mTempo;                      //!< Tempo (0..31), tick count.
    00200     UINT16 mBpm;                        //!< Bpm (0..255), tick speed.
    00201
    00202     INT8 mGlobalVolume;                 //!< Global volume.
    00203 };
    00204
    00205
    00206 class XFuXMSample
    00207 {
    00208 public:
    00209     UINT8 mVolume;                      //!< Volume (0..63).
    00210     UINT8 mPan;                         //!< Panning (-128..+127).
    00211     INT8 mFinetune;                     //!< Finetune (signed byte -128..+127).
    00212     INT8 mRelativeNote;                 //!< Relative note number (signed byte).
    00213
    00214     void *mOffset;                      //!< Sample address in memory.
    00215     UINT32 mSize;                       //!< Sample size.
    00216
    00217     UINT8 mLoopForward;                 //!< Forward loop.
    00218     UINT8 mLoopPingpong;                //!< Pingpong loop.
    00219     UINT32 mLoopStart;                  //!< Sample loop start.
    00220     UINT32 mLoopEnd;                    //!< Sample loop end.
    00221
    00222     UINT8 m16Bit;                       //!< 16-bit sample flag.
    00223 };
    00224
    00225
    00226 class XFuXMInstrument
    00227 {
    00228 public:
    00229     UINT16 mNbSamples;                  //!< Number of samples in instrument.
    00230     XFuXMSample *mSamples;              //!< MAX_SAMPLES.
    00231
    00232     UINT8 mKeyboard[XMFORMAT_SIZEOF_KEYBOARD];   //!< Sample number for all notes.
    00233
    00234     REAL mVolumeEnvelope[XMFORMAT_SIZEOF_ENVELOPE];
    00235     UINT16 mVolEnvEnd;                  //!< Volume envelope end point.
    00236     UINT8 mVolEnvType;                  //!< Volume envelope flag.
    00237     UINT16 mVolEnvLoopStart;            //!< Volume envelope loop start.
    00238     UINT16 mVolEnvLoopEnd;              //!< Volume envelope loop end.
    00239     UINT16 mVolEnvSustain;              //!< Volume envelope sustain point.
    00240
    00241     REAL mVolumeFadeout;                //!< Volume fadeout speed.
    00242
    00243     UINT8 mPanningEnvelope[XMFORMAT_SIZEOF_ENVELOPE];
    00244     UINT16 mPanEnvEnd;                  //!< Panning envelope end point.
    00245     UINT8 mPanEnvType;                  //!< Panning envelope flag.
    00246     UINT16 mPanEnvLoopStart;            //!< Panning envelope loop start.
    00247     UINT16 mPanEnvLoopEnd;              //!< Panning envelope loop end.
    00248     UINT16 mPanEnvSustain;              //!< Panning envelope sustain point.
    00249
    00250     UINT8 mIsVibrato;                   //!< Vibrato flag.
    00251     UINT8 mVibratoType;                 //!< Vibrato type.
    00252     UINT8 mVibratoSweep;                //!< Vibrato sweep.
    00253     UINT8 mVibratoDepth;                //!< Vibrato depth.
    00254     UINT8 mVibratoRate;                 //!< Vibrate rate.
    00255 };
    00256
    00257
    00258 class XFuXMPattern
    00259 {
    00260 public:
    00261     UINT8 *mData;               //!< Pattern data.
    00262     UINT32 *mRows;              //!< Pointer to row in pattern, MAX_PATTERN_ROWS.
    00263 };
    00264
    00265
    00266 class XFuXMChannel
    00267 {
    00268 public:
    00269     XFuXMFormatAtom mTa;
    00270
    00271     INT mIsValid;                       //! Data validity flag.
    00272     INT mInitSample;                    //! Sample initialization flag.
    00273
    00274     INT32 mPointer;                     //! Pointer to current position in sample data.
    00275
    00276     XFuXMInstrument mCurrentInstrument;  //!< Current instrument.
    00277     XFuXMSample mCurrentSample;          //!< Current sample.
    00278
    00279     void * mOffset;                     //!< Sample address in memory.
    00280     INT32 mLength;                      //!< Sample size.
    00281     INT16 mInstrumentNb;                //!< Instrument number.
    00282     UINT32 mSpeed;                      //!< Speed.
    00283     //! Sample loop type.
    00284     /*! \li 0 = Off
    00285      *  \li 1 = Forward
    00286      *  \li 2 = Pingpong
    00287      */
    00288     UINT8 mLoop;
    00289     INT32 mLoopStart;                   //!< Sample loop start.
    00290     INT32 mLoopEnd;                     //!< Sample loop end.
    00291
    00292     UINT8 mIsSample;                    //!< Sample availability flag.
    00293
    00294     INT8 mNote;                         //!< Current note.
    00295     INT8 mFinetune;                     //!< Current finetune.
    00296
    00297     INT8 mDirection;                    //!< Sample direction: +1 = Forwards, -1 = Backwards.
    00298
    00299     UINT8 mVolEnvType;                  //!< Volume envelope type.
    00300     UINT16 mVolEnvPointer;              //!< Volume envelope pointer.
    00301     UINT8 mVolEnvSpeed;                 //!< Volume envelope speed.
    00302     UINT16 mVolEnvLoopStart;            //!< Volume envelope loop start.
    00303     UINT16 mVolEnvLoopEnd;              //!< Volume envelope loop end.
    00304     UINT16 mVolEnvSustain;              //!< Volume envelope sustain point.
    00305     REAL mVolEnvValue;                  //!< Volume envelope value.
    00306     REAL mVolumeFadeout;                //!< Volume envelope fadeout.
    00307     REAL mVolumeFadeoutValue;           //!< Volume envelope fadeout value.
    00308
    00309     INT8 mVolume;                       //!< Volume.
    00310     INT8 mBaseVolume;                   //!< Base volume.
    00311     REAL mFinalVolume;                  //!< Final volume, used for ramping.
    00312     REAL mFinalOldVolume;               //!< Final old volume, used for ramping.
    00313     REAL mFinalVolumeSpeed;             //!< Final volume ramp speed.
    00314
    00315     UINT8 mPanEnvType;                  //!< Panning envelope type.
    00316     UINT16 mPanEnvPointer;              //!< Panning envelope pointer.
    00317     UINT8 mPanEnvSpeed;                 //!< Panning envelope speed.
    00318     UINT16 mPanEnvLoopStart;            //!< Panning envelope loop start.
    00319     UINT16 mPanEnvLoopEnd;              //!< Panning envelope loop end.
    00320     UINT16 mPanEnvSustain;              //!< Panning envelope sustain point.
    00321     UINT8 mPanEnvValue;                 //!< Panning envelope value.
    00322     UINT8 mPan;                          //!< Pan.
    00323     INT16 mFinalPan;                    //!< Final pan.
    00324
    00325     UINT8 mSustainReleased;             //!< Sustain release flag.
    00326
    00327     UINT8 mVolumeColumn;                //!< Volume column effect.
    00328
    00329     UINT8 mEffectType;                  //!< Effect type.
    00330     UINT8 mEffectValue;                 //!< Effect value.
    00331
    00332     UINT8 mPortamentoUpV;               //!< Portamento up value.
    00333     UINT8 mPortamentoDownV;             //!< Portamento down value.
    00334     UINT8 mTonePortamentoV;             //!< Tone portamento value.
    00335     UINT8 mVolumeSlideV;                //!< Volume slide value.
    00336     UINT8 mFinePortamentoUpV;           //!< Fine portamento up value.
    00337     UINT8 mFinePortamentoDownV;         //!< Fine portamento down value.
    00338     UINT8 mFineVolumeSlideUpV;          //!< Fine volume slide up value.
    00339     UINT8 mFineVolumeSlideDownV;        //!< Fine volume slide down value.
    00340     UINT8 mGlobalVolumeSlideV;          //!< Global volume slide value.
    00341     UINT8 mMultiRetrigVolumeV;          //!< Multi retrig note volume change.
    00342     UINT8 mMultiRetrigRateV;            //!< Multi retríg note rate.
    00343     UINT8 mTremorV;                     //!< Tremor value.
    00344     UINT8 mExtraFinePortamentoUpV;      //!< Extra fine portamento up value.
    00345     UINT8 mExtraFinePortamentoDownV;    //!< Extra fine portamento down value.
    00346     UINT8 mPanningSlideV;               //!< Panning slide value.
    00347
    00348     UINT32 mMultiRetrigTicker;          //!< Multi retrig ticker.
    00349     UINT32 mTremorTicker;               //!< Tremor ticker.
    00350
    00351     UINT32 mPeriod;                     //!< Period.
    00352     UINT32 mOldPeriod;                  //!< Old line period.
    00353     UINT32 mDestPeriod;                 //!< Current line period.
    00354     UINT32 mBasePeriod;                 //!< Base period.
    00355
    00356     UINT8 mIsVibrato;                   //!< Vibrato flag.
    00357     UINT8 mVibratoRate;                 //!< Vibrato rate.
    00358     UINT8 mVibratoDepth;                //!< Vibrato depth.
    00359     UINT8 mVibratoPointer;              //!< Vibrato pointer.
    00360     UINT8 mVibratoWaveform;             //!< Vibrato waveform.
    00361
    00362     UINT8 mTremoloRate;                 //!< Tremolo rate.
    00363     UINT8 mTremoloDepth;                //!< Tremolo depth.
    00364     UINT8 mTremoloPointer;              //!< Tremolo pointer.
    00365     UINT8 mTremoloWaveform;             //!< Tremolo waveform.
    00366 };
    00367
    00368
    00369 #endif // !XFUXMPLAYER_INTERNAL_H_INCLUDED
    00370

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch