22 #ifndef SCUMM_IMUSE_PCSPK_H 23 #define SCUMM_IMUSE_PCSPK_H 25 #include "audio/softsynth/emumidi.h" 26 #include "audio/softsynth/pcspk.h" 36 void close()
override;
38 void send(uint32 d)
override;
41 MidiChannel *getPercussionChannel()
override {
return nullptr; }
46 void generateSamples(int16 *buf,
int len)
override;
47 void onTimer()
override;
55 void output(uint16 out);
57 static uint8 getEffectModifier(uint16 level);
58 int16 getEffectModLevel(int16 level, int8 mod);
59 int16 getRandScale(int16 input);
61 struct EffectEnvelope {
68 uint8 stateTargetLevels[4];
69 uint8 stateModWheelLevels[4];
70 uint8 modWheelSensitivity;
74 int16 stateStepCounter;
77 int16 changePerStepRem;
81 struct EffectDefinition {
85 EffectEnvelope *envelope;
88 struct OutputChannel {
93 const uint8 *instrument;
98 EffectEnvelope effectEnvelopeA;
99 EffectDefinition effectDefA;
100 EffectEnvelope effectEnvelopeB;
101 EffectDefinition effectDefB;
108 MidiDriver *device()
override {
return _owner; }
109 byte getNumber()
override {
return _number; }
110 void release()
override;
112 void send(uint32 b)
override;
113 void noteOff(byte note)
override;
114 void noteOn(byte note, byte velocity)
override;
115 void programChange(byte program)
override;
116 void pitchBend(int16 bend)
override;
117 void controlChange(byte control, byte value)
override;
118 void pitchBendFactor(byte value)
override;
119 void transpose(int8 value)
override;
120 void detune(int16 value)
override;
121 void priority(byte value)
override;
122 void sysEx_customInstrument(uint32 type,
const byte *instr, uint32 dataSize)
override;
128 uint8 _instrument[23];
139 uint8 _pitchBendFactor;
145 void setupEffects(MidiChannel_PcSpk &chan, EffectEnvelope &env, EffectDefinition &def, byte flags,
const byte *data);
146 void startEffect(EffectEnvelope &env,
const byte *data);
147 void initNextEnvelopeState(EffectEnvelope &env);
148 void updateEffectGenerator(MidiChannel_PcSpk &chan, EffectEnvelope &env, EffectDefinition &def);
149 uint8 advanceEffectEnvelope(EffectEnvelope &env, EffectDefinition &def);
151 MidiChannel_PcSpk *_channels[6];
152 MidiChannel_PcSpk *_activeChannel;
154 MidiChannel_PcSpk *_lastActiveChannel;
155 uint16 _lastActiveOut;
157 static const byte _outInstrumentData[1024];
158 static const byte _outputTable1[];
159 static const byte _outputTable2[];
160 static const uint16 _effectEnvStepTable[];
161 static const uint16 _frequencyTable[];
void send(uint32 d) override
bool isStereo() const override
Definition: pcspk.h:43
int getRate() const override
Definition: pcspk.h:44
Definition: mididrv.h:309
Definition: mididrv.h:537
bool isStereo() const
Definition: pcspk.h:90
int getRate() const
Definition: pcspk.h:93