22 #ifndef MADS_NEBULAR_ASOUND_H 23 #define MADS_NEBULAR_ASOUND_H 25 #include "audio/fmopl.h" 26 #include "mads/core/sound_manager.h" 29 namespace RexNebular {
42 int _volumeFadeStep = 0;
43 int _attenFadeStep = 0;
49 int _volumeFadeCounter = 0;
50 int _volumeFadeReload = 0;
51 uint8 _attenFadeCounter = 0;
52 int _attenFadeReload = 0;
53 int _patchAttenuation = 0;
55 byte *_ptr1 =
nullptr;
56 byte *_pSrc =
nullptr;
57 byte *_innerLoopPtr =
nullptr;
58 byte *_outerLoopPtr =
nullptr;
59 int _innerLoopCount = 0;
60 int _outerLoopCount = 0;
61 byte *_soundData =
nullptr;
63 int _volumeOffset = 0;
64 int _octaveTranspose = 0;
72 byte _channelAttenuation = 0;
75 static bool _channelsEnabled;
80 void enable(
int flag);
81 void setPtr2(byte *pData);
82 void load(byte *pData);
83 void check(byte *nullPtr);
125 _regNum = regNum; _value = value;
129 #define ADLIB_CHANNEL_COUNT 9 130 #define ADLIB_CHANNEL_MIDWAY 5 159 void checkChannels();
164 void pollActiveChannel();
171 void updateChannelState();
172 void updateActiveChannel();
177 void processSample();
179 void updateFNumber();
187 int _chanCommandCount;
190 virtual void channelCommand(byte *&pSrc,
bool &updateFlag) = 0;
206 return &_soundData[offset];
209 int getDataOffset(byte *ptr)
const {
210 return ptr - &_soundData[0];
216 void loadSample(
int sampleIndex);
221 void write(
int reg,
int val);
226 int write2(
int state,
int reg,
int val);
236 void channelOn(
int reg,
int volume);
241 void channelOff(
int reg);
252 void playSound(
int offset);
259 playSoundData(loadData(offset), 0);
267 void playSoundData(byte *pData,
int startingChannel = ADLIB_CHANNEL_MIDWAY);
272 bool isSoundActive(byte *pData);
277 void setFrequency(
int channel,
int freq);
282 int getRandomNumber();
288 byte *getDataPtr(
int nearPtr);
290 virtual int command0();
314 int _activeChannelNumber;
319 int _noiseChannel1, _noiseChannel2;
322 int _savedNoiseTicks1;
323 int _savedNoiseTicks2;
329 int _activeChannelReg;
331 bool _amDep, _vibDep, _splitPoint;
337 static void validate();
367 void noise()
override;
373 return _frameCounter;
379 void setVolume(
int volume)
override;
385 void channelCommand(byte *&pSrc,
bool &updateFlag)
override;
void playSoundAny(int offset)
Definition: asound.h:258
byte * loadData(int offset)
Definition: asound.h:205
virtual void tickCallback()
Definition: asound.h:199
Definition: sound_manager.h:38
Definition: anim_timer.h:27
int getFrameCounter()
Definition: asound.h:372