JANITORIAL: Convert line endings from CRLF/mixed to LF
This commit is contained in:
parent
39c2477fbe
commit
bc949250de
4 changed files with 769 additions and 769 deletions
|
@ -101,4 +101,4 @@ Common::WriteStream *OSystem_RISCOS::createLogFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,113 +1,113 @@
|
||||||
/* ScummVM - Graphic Adventure Engine
|
/* ScummVM - Graphic Adventure Engine
|
||||||
*
|
*
|
||||||
* ScummVM is the legal property of its developers, whose names
|
* ScummVM is the legal property of its developers, whose names
|
||||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
* file distributed with this source distribution.
|
* file distributed with this source distribution.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cryo/sound.h"
|
#include "cryo/sound.h"
|
||||||
#include "audio/audiostream.h"
|
#include "audio/audiostream.h"
|
||||||
#include "audio/mixer.h"
|
#include "audio/mixer.h"
|
||||||
#include "audio/decoders/raw.h"
|
#include "audio/decoders/raw.h"
|
||||||
|
|
||||||
namespace Cryo {
|
namespace Cryo {
|
||||||
|
|
||||||
CSoundChannel::CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits) : _mixer(mixer), _sampleRate(sampleRate), _stereo(stereo) {
|
CSoundChannel::CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits) : _mixer(mixer), _sampleRate(sampleRate), _stereo(stereo) {
|
||||||
_bufferFlags = is16bits ? (Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS) : Audio::FLAG_UNSIGNED;
|
_bufferFlags = is16bits ? (Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS) : Audio::FLAG_UNSIGNED;
|
||||||
if (stereo)
|
if (stereo)
|
||||||
_bufferFlags |= Audio::FLAG_STEREO;
|
_bufferFlags |= Audio::FLAG_STEREO;
|
||||||
_audioStream = nullptr;
|
_audioStream = nullptr;
|
||||||
_volumeLeft = _volumeRight = Audio::Mixer::kMaxChannelVolume;
|
_volumeLeft = _volumeRight = Audio::Mixer::kMaxChannelVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSoundChannel::~CSoundChannel() {
|
CSoundChannel::~CSoundChannel() {
|
||||||
stop();
|
stop();
|
||||||
if (_audioStream)
|
if (_audioStream)
|
||||||
delete _audioStream;
|
delete _audioStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::queueBuffer(byte *buffer, unsigned int size, bool playNow, bool playQueue, bool buffering) {
|
void CSoundChannel::queueBuffer(byte *buffer, unsigned int size, bool playNow, bool playQueue, bool buffering) {
|
||||||
if (playNow)
|
if (playNow)
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
if (!buffer || !size)
|
if (!buffer || !size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_audioStream)
|
if (!_audioStream)
|
||||||
_audioStream = Audio::makeQueuingAudioStream(_sampleRate, _stereo);
|
_audioStream = Audio::makeQueuingAudioStream(_sampleRate, _stereo);
|
||||||
|
|
||||||
if (buffering) {
|
if (buffering) {
|
||||||
byte *localBuffer = (byte*)malloc(size);
|
byte *localBuffer = (byte*)malloc(size);
|
||||||
memcpy(localBuffer, buffer, size);
|
memcpy(localBuffer, buffer, size);
|
||||||
_audioStream->queueBuffer(localBuffer, size, DisposeAfterUse::YES, _bufferFlags);
|
_audioStream->queueBuffer(localBuffer, size, DisposeAfterUse::YES, _bufferFlags);
|
||||||
} else
|
} else
|
||||||
_audioStream->queueBuffer(buffer, size, DisposeAfterUse::NO, _bufferFlags);
|
_audioStream->queueBuffer(buffer, size, DisposeAfterUse::NO, _bufferFlags);
|
||||||
if (playNow || playQueue)
|
if (playNow || playQueue)
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::play() {
|
void CSoundChannel::play() {
|
||||||
if (!_audioStream)
|
if (!_audioStream)
|
||||||
return;
|
return;
|
||||||
if (!_mixer->isSoundHandleActive(_soundHandle)) {
|
if (!_mixer->isSoundHandleActive(_soundHandle)) {
|
||||||
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
|
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, _audioStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
|
||||||
applyVolumeChange();
|
applyVolumeChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::stop() {
|
void CSoundChannel::stop() {
|
||||||
if (_mixer->isSoundHandleActive(_soundHandle))
|
if (_mixer->isSoundHandleActive(_soundHandle))
|
||||||
_mixer->stopHandle(_soundHandle);
|
_mixer->stopHandle(_soundHandle);
|
||||||
|
|
||||||
if (_audioStream) {
|
if (_audioStream) {
|
||||||
_audioStream->finish();
|
_audioStream->finish();
|
||||||
delete _audioStream;
|
delete _audioStream;
|
||||||
_audioStream = nullptr;
|
_audioStream = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CSoundChannel::numQueued() {
|
unsigned int CSoundChannel::numQueued() {
|
||||||
return _audioStream ? _audioStream->numQueuedStreams() : 0;
|
return _audioStream ? _audioStream->numQueuedStreams() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CSoundChannel::getVolume() {
|
unsigned int CSoundChannel::getVolume() {
|
||||||
return (_volumeRight + _volumeLeft) / 2;
|
return (_volumeRight + _volumeLeft) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::setVolume(unsigned int volumeLeft, unsigned int volumeRight) {
|
void CSoundChannel::setVolume(unsigned int volumeLeft, unsigned int volumeRight) {
|
||||||
_volumeLeft = volumeLeft;
|
_volumeLeft = volumeLeft;
|
||||||
_volumeRight = volumeRight;
|
_volumeRight = volumeRight;
|
||||||
applyVolumeChange();
|
applyVolumeChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::setVolumeLeft(unsigned int volume) {
|
void CSoundChannel::setVolumeLeft(unsigned int volume) {
|
||||||
setVolume(volume, _volumeRight);
|
setVolume(volume, _volumeRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::setVolumeRight(unsigned int volume) {
|
void CSoundChannel::setVolumeRight(unsigned int volume) {
|
||||||
setVolume(_volumeLeft, volume);
|
setVolume(_volumeLeft, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSoundChannel::applyVolumeChange() {
|
void CSoundChannel::applyVolumeChange() {
|
||||||
unsigned int volume = (_volumeRight + _volumeLeft) / 2;
|
unsigned int volume = (_volumeRight + _volumeLeft) / 2;
|
||||||
int balance = (signed int)(_volumeRight - _volumeLeft) / 2;
|
int balance = (signed int)(_volumeRight - _volumeLeft) / 2;
|
||||||
_mixer->setChannelVolume(_soundHandle, volume);
|
_mixer->setChannelVolume(_soundHandle, volume);
|
||||||
_mixer->setChannelBalance(_soundHandle, balance);
|
_mixer->setChannelBalance(_soundHandle, balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
/* ScummVM - Graphic Adventure Engine
|
/* ScummVM - Graphic Adventure Engine
|
||||||
*
|
*
|
||||||
* ScummVM is the legal property of its developers, whose names
|
* ScummVM is the legal property of its developers, whose names
|
||||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||||
* file distributed with this source distribution.
|
* file distributed with this source distribution.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "audio/audiostream.h"
|
#include "audio/audiostream.h"
|
||||||
#include "audio/mixer.h"
|
#include "audio/mixer.h"
|
||||||
#include "audio/decoders/raw.h"
|
#include "audio/decoders/raw.h"
|
||||||
|
|
||||||
#include "cryo/cryolib.h"
|
#include "cryo/cryolib.h"
|
||||||
|
|
||||||
namespace Cryo {
|
namespace Cryo {
|
||||||
|
|
||||||
class CryoEngine;
|
class CryoEngine;
|
||||||
|
|
||||||
class CSoundChannel {
|
class CSoundChannel {
|
||||||
private:
|
private:
|
||||||
Audio::Mixer *_mixer;
|
Audio::Mixer *_mixer;
|
||||||
Audio::QueuingAudioStream *_audioStream;
|
Audio::QueuingAudioStream *_audioStream;
|
||||||
Audio::SoundHandle _soundHandle;
|
Audio::SoundHandle _soundHandle;
|
||||||
unsigned int _sampleRate;
|
unsigned int _sampleRate;
|
||||||
bool _stereo;
|
bool _stereo;
|
||||||
unsigned int _bufferFlags;
|
unsigned int _bufferFlags;
|
||||||
|
|
||||||
void applyVolumeChange();
|
void applyVolumeChange();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits = false);
|
CSoundChannel(Audio::Mixer *mixer, unsigned int sampleRate, bool stereo, bool is16bits = false);
|
||||||
~CSoundChannel();
|
~CSoundChannel();
|
||||||
|
|
||||||
// Queue a new buffer, cancel any previously queued buffers if playNow is set
|
// Queue a new buffer, cancel any previously queued buffers if playNow is set
|
||||||
void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true, bool buffering = true);
|
void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true, bool buffering = true);
|
||||||
|
|
||||||
// Play any queued buffers
|
// Play any queued buffers
|
||||||
void play();
|
void play();
|
||||||
|
|
||||||
// Stop playing and purge play queue
|
// Stop playing and purge play queue
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
// How many buffers in queue (including currently playing one)
|
// How many buffers in queue (including currently playing one)
|
||||||
unsigned int numQueued();
|
unsigned int numQueued();
|
||||||
|
|
||||||
// Volume control
|
// Volume control
|
||||||
int _volumeLeft, _volumeRight;
|
int _volumeLeft, _volumeRight;
|
||||||
unsigned int getVolume();
|
unsigned int getVolume();
|
||||||
void setVolume(unsigned int volumeLeft, unsigned int volumeRight);
|
void setVolume(unsigned int volumeLeft, unsigned int volumeRight);
|
||||||
void setVolumeLeft(unsigned int volume);
|
void setVolumeLeft(unsigned int volume);
|
||||||
void setVolumeRight(unsigned int volume);
|
void setVolumeRight(unsigned int volume);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue