22 #if !defined(SCUMM_SMUSH_PLAYER_H) && defined(ENABLE_SCUMM_7_8) 23 #define SCUMM_SMUSH_PLAYER_H 25 #include "common/util.h" 29 class QueuingAudioStream;
34 #define SMUSH_MAX_TRACKS 4 35 #define SMUSH_FADE_SIZE 0xC00 38 #define IS_BKG_MUSIC 0x40 39 #define IS_SPEECH 0x80 45 #define GRP_MASTER 0xFF01 46 #define GRP_SFX 0xFF02 47 #define GRP_BKGMUS 0xFF03 48 #define GRP_SPEECH 0xFF04 50 #define TRK_STATE_INACTIVE 0 51 #define TRK_STATE_PLAYING 1 52 #define TRK_STATE_FADING 2 53 #define TRK_STATE_ENDING 3 55 #define TRK_TYPE_MASK 0xC0 57 #define SAUD_OP_INIT 1 58 #define SAUD_OP_UPDATE_HEADER 2 59 #define SAUD_OP_SET_PARAM 3 60 #define SAUD_OP_INCR_PARAM 4 61 #define SAUD_OP_SET_OFFSET 6 62 #define SAUD_OP_SET_LENGTH 7 63 #define SAUD_OP_COMPARE_GT 8 64 #define SAUD_OP_COMPARE_LT 9 65 #define SAUD_OP_COMPARE_EQ 10 66 #define SAUD_OP_COMPARE_NE 11 68 #define SAUD_VALUEID_ALL_VOLS 0xFF 69 #define SAUD_VALUEID_TRK_VOL 0xFE 70 #define SAUD_VALUEID_TRK_PAN 0xFD 72 #define TRK_USERID_SPEECH 1 73 #define TRK_USERID_MUSIC 2 74 #define TRK_USERID_SFX 3 76 #define SMUSH_CODEC_RLE 1 77 #define SMUSH_CODEC_RLE_ALT 3 78 #define SMUSH_CODEC_UNCOMPRESSED 20 79 #define SMUSH_CODEC_DELTA_BLOCKS 37 80 #define SMUSH_CODEC_DELTA_GLYPHS 47 86 class SmushDeltaBlocksDecoder;
87 class SmushDeltaGlyphsDecoder;
94 struct SmushAudioDispatch {
110 struct SmushAudioTrack {
124 int32 audioRemaining;
129 IMuseDigital *_imuseDigital;
132 int16 _deltaPal[0x300];
133 int32 _shiftedDeltaPal[0x300];
136 StringResource *_strings;
137 SmushDeltaBlocksDecoder *_deltaBlocksCodec;
138 SmushDeltaGlyphsDecoder *_deltaGlyphsCodec;
142 byte *_specialBuffer;
157 bool _compressedFileMode;
158 byte _IACToutput[4096];
167 int _palDirtyMin, _palDirtyMax;
175 SmushAudioTrack _smushTracks[SMUSH_MAX_TRACKS];
176 SmushAudioDispatch _smushDispatch[SMUSH_MAX_TRACKS];
178 int _smushMaxFrames[SMUSH_MAX_TRACKS];
179 int _smushTrackIds[SMUSH_MAX_TRACKS];
180 int _smushTrackIdxs[SMUSH_MAX_TRACKS];
181 uint8 _smushAudioTable[256];
183 int _smushTrackFlags[SMUSH_MAX_TRACKS];
184 int _smushTrackVols[SMUSH_MAX_TRACKS];
186 int _smushAudioSampleRate;
187 int _gainReductionLowerBound;
188 int _gainReductionFactor;
189 int _gainReductionMultiplier;
191 bool _smushTracksNeedInit;
192 bool _smushAudioInitialized;
193 bool _smushAudioCallbackEnabled;
196 SmushPlayer(ScummEngine_v7 *scumm, IMuseDigital *_imuseDigital, Insane *insane);
202 void play(
const char *filename, int32 speed, int32 offset = 0, int32 startFrame = 0);
204 void warpMouse(
int x,
int y,
int buttons);
205 int setChanFlag(
int id,
int flagVal);
206 void setGroupVolume(
int groupId,
int volValue);
207 void processDispatches(int16 feedSize);
208 bool isAudioCallbackEnabled();
209 byte *getVideoPalette();
210 void setCurVideoFlags(int16 flags);
216 int _origPitch, _origNumStrips;
218 uint32 _pauseStartTime;
220 int16 _curVideoFlags = 0;
223 void setPalette(
const byte *palette);
224 void setPaletteValue(
int n, byte r, byte g, byte b);
225 void setDirtyColors(
int min,
int max);
226 void seekSan(
const char *file, int32 pos, int32 contFrame);
227 const char *getString(
int id);
230 SmushFont *getFont(
int font);
231 void parseNextFrame();
232 void init(int32 spped);
233 void setupAnim(
const char *file);
235 void tryCmpFile(
const char *filename);
237 bool readString(
const char *file);
238 void decodeFrameObject(
int codec,
const uint8 *src,
int left,
int top,
int width,
int height);
244 void handleSAUDChunk(uint8 *srcBuf, uint32 size,
int groupId,
int vol,
int pan, int16 flags,
int trkId,
int index,
int maxFrames);
252 void initAudio(
int samplerate, int32 maxChunkSize);
253 void terminateAudio();
254 int isChanActive(
int flagId);
255 int addAudioTrack(int32 trackBlockSize, int32 maxBlockSize);
256 void resetAudioTracks();
257 void setGainReductionParams(int16 gainReductionLowerBound, int16 gainReductionMultiplier);
258 void fillAudioTrackInfo(uint8 *srcBuf, uint16 *flagsAccumulator, uint32 size,
int groupId,
int vol,
int pan, int16 flags,
int trkId,
int index,
int maxFrames);
259 bool processAudioCodes(
int idx, int32 &tmpFeedSize,
int &mixVolume);
260 void feedAudio(uint8 *srcBuf,
int groupId,
int volume,
int pan, int16 flags);
261 void sendAudioToDiMUSE(uint8 *mixBuf, int32 mixStartingPoint, int32 mixFeedSize, int32 mixInFrameCount,
int volume,
int pan);
263 void timerCallback();
Definition: audiostream.h:370