Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUDIO: Use override #3524

Merged
merged 1 commit into from Nov 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 34 additions & 34 deletions audio/adlib.cpp
Expand Up @@ -130,33 +130,33 @@ class AdLibPart : public MidiChannel {
#endif
}

MidiDriver *device();
byte getNumber() { return _channel; }
void release() { _allocated = false; }
MidiDriver *device() override;
byte getNumber() override { return _channel; }
void release() override { _allocated = false; }

void send(uint32 b);
void send(uint32 b) override;

// Regular messages
void noteOff(byte note);
void noteOn(byte note, byte velocity);
void programChange(byte program);
void pitchBend(int16 bend);
void noteOff(byte note) override;
void noteOn(byte note, byte velocity) override;
void programChange(byte program) override;
void pitchBend(int16 bend) override;

// Control Change messages
void controlChange(byte control, byte value);
void modulationWheel(byte value);
void volume(byte value);
void panPosition(byte value);
void pitchBendFactor(byte value);
void detune(byte value);
void priority(byte value);
void sustain(bool value);
void effectLevel(byte value) { return; } // Not supported
void chorusLevel(byte value) { return; } // Not supported
void allNotesOff();
void controlChange(byte control, byte value) override;
void modulationWheel(byte value) override;
void volume(byte value) override;
void panPosition(byte value) override;
void pitchBendFactor(byte value) override;
void detune(byte value) override;
void priority(byte value) override;
void sustain(bool value) override;
void effectLevel(byte value) override { return; } // Not supported
void chorusLevel(byte value) override { return; } // Not supported
void allNotesOff() override;

// SysEx messages
void sysEx_customInstrument(uint32 type, const byte *instr);
void sysEx_customInstrument(uint32 type, const byte *instr) override;
};

// FYI (Jamieson630)
Expand All @@ -173,19 +173,19 @@ class AdLibPercussionChannel : public AdLibPart {
public:
~AdLibPercussionChannel();

void noteOff(byte note);
void noteOn(byte note, byte velocity);
void programChange(byte program) { }
void noteOff(byte note) override;
void noteOn(byte note, byte velocity) override;
void programChange(byte program) override { }

// Control Change messages
void modulationWheel(byte value) { }
void pitchBendFactor(byte value) { }
void detune(byte value) { }
void priority(byte value) { }
void sustain(bool value) { }
void modulationWheel(byte value) override { }
void pitchBendFactor(byte value) override { }
void detune(byte value) override { }
void priority(byte value) override { }
void sustain(bool value) override { }

// SysEx messages
void sysEx_customInstrument(uint32 type, const byte *instr);
void sysEx_customInstrument(uint32 type, const byte *instr) override;

private:
byte _notes[256];
Expand Down Expand Up @@ -947,7 +947,7 @@ class MidiDriver_ADLIB : public MidiDriver {
MidiChannel *allocateChannel() override;
MidiChannel *getPercussionChannel() override { return &_percussion; } // Percussion partially supported

virtual void setTimerCallback(void *timerParam, Common::TimerManager::TimerProc timerProc) override;
void setTimerCallback(void *timerParam, Common::TimerManager::TimerProc timerProc) override;

private:
bool _scummSmallHeader; // FIXME: This flag controls a special mode for SCUMM V3 games
Expand Down Expand Up @@ -2291,16 +2291,16 @@ void MidiDriver_ADLIB::adlibNoteOnEx(int chan, byte note, int mod) {

class AdLibEmuMusicPlugin : public MusicPluginObject {
public:
const char *getName() const {
const char *getName() const override {
return _s("AdLib emulator");
}

const char *getId() const {
const char *getId() const override {
return "adlib";
}

MusicDevices getDevices() const;
Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
MusicDevices getDevices() const override;
Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const override;
};

MusicDevices AdLibEmuMusicPlugin::getDevices() const {
Expand Down
34 changes: 17 additions & 17 deletions audio/audiostream.cpp
Expand Up @@ -331,29 +331,29 @@ class QueuingAudioStreamImpl : public QueuingAudioStream {
~QueuingAudioStreamImpl();

// Implement the AudioStream API
virtual int readBuffer(int16 *buffer, const int numSamples);
virtual bool isStereo() const { return _stereo; }
virtual int getRate() const { return _rate; }
int readBuffer(int16 *buffer, const int numSamples) override;
bool isStereo() const override { return _stereo; }
int getRate() const override { return _rate; }

virtual bool endOfData() const {
bool endOfData() const override {
Common::StackLock lock(_mutex);
return _queue.empty() || _queue.front()._stream->endOfData();
}

virtual bool endOfStream() const {
bool endOfStream() const override {
Common::StackLock lock(_mutex);
return _finished && _queue.empty();
}

// Implement the QueuingAudioStream API
virtual void queueAudioStream(AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse);
void queueAudioStream(AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse) override;

virtual void finish() {
void finish() override {
Common::StackLock lock(_mutex);
_finished = true;
}

uint32 numQueuedStreams() const {
uint32 numQueuedStreams() const override {
Common::StackLock lock(_mutex);
return _queue.size();
}
Expand Down Expand Up @@ -443,17 +443,17 @@ class LimitingAudioStream : public AudioStream {
delete _parentStream;
}

int readBuffer(int16 *buffer, const int numSamples) {
int readBuffer(int16 *buffer, const int numSamples) override {
// Cap us off so we don't read past _totalSamples
int samplesRead = _parentStream->readBuffer(buffer, MIN<int>(numSamples, _totalSamples - _samplesRead));
_samplesRead += samplesRead;
return samplesRead;
}

bool endOfData() const { return _parentStream->endOfData() || reachedLimit(); }
bool endOfStream() const { return _parentStream->endOfStream() || reachedLimit(); }
bool isStereo() const { return _parentStream->isStereo(); }
int getRate() const { return _parentStream->getRate(); }
bool endOfData() const override { return _parentStream->endOfData() || reachedLimit(); }
bool endOfStream() const override { return _parentStream->endOfStream() || reachedLimit(); }
bool isStereo() const override { return _parentStream->isStereo(); }
int getRate() const override { return _parentStream->getRate(); }

private:
int getChannels() const { return isStereo() ? 2 : 1; }
Expand All @@ -474,10 +474,10 @@ AudioStream *makeLimitingAudioStream(AudioStream *parentStream, const Timestamp
*/
class NullAudioStream : public AudioStream {
public:
bool isStereo() const { return false; }
int getRate() const;
int readBuffer(int16 *data, const int numSamples) { return 0; }
bool endOfData() const { return true; }
bool isStereo() const override { return false; }
int getRate() const override;
int readBuffer(int16 *data, const int numSamples) override { return 0; }
bool endOfData() const override { return true; }
};

int NullAudioStream::getRate() const {
Expand Down
2 changes: 1 addition & 1 deletion audio/decoders/aac.cpp
Expand Up @@ -44,7 +44,7 @@ class AACDecoder : public Codec {
DisposeAfterUse::Flag disposeExtraData);
~AACDecoder();

AudioStream *decodeFrame(Common::SeekableReadStream &stream);
AudioStream *decodeFrame(Common::SeekableReadStream &stream) override;

private:
NeAACDecHandle _handle;
Expand Down
14 changes: 7 additions & 7 deletions audio/decoders/ac3.cpp
Expand Up @@ -45,15 +45,15 @@ class AC3Stream : public PacketizedAudioStream {
void deinit();

// AudioStream API
int readBuffer(int16 *buffer, const int numSamples) { return _audStream->readBuffer(buffer, numSamples); }
bool isStereo() const { return _audStream->isStereo(); }
int getRate() const { return _audStream->getRate(); }
bool endOfData() const { return _audStream->endOfData(); }
bool endOfStream() const { return _audStream->endOfStream(); }
int readBuffer(int16 *buffer, const int numSamples) override { return _audStream->readBuffer(buffer, numSamples); }
bool isStereo() const override { return _audStream->isStereo(); }
int getRate() const override { return _audStream->getRate(); }
bool endOfData() const override { return _audStream->endOfData(); }
bool endOfStream() const override { return _audStream->endOfStream(); }

// PacketizedAudioStream API
void queuePacket(Common::SeekableReadStream *data);
void finish() { _audStream->finish(); }
void queuePacket(Common::SeekableReadStream *data) override;
void finish() override { _audStream->finish(); }

private:
Common::ScopedPtr<QueuingAudioStream> _audStream;
Expand Down
2 changes: 1 addition & 1 deletion audio/decoders/adpcm.cpp
Expand Up @@ -590,7 +590,7 @@ class PacketizedADPCMStream : public StatelessPacketizedAudioStream {
StatelessPacketizedAudioStream(rate, channels), _type(type), _blockAlign(blockAlign) {}

protected:
AudioStream *makeStream(Common::SeekableReadStream *data);
AudioStream *makeStream(Common::SeekableReadStream *data) override;

private:
ADPCMType _type;
Expand Down
16 changes: 8 additions & 8 deletions audio/decoders/asf.cpp
Expand Up @@ -75,14 +75,14 @@ class ASFStream : public SeekableAudioStream {
DisposeAfterUse::Flag disposeAfterUse);
~ASFStream();

int readBuffer(int16 *buffer, const int numSamples);

bool endOfData() const;
bool isStereo() const { return _channels == 2; }
int getRate() const { return _sampleRate; }
Timestamp getLength() const { return Audio::Timestamp(_duration / 10000, _sampleRate); }
bool seek(const Timestamp &where);
bool rewind();
int readBuffer(int16 *buffer, const int numSamples) override;

bool endOfData() const override;
bool isStereo() const override { return _channels == 2; }
int getRate() const override { return _sampleRate; }
Timestamp getLength() const override { return Audio::Timestamp(_duration / 10000, _sampleRate); }
bool seek(const Timestamp &where) override;
bool rewind() override;

private:
// Packet data
Expand Down
12 changes: 6 additions & 6 deletions audio/decoders/flac.cpp
Expand Up @@ -127,18 +127,18 @@ class FLACStream : public SeekableAudioStream {
FLACStream(Common::SeekableReadStream *inStream, bool dispose);
virtual ~FLACStream();

int readBuffer(int16 *buffer, const int numSamples);
int readBuffer(int16 *buffer, const int numSamples) override;

bool isStereo() const { return _streaminfo.channels >= 2; }
int getRate() const { return _streaminfo.sample_rate; }
bool endOfData() const {
bool isStereo() const override { return _streaminfo.channels >= 2; }
int getRate() const override { return _streaminfo.sample_rate; }
bool endOfData() const override {
// End of data is reached if there either is no valid stream data available,
// or if we reached the last sample and completely emptied the sample cache.
return _streaminfo.channels == 0 || (_lastSampleWritten && _sampleCache.bufFill == 0);
}

bool seek(const Timestamp &where);
Timestamp getLength() const { return _length; }
bool seek(const Timestamp &where) override;
Timestamp getLength() const override { return _length; }

bool isStreamDecoderReady() const { return getStreamDecoderState() == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; }
protected:
Expand Down
16 changes: 8 additions & 8 deletions audio/decoders/g711.cpp
Expand Up @@ -56,7 +56,7 @@ class G711AudioStream : public SeekableAudioStream {
_channels(channels) {
}

virtual int readBuffer(int16 *buffer, const int numSamples) override {
int readBuffer(int16 *buffer, const int numSamples) override {
int samples;

for (samples = 0; samples < numSamples; samples++) {
Expand All @@ -69,20 +69,20 @@ class G711AudioStream : public SeekableAudioStream {
return samples;
}

virtual bool isStereo() const override { return (_channels == 2); }
virtual int getRate() const override { return _rate; }
virtual bool endOfData() const override { return _stream->eos(); }
virtual bool seek(const Timestamp &where) override {
bool isStereo() const override { return (_channels == 2); }
int getRate() const override { return _rate; }
bool endOfData() const override { return _stream->eos(); }
bool seek(const Timestamp &where) override {
const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames();
return _stream->seek(seekSample, SEEK_SET);
}
virtual Timestamp getLength() const override {
Timestamp getLength() const override {
return Timestamp(0, _stream->size() / _channels, _rate);
}
};

class G711ALawStream : public G711AudioStream {
virtual int16 decodeSample(uint8 val) override {
int16 decodeSample(uint8 val) override {
val ^= 0x55;

int t = val & QUANT_MASK;
Expand All @@ -106,7 +106,7 @@ SeekableAudioStream *makeALawStream(Common::SeekableReadStream *stream, DisposeA
}

class G711MuLawStream : public G711AudioStream {
virtual int16 decodeSample(uint8 val) override {
int16 decodeSample(uint8 val) override {
val = ~val;

int t = ((val & QUANT_MASK) << 3) + BIAS;
Expand Down
22 changes: 11 additions & 11 deletions audio/decoders/mp3.cpp
Expand Up @@ -53,9 +53,9 @@ class BaseMP3Stream : public virtual AudioStream {
BaseMP3Stream();
virtual ~BaseMP3Stream();

bool endOfData() const { return _state == MP3_STATE_EOS; }
bool isStereo() const { return _channels == 2; }
int getRate() const { return _rate; }
bool endOfData() const override { return _state == MP3_STATE_EOS; }
bool isStereo() const override { return _channels == 2; }
int getRate() const override { return _rate; }

protected:
void decodeMP3Data(Common::ReadStream &stream);
Expand Down Expand Up @@ -98,9 +98,9 @@ class MP3Stream : private BaseMP3Stream, public SeekableAudioStream {
MP3Stream(Common::SeekableReadStream *inStream,
DisposeAfterUse::Flag dispose);

int readBuffer(int16 *buffer, const int numSamples);
bool seek(const Timestamp &where);
Timestamp getLength() const { return _length; }
int readBuffer(int16 *buffer, const int numSamples) override;
bool seek(const Timestamp &where) override;
Timestamp getLength() const override { return _length; }

protected:
Common::ScopedPtr<Common::SeekableReadStream> _inStream;
Expand All @@ -118,13 +118,13 @@ class PacketizedMP3Stream : private BaseMP3Stream, public PacketizedAudioStream
~PacketizedMP3Stream();

// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);
bool endOfData() const;
bool endOfStream() const;
int readBuffer(int16 *buffer, const int numSamples) override;
bool endOfData() const override;
bool endOfStream() const override;

// PacketizedAudioStream API
void queuePacket(Common::SeekableReadStream *packet);
void finish();
void queuePacket(Common::SeekableReadStream *packet) override;
void finish() override;

private:
Common::Mutex _mutex;
Expand Down