Skip to content

Commit

Permalink
Merge branch 'master' into tsage_r2r
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 4, 2013
2 parents a49a7d5 + baafae6 commit fa737fd
Show file tree
Hide file tree
Showing 154 changed files with 5,324 additions and 1,475 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -161,6 +161,10 @@ ipch/
#Ignore default Visual Studio build folders
[Dd]ebug/
[Rr]elease/
[Dd]ebug32/
[Rr]elease32/
[Dd]ebug64/
[Rr]elease64/

#Ignore Qt Creator project files
ScummVM.config
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Expand Up @@ -44,6 +44,11 @@ endif

ifeq "$(HAVE_CLANG)" "1"
CXXFLAGS+= -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants
# We use a anonymous nested type declaration in an anonymous union in
# common/str.h. This is no standard construct and clang warns about it.
# It works for all our target systems though, thus we simply disable that
# warning.
CXXFLAGS+= -Wno-nested-anon-types
endif

ifeq "$(HAVE_ICC)" "1"
Expand Down
3 changes: 2 additions & 1 deletion NEWS
Expand Up @@ -2,7 +2,8 @@ For a more comprehensive changelog of the latest experimental code, see:
https://github.com/scummvm/scummvm/commits/

1.7.0 (????-??-??)

Gob:
- Improved video quality in Urban Runner

1.6.0 (2013-05-31)
New Games:
Expand Down
13 changes: 8 additions & 5 deletions audio/mixer.cpp
Expand Up @@ -20,6 +20,8 @@
*
*/

#include "gui/EventRecorder.h"

#include "common/util.h"
#include "common/system.h"
#include "common/textconsole.h"
Expand Down Expand Up @@ -427,6 +429,7 @@ void MixerImpl::pauseHandle(SoundHandle handle, bool paused) {

bool MixerImpl::isSoundIDActive(int id) {
Common::StackLock lock(_mutex);
g_eventRec.updateSubsystems();
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->getId() == id)
return true;
Expand All @@ -443,6 +446,7 @@ int MixerImpl::getSoundID(SoundHandle handle) {

bool MixerImpl::isSoundHandleActive(SoundHandle handle) {
Common::StackLock lock(_mutex);
g_eventRec.updateSubsystems();
const int index = handle._val % NUM_CHANNELS;
return _channels[index] && _channels[index]->getHandle()._val == handle._val;
}
Expand Down Expand Up @@ -556,12 +560,12 @@ void Channel::pause(bool paused) {
_pauseLevel++;

if (_pauseLevel == 1)
_pauseStartTime = g_system->getMillis();
_pauseStartTime = g_system->getMillis(true);
} else if (_pauseLevel > 0) {
_pauseLevel--;

if (!_pauseLevel) {
_pauseTime = (g_system->getMillis() - _pauseStartTime);
_pauseTime = (g_system->getMillis(true) - _pauseStartTime);
_pauseStartTime = 0;
}
}
Expand All @@ -579,7 +583,7 @@ Timestamp Channel::getElapsedTime() {
if (isPaused())
delta = _pauseStartTime - _mixerTimeStamp;
else
delta = g_system->getMillis() - _mixerTimeStamp - _pauseTime;
delta = g_system->getMillis(true) - _mixerTimeStamp - _pauseTime;

// Convert the number of samples into a time duration.

Expand All @@ -599,13 +603,12 @@ int Channel::mix(int16 *data, uint len) {
assert(_stream);

int res = 0;

if (_stream->endOfData()) {
// TODO: call drain method
} else {
assert(_converter);
_samplesConsumed = _samplesDecoded;
_mixerTimeStamp = g_system->getMillis();
_mixerTimeStamp = g_system->getMillis(true);
_pauseTime = 0;
res = _converter->flow(*_stream, data, len, _volL, _volR);
_samplesDecoded += res;
Expand Down
6 changes: 1 addition & 5 deletions audio/softsynth/mt32/Part.cpp
Expand Up @@ -175,6 +175,7 @@ void Part::refresh() {
patchCache[t].reverb = patchTemp->patch.reverbSwitch > 0;
}
memcpy(currentInstr, timbreTemp->common.name, 10);
synth->newTimbreSet(partNum, patchTemp->patch.timbreGroup, currentInstr);
updatePitchBenderRange();
}

Expand Down Expand Up @@ -207,7 +208,6 @@ void RhythmPart::setTimbre(TimbreParam * /*timbre*/) {

void Part::setTimbre(TimbreParam *timbre) {
*timbreTemp = *timbre;
synth->newTimbreSet(partNum, timbre->common.name);
}

unsigned int RhythmPart::getAbsTimbreNum() const {
Expand Down Expand Up @@ -533,7 +533,6 @@ void Part::playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhyt
#if MT32EMU_MONITOR_PARTIALS > 1
synth->printPartialUsage();
#endif
synth->partStateChanged(partNum, true);
synth->polyStateChanged(partNum);
}

Expand Down Expand Up @@ -614,9 +613,6 @@ void Part::partialDeactivated(Poly *poly) {
freePolys.prepend(poly);
synth->polyStateChanged(partNum);
}
if (activePartialCount == 0) {
synth->partStateChanged(partNum, false);
}
}

//#define POLY_LIST_DEBUG
Expand Down
1 change: 0 additions & 1 deletion audio/softsynth/mt32/Partial.cpp
Expand Up @@ -87,7 +87,6 @@ void Partial::deactivate() {
if (poly != NULL) {
poly->partialDeactivated(this);
}
synth->partialStateChanged(this, tva->getPhase(), TVA_PHASE_DEAD);
#if MT32EMU_MONITOR_PARTIALS > 2
synth->printDebug("[+%lu] [Partial %d] Deactivated", sampleNum, debugPartialNum);
synth->printPartialUsage(sampleNum);
Expand Down
17 changes: 2 additions & 15 deletions audio/softsynth/mt32/Synth.cpp
Expand Up @@ -201,25 +201,12 @@ void ReportHandler::printDebug(const char *fmt, va_list list) {
printf("\n");
}

void Synth::partStateChanged(int partNum, bool isPartActive) {
reportHandler->onPartStateChanged(partNum, isPartActive);
}

void Synth::polyStateChanged(int partNum) {
reportHandler->onPolyStateChanged(partNum);
}

void Synth::partialStateChanged(const Partial * const partial, int oldPartialPhase, int newPartialPhase) {
for (int i = 0; i < MT32EMU_MAX_PARTIALS; i++) {
if (getPartial(i) == partial) {
reportHandler->onPartialStateChanged(i, oldPartialPhase, newPartialPhase);
break;
}
}
}

void Synth::newTimbreSet(int partNum, char patchName[]) {
reportHandler->onProgramChanged(partNum, patchName);
void Synth::newTimbreSet(int partNum, Bit8u timbreGroup, const char patchName[]) {
reportHandler->onProgramChanged(partNum, timbreGroup, patchName);
}

void Synth::printDebug(const char *fmt, ...) {
Expand Down
8 changes: 3 additions & 5 deletions audio/softsynth/mt32/Synth.h
Expand Up @@ -249,10 +249,10 @@ friend class Synth;
virtual void onNewReverbMode(Bit8u /* mode */) {}
virtual void onNewReverbTime(Bit8u /* time */) {}
virtual void onNewReverbLevel(Bit8u /* level */) {}
virtual void onPartStateChanged(int /* partNum */, bool /* isActive */) {}
virtual void onPartStateChanged(int /* partNum */, bool /* hasActiveNonReleasingPolys */) {}
virtual void onPolyStateChanged(int /* partNum */) {}
virtual void onPartialStateChanged(int /* partialNum */, int /* oldPartialPhase */, int /* newPartialPhase */) {}
virtual void onProgramChanged(int /* partNum */, char * /* patchName */) {}
virtual void onProgramChanged(int /* partNum */, int /* bankNum */, const char * /* patchName */) {}
};

class Synth {
Expand Down Expand Up @@ -370,10 +370,8 @@ friend class TVP;

void printPartialUsage(unsigned long sampleOffset = 0);

void partStateChanged(int partNum, bool isPartActive);
void polyStateChanged(int partNum);
void partialStateChanged(const Partial * const partial, int oldPartialPhase, int newPartialPhase);
void newTimbreSet(int partNum, char patchName[]);
void newTimbreSet(int partNum, Bit8u timbreGroup, const char patchName[]);
void printDebug(const char *fmt, ...);

public:
Expand Down
6 changes: 0 additions & 6 deletions audio/softsynth/mt32/TVA.cpp
Expand Up @@ -34,9 +34,6 @@ TVA::TVA(const Partial *usePartial, LA32Ramp *useAmpRamp) :
}

void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) {
if (newPhase != phase) {
partial->getSynth()->partialStateChanged(partial, phase, newPhase);
}
target = newTarget;
phase = newPhase;
ampRamp->startRamp(newTarget, newIncrement);
Expand All @@ -46,9 +43,6 @@ void TVA::startRamp(Bit8u newTarget, Bit8u newIncrement, int newPhase) {
}

void TVA::end(int newPhase) {
if (newPhase != phase) {
partial->getSynth()->partialStateChanged(partial, phase, newPhase);
}
phase = newPhase;
playing = false;
#if MT32EMU_MONITOR_TVA >= 1
Expand Down
3 changes: 2 additions & 1 deletion backends/events/default/default-events.cpp
Expand Up @@ -84,7 +84,8 @@ void DefaultEventManager::init() {
}

bool DefaultEventManager::pollEvent(Common::Event &event) {
uint32 time = g_system->getMillis();
// Skip recording of these events
uint32 time = g_system->getMillis(true);
bool result = false;

_dispatcher.dispatch();
Expand Down
4 changes: 3 additions & 1 deletion backends/events/sdl/sdl-events.cpp
Expand Up @@ -106,7 +106,9 @@ void SdlEventSource::processMouseEvent(Common::Event &event, int x, int y) {
}

void SdlEventSource::handleKbdMouse() {
uint32 curTime = g_system->getMillis();
// Skip recording of these events
uint32 curTime = g_system->getMillis(true);

if (curTime >= _km.last_time + _km.delay_time) {
_km.last_time = curTime;
if (_km.x_down_count == 1) {
Expand Down
30 changes: 25 additions & 5 deletions backends/graphics/surfacesdl/surfacesdl-graphics.cpp
Expand Up @@ -40,6 +40,7 @@
#include "graphics/scaler.h"
#include "graphics/scaler/aspect.h"
#include "graphics/surface.h"
#include "gui/EventRecorder.h"

static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"1x", _s("Normal (no scaling)"), GFX_NORMAL},
Expand Down Expand Up @@ -135,6 +136,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_paletteDirtyStart(0), _paletteDirtyEnd(0),
_screenIsLocked(false),
_graphicsMutex(0),
_displayDisabled(false),
#ifdef USE_SDL_DEBUG_FOCUSRECT
_enableFocusRectDebugCode(false), _enableFocusRect(false), _focusRect(),
#endif
Expand Down Expand Up @@ -765,9 +767,20 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
fixupResolutionForAspectRatio(_videoMode.desiredAspectRatio, _videoMode.hardwareWidth, _videoMode.hardwareHeight);
}

_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);

#ifdef ENABLE_EVENTRECORDER
_displayDisabled = ConfMan.getBool("disable_display");

if (_displayDisabled) {
_hwscreen = g_eventRec.getSurface(_videoMode.hardwareWidth, _videoMode.hardwareHeight);
} else
#endif
{
_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
);
}

#ifdef USE_RGB_COLOR
detectSupportedFormats();
#endif
Expand Down Expand Up @@ -865,7 +878,12 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() {
}

if (_hwscreen) {
SDL_FreeSurface(_hwscreen);
if (_displayDisabled) {
delete _hwscreen;
} else {
SDL_FreeSurface(_hwscreen);
}

_hwscreen = NULL;
}

Expand Down Expand Up @@ -1188,7 +1206,9 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
#endif

// Finally, blit all our changes to the screen
SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
if (!_displayDisabled) {
SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
}
}

_numDirtyRects = 0;
Expand Down
3 changes: 3 additions & 0 deletions backends/graphics/surfacesdl/surfacesdl-graphics.h
Expand Up @@ -232,6 +232,9 @@ class SurfaceSdlGraphicsManager : public GraphicsManager, public SdlGraphicsMana
int _scalerType;
int _transactionMode;

// Indicates whether it is needed to free _hwsurface in destructor
bool _displayDisabled;

bool _screenIsLocked;
Graphics::Surface _framebuffer;

Expand Down
75 changes: 75 additions & 0 deletions backends/mixer/nullmixer/nullsdl-mixer.cpp
@@ -0,0 +1,75 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "backends/mixer/nullmixer/nullsdl-mixer.h"
#include "common/savefile.h"

NullSdlMixerManager::NullSdlMixerManager() : SdlMixerManager() {
_outputRate = 22050;
_callsCounter = 0;
_callbackPeriod = 10;
_samples = 8192;
while (_samples * 16 > _outputRate * 2)
_samples >>= 1;
_samplesBuf = new uint8[_samples * 4];
}

NullSdlMixerManager::~NullSdlMixerManager() {
delete _samplesBuf;
}

void NullSdlMixerManager::init() {
_mixer = new Audio::MixerImpl(g_system, _outputRate);
assert(_mixer);
_mixer->setReady(true);
}

void NullSdlMixerManager::suspendAudio() {
_audioSuspended = true;
}

int NullSdlMixerManager::resumeAudio() {
if (!_audioSuspended) {
return -2;
}
_audioSuspended = false;
return 0;
}


void NullSdlMixerManager::startAudio() {
}

void NullSdlMixerManager::callbackHandler(byte *samples, int len) {
assert(_mixer);
_mixer->mixCallback(samples, len);
}

void NullSdlMixerManager::update() {
if (_audioSuspended) {
return;
}
_callsCounter++;
if ((_callsCounter % _callbackPeriod) == 0) {
callbackHandler(_samplesBuf, _samples);
}
}

0 comments on commit fa737fd

Please sign in to comment.