BACKENDS: Partial merge of gsoc2010-opengl: Audio CD changes only
This commit contains the AudioCDManager changes from the gsoc2010-opengl branch. The other changes in that branch are restricted to the backends directory only (plus configure). The Nintendo DS and Dreamcast ports still need to be ported over to the new Audio CD system, but that should be fairly easy to do. svn-id: r54147
This commit is contained in:
commit
82e473bc3b
43 changed files with 556 additions and 381 deletions
148
backends/audiocd/audiocd.h
Normal file
148
backends/audiocd/audiocd.h
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
/* 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.
|
||||||
|
*
|
||||||
|
* $URL$
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BACKENDS_AUDIOCD_ABSTRACT_H
|
||||||
|
#define BACKENDS_AUDIOCD_ABSTRACT_H
|
||||||
|
|
||||||
|
#include "common/scummsys.h"
|
||||||
|
#include "common/noncopyable.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract Audio CD manager class. Subclasses implement the actual
|
||||||
|
* functionality.
|
||||||
|
*/
|
||||||
|
class AudioCDManager : Common::NonCopyable {
|
||||||
|
public:
|
||||||
|
virtual ~AudioCDManager() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A structure containing the current playback information
|
||||||
|
*/
|
||||||
|
struct Status {
|
||||||
|
bool playing;
|
||||||
|
int track;
|
||||||
|
int start;
|
||||||
|
int duration;
|
||||||
|
int numLoops;
|
||||||
|
int volume;
|
||||||
|
int balance;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Emulated playback functions
|
||||||
|
* Engines should call these functions. Not all platforms
|
||||||
|
* support cd playback, and these functions should try to
|
||||||
|
* emulate it.
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start audio CD playback
|
||||||
|
* @param track the track to play.
|
||||||
|
* @param num_loops how often playback should be repeated (-1 = infinitely often).
|
||||||
|
* @param start_frame the frame at which playback should start (75 frames = 1 second).
|
||||||
|
* @param duration the number of frames to play.
|
||||||
|
* @param only_emulate determines if the track should be emulated only
|
||||||
|
*/
|
||||||
|
virtual void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get if audio is being played.
|
||||||
|
* @return true if CD or emulated audio is playing
|
||||||
|
*/
|
||||||
|
virtual bool isPlaying() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the audio volume
|
||||||
|
*/
|
||||||
|
virtual void setVolume(byte volume) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the speakers balance
|
||||||
|
*/
|
||||||
|
virtual void setBalance(int8 balance) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop CD or emulated audio playback.
|
||||||
|
*/
|
||||||
|
virtual void stop() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update CD or emulated audio status.
|
||||||
|
*/
|
||||||
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the playback status.
|
||||||
|
* @return a Status struct with playback data.
|
||||||
|
*/
|
||||||
|
virtual Status getStatus() const = 0;
|
||||||
|
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Real CD audio methods
|
||||||
|
* These functions should be called from the emulated
|
||||||
|
* ones if they can't emulate the audio playback.
|
||||||
|
*/
|
||||||
|
//@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise the specified CD drive for audio playback.
|
||||||
|
* @param drive the drive id
|
||||||
|
* @return true if the CD drive was inited succesfully
|
||||||
|
*/
|
||||||
|
virtual bool openCD(int drive) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Poll CD status.
|
||||||
|
* @return true if CD audio is playing
|
||||||
|
*/
|
||||||
|
virtual bool pollCD() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start CD audio playback.
|
||||||
|
* @param track the track to play.
|
||||||
|
* @param num_loops how often playback should be repeated (-1 = infinitely often).
|
||||||
|
* @param start_frame the frame at which playback should start (75 frames = 1 second).
|
||||||
|
* @param duration the number of frames to play.
|
||||||
|
*/
|
||||||
|
virtual void playCD(int track, int num_loops, int start_frame, int duration) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop CD audio playback.
|
||||||
|
*/
|
||||||
|
virtual void stopCD() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update CD audio status.
|
||||||
|
*/
|
||||||
|
virtual void updateCD() = 0;
|
||||||
|
|
||||||
|
//@}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -23,33 +23,24 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
#include "backends/audiocd/default/default-audiocd.h"
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/decoders/mp3.h"
|
|
||||||
#include "sound/decoders/vorbis.h"
|
|
||||||
#include "sound/decoders/flac.h"
|
|
||||||
#include "engines/engine.h"
|
|
||||||
#include "common/util.h"
|
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
|
||||||
DECLARE_SINGLETON(Audio::AudioCDManager)
|
DefaultAudioCDManager::DefaultAudioCDManager() {
|
||||||
|
|
||||||
namespace Audio {
|
|
||||||
|
|
||||||
AudioCDManager::AudioCDManager() {
|
|
||||||
_cd.playing = false;
|
_cd.playing = false;
|
||||||
_cd.track = 0;
|
_cd.track = 0;
|
||||||
_cd.start = 0;
|
_cd.start = 0;
|
||||||
_cd.duration = 0;
|
_cd.duration = 0;
|
||||||
_cd.numLoops = 0;
|
_cd.numLoops = 0;
|
||||||
_cd.volume = Mixer::kMaxChannelVolume;
|
_cd.volume = Audio::Mixer::kMaxChannelVolume;
|
||||||
_cd.balance = 0;
|
_cd.balance = 0;
|
||||||
_mixer = g_system->getMixer();
|
_mixer = g_system->getMixer();
|
||||||
_emulating = false;
|
_emulating = false;
|
||||||
assert(_mixer);
|
assert(_mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool only_emulate) {
|
void DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool only_emulate) {
|
||||||
if (numLoops != 0 || startFrame != 0) {
|
if (numLoops != 0 || startFrame != 0) {
|
||||||
_cd.track = track;
|
_cd.track = track;
|
||||||
_cd.numLoops = numLoops;
|
_cd.numLoops = numLoops;
|
||||||
|
@ -65,14 +56,14 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration,
|
||||||
Audio::SeekableAudioStream *stream = 0;
|
Audio::SeekableAudioStream *stream = 0;
|
||||||
|
|
||||||
for (int i = 0; !stream && i < 2; ++i)
|
for (int i = 0; !stream && i < 2; ++i)
|
||||||
stream = SeekableAudioStream::openStreamFile(trackName[i]);
|
stream = Audio::SeekableAudioStream::openStreamFile(trackName[i]);
|
||||||
|
|
||||||
// Stop any currently playing emulated track
|
// Stop any currently playing emulated track
|
||||||
_mixer->stopHandle(_handle);
|
_mixer->stopHandle(_handle);
|
||||||
|
|
||||||
if (stream != 0) {
|
if (stream != 0) {
|
||||||
Timestamp start = Timestamp(0, startFrame, 75);
|
Audio::Timestamp start = Audio::Timestamp(0, startFrame, 75);
|
||||||
Timestamp end = duration ? Timestamp(0, startFrame + duration, 75) : stream->getLength();
|
Audio::Timestamp end = duration ? Audio::Timestamp(0, startFrame + duration, 75) : stream->getLength();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FIXME: Seems numLoops == 0 and numLoops == 1 both indicate a single repetition,
|
FIXME: Seems numLoops == 0 and numLoops == 1 both indicate a single repetition,
|
||||||
|
@ -80,39 +71,38 @@ void AudioCDManager::play(int track, int numLoops, int startFrame, int duration,
|
||||||
repetitions. Finally, -1 means infinitely many
|
repetitions. Finally, -1 means infinitely many
|
||||||
*/
|
*/
|
||||||
_emulating = true;
|
_emulating = true;
|
||||||
_mixer->playStream(Mixer::kMusicSoundType, &_handle,
|
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_handle,
|
||||||
makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops), -1, _cd.volume, _cd.balance);
|
Audio::makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops), -1, _cd.volume, _cd.balance);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_emulating = false;
|
_emulating = false;
|
||||||
if (!only_emulate)
|
if (!only_emulate)
|
||||||
g_system->playCD(track, numLoops, startFrame, duration);
|
playCD(track, numLoops, startFrame, duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCDManager::stop() {
|
void DefaultAudioCDManager::stop() {
|
||||||
if (_emulating) {
|
if (_emulating) {
|
||||||
// Audio CD emulation
|
// Audio CD emulation
|
||||||
_mixer->stopHandle(_handle);
|
_mixer->stopHandle(_handle);
|
||||||
_emulating = false;
|
_emulating = false;
|
||||||
} else {
|
} else {
|
||||||
// Real Audio CD
|
// Real Audio CD
|
||||||
g_system->stopCD();
|
stopCD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AudioCDManager::isPlaying() const {
|
bool DefaultAudioCDManager::isPlaying() const {
|
||||||
if (_emulating) {
|
if (_emulating) {
|
||||||
// Audio CD emulation
|
// Audio CD emulation
|
||||||
return _mixer->isSoundHandleActive(_handle);
|
return _mixer->isSoundHandleActive(_handle);
|
||||||
} else {
|
} else {
|
||||||
// Real Audio CD
|
// Real Audio CD
|
||||||
return g_system->pollCD();
|
return pollCD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCDManager::setVolume(byte volume) {
|
void DefaultAudioCDManager::setVolume(byte volume) {
|
||||||
_cd.volume = volume;
|
_cd.volume = volume;
|
||||||
if (_emulating) {
|
if (_emulating) {
|
||||||
// Audio CD emulation
|
// Audio CD emulation
|
||||||
|
@ -128,7 +118,7 @@ void AudioCDManager::setVolume(byte volume) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCDManager::setBalance(int8 balance) {
|
void DefaultAudioCDManager::setBalance(int8 balance) {
|
||||||
_cd.balance = balance;
|
_cd.balance = balance;
|
||||||
if (_emulating) {
|
if (_emulating) {
|
||||||
// Audio CD emulation
|
// Audio CD emulation
|
||||||
|
@ -144,7 +134,7 @@ void AudioCDManager::setBalance(int8 balance) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCDManager::updateCD() {
|
void DefaultAudioCDManager::update() {
|
||||||
if (_emulating) {
|
if (_emulating) {
|
||||||
// Check whether the audio track stopped playback
|
// Check whether the audio track stopped playback
|
||||||
if (!_mixer->isSoundHandleActive(_handle)) {
|
if (!_mixer->isSoundHandleActive(_handle)) {
|
||||||
|
@ -156,16 +146,12 @@ void AudioCDManager::updateCD() {
|
||||||
_emulating = false;
|
_emulating = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_system->updateCD();
|
updateCD();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioCDManager::Status AudioCDManager::getStatus() const {
|
DefaultAudioCDManager::Status DefaultAudioCDManager::getStatus() const {
|
||||||
// TODO: This could be improved for "real" CD playback.
|
|
||||||
// But to do that, we would have to extend the OSystem interface.
|
|
||||||
Status info = _cd;
|
Status info = _cd;
|
||||||
info.playing = isPlaying();
|
info.playing = isPlaying();
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Audio
|
|
62
backends/audiocd/default/default-audiocd.h
Normal file
62
backends/audiocd/default/default-audiocd.h
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
/* 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.
|
||||||
|
*
|
||||||
|
* $URL$
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BACKENDS_AUDIOCD_DEFAULT_H
|
||||||
|
#define BACKENDS_AUDIOCD_DEFAULT_H
|
||||||
|
|
||||||
|
#include "backends/audiocd/audiocd.h"
|
||||||
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default audio cd manager. Implements emulation of audio cd playback.
|
||||||
|
*/
|
||||||
|
class DefaultAudioCDManager : public AudioCDManager {
|
||||||
|
public:
|
||||||
|
DefaultAudioCDManager();
|
||||||
|
virtual ~DefaultAudioCDManager() {}
|
||||||
|
|
||||||
|
void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false);
|
||||||
|
void stop();
|
||||||
|
bool isPlaying() const;
|
||||||
|
void setVolume(byte volume);
|
||||||
|
void setBalance(int8 balance);
|
||||||
|
void update();
|
||||||
|
virtual Status getStatus() const; // Subclasses should override for better status results
|
||||||
|
|
||||||
|
virtual bool openCD(int drive) { return false; }
|
||||||
|
virtual void updateCD() {}
|
||||||
|
virtual bool pollCD() const { return false; }
|
||||||
|
virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
|
||||||
|
virtual void stopCD() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Audio::SoundHandle _handle;
|
||||||
|
bool _emulating;
|
||||||
|
|
||||||
|
Status _cd;
|
||||||
|
Audio::Mixer *_mixer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
139
backends/audiocd/sdl/sdl-audiocd.cpp
Normal file
139
backends/audiocd/sdl/sdl-audiocd.cpp
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
/* 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.
|
||||||
|
*
|
||||||
|
* $URL$
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(SDL_BACKEND)
|
||||||
|
|
||||||
|
// Disable symbol overrides so that we can use system headers.
|
||||||
|
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||||
|
|
||||||
|
#include "backends/audiocd/sdl/sdl-audiocd.h"
|
||||||
|
|
||||||
|
SdlAudioCDManager::SdlAudioCDManager()
|
||||||
|
:
|
||||||
|
_cdrom(0),
|
||||||
|
_cdTrack(0),
|
||||||
|
_cdNumLoops(0),
|
||||||
|
_cdStartFrame(0),
|
||||||
|
_cdDuration(0),
|
||||||
|
_cdEndTime(0),
|
||||||
|
_cdStopTime(0) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SdlAudioCDManager::~SdlAudioCDManager() {
|
||||||
|
if (_cdrom) {
|
||||||
|
SDL_CDStop(_cdrom);
|
||||||
|
SDL_CDClose(_cdrom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SdlAudioCDManager::openCD(int drive) {
|
||||||
|
if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
|
||||||
|
_cdrom = NULL;
|
||||||
|
else {
|
||||||
|
_cdrom = SDL_CDOpen(drive);
|
||||||
|
// Did it open? Check if _cdrom is NULL
|
||||||
|
if (!_cdrom) {
|
||||||
|
warning("Couldn't open drive: %s", SDL_GetError());
|
||||||
|
} else {
|
||||||
|
_cdNumLoops = 0;
|
||||||
|
_cdStopTime = 0;
|
||||||
|
_cdEndTime = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (_cdrom != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdlAudioCDManager::stopCD() {
|
||||||
|
// Stop CD Audio in 1/10th of a second
|
||||||
|
_cdStopTime = SDL_GetTicks() + 100;
|
||||||
|
_cdNumLoops = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdlAudioCDManager::playCD(int track, int num_loops, int start_frame, int duration) {
|
||||||
|
if (!num_loops && !start_frame)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!_cdrom)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (duration > 0)
|
||||||
|
duration += 5;
|
||||||
|
|
||||||
|
_cdTrack = track;
|
||||||
|
_cdNumLoops = num_loops;
|
||||||
|
_cdStartFrame = start_frame;
|
||||||
|
|
||||||
|
SDL_CDStatus(_cdrom);
|
||||||
|
if (start_frame == 0 && duration == 0)
|
||||||
|
SDL_CDPlayTracks(_cdrom, track, 0, 1, 0);
|
||||||
|
else
|
||||||
|
SDL_CDPlayTracks(_cdrom, track, start_frame, 0, duration);
|
||||||
|
_cdDuration = duration;
|
||||||
|
_cdStopTime = 0;
|
||||||
|
_cdEndTime = SDL_GetTicks() + _cdrom->track[track].length * 1000 / CD_FPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SdlAudioCDManager::pollCD() const {
|
||||||
|
if (!_cdrom)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (_cdNumLoops != 0 && (SDL_GetTicks() < _cdEndTime || SDL_CDStatus(_cdrom) == CD_PLAYING));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdlAudioCDManager::updateCD() {
|
||||||
|
if (!_cdrom)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_cdStopTime != 0 && SDL_GetTicks() >= _cdStopTime) {
|
||||||
|
SDL_CDStop(_cdrom);
|
||||||
|
_cdNumLoops = 0;
|
||||||
|
_cdStopTime = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_cdNumLoops == 0 || SDL_GetTicks() < _cdEndTime)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_cdNumLoops != 1 && SDL_CDStatus(_cdrom) != CD_STOPPED) {
|
||||||
|
// Wait another second for it to be done
|
||||||
|
_cdEndTime += 1000;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_cdNumLoops > 0)
|
||||||
|
_cdNumLoops--;
|
||||||
|
|
||||||
|
if (_cdNumLoops != 0) {
|
||||||
|
if (_cdStartFrame == 0 && _cdDuration == 0)
|
||||||
|
SDL_CDPlayTracks(_cdrom, _cdTrack, 0, 1, 0);
|
||||||
|
else
|
||||||
|
SDL_CDPlayTracks(_cdrom, _cdTrack, _cdStartFrame, 0, _cdDuration);
|
||||||
|
_cdEndTime = SDL_GetTicks() + _cdrom->track[_cdTrack].length * 1000 / CD_FPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
57
backends/audiocd/sdl/sdl-audiocd.h
Normal file
57
backends/audiocd/sdl/sdl-audiocd.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/* 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.
|
||||||
|
*
|
||||||
|
* $URL$
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BACKENDS_AUDIOCD_SDL_H
|
||||||
|
#define BACKENDS_AUDIOCD_SDL_H
|
||||||
|
|
||||||
|
#include "backends/audiocd/default/default-audiocd.h"
|
||||||
|
|
||||||
|
#if defined(__SYMBIAN32__)
|
||||||
|
#include <esdl\SDL.h>
|
||||||
|
#else
|
||||||
|
#include <SDL.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SDL audio cd manager. Implements real audio cd playback.
|
||||||
|
*/
|
||||||
|
class SdlAudioCDManager : public DefaultAudioCDManager {
|
||||||
|
public:
|
||||||
|
SdlAudioCDManager();
|
||||||
|
virtual ~SdlAudioCDManager();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool openCD(int drive);
|
||||||
|
virtual void updateCD();
|
||||||
|
virtual bool pollCD() const;
|
||||||
|
virtual void playCD(int track, int num_loops, int start_frame, int duration);
|
||||||
|
virtual void stopCD();
|
||||||
|
|
||||||
|
SDL_CD *_cdrom;
|
||||||
|
int _cdTrack, _cdNumLoops, _cdStartFrame, _cdDuration;
|
||||||
|
uint32 _cdEndTime, _cdStopTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "backends/base-backend.h"
|
#include "backends/base-backend.h"
|
||||||
#include "backends/events/default/default-events.h"
|
#include "backends/events/default/default-events.h"
|
||||||
|
#include "backends/audiocd/default/default-audiocd.h"
|
||||||
#include "gui/message.h"
|
#include "gui/message.h"
|
||||||
|
|
||||||
void BaseBackend::displayMessageOnOSD(const char *msg) {
|
void BaseBackend::displayMessageOnOSD(const char *msg) {
|
||||||
|
@ -71,6 +72,14 @@ void BaseBackend::fillScreen(uint32 col) {
|
||||||
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BaseBackend::BaseBackend() {
|
||||||
|
_audiocdManager = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseBackend::~BaseBackend() {
|
||||||
|
delete _audiocdManager;
|
||||||
|
}
|
||||||
|
|
||||||
Common::SeekableReadStream *BaseBackend::createConfigReadStream() {
|
Common::SeekableReadStream *BaseBackend::createConfigReadStream() {
|
||||||
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
Common::FSNode file(DEFAULT_CONFIG_FILE);
|
||||||
return file.createReadStream();
|
return file.createReadStream();
|
||||||
|
@ -84,3 +93,15 @@ Common::WriteStream *BaseBackend::createConfigWriteStream() {
|
||||||
return file.createWriteStream();
|
return file.createWriteStream();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioCDManager *BaseBackend::getAudioCDManager() {
|
||||||
|
if (!_audiocdManager)
|
||||||
|
_audiocdManager = new DefaultAudioCDManager();
|
||||||
|
return _audiocdManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseBackend::resetGraphicsScale() {
|
||||||
|
// As a hack, we use 0 here. Backends should override this method
|
||||||
|
// and provide their own.
|
||||||
|
setGraphicsMode(0);
|
||||||
|
}
|
||||||
|
|
|
@ -31,12 +31,22 @@
|
||||||
|
|
||||||
class BaseBackend : public OSystem, Common::EventSource {
|
class BaseBackend : public OSystem, Common::EventSource {
|
||||||
public:
|
public:
|
||||||
|
BaseBackend();
|
||||||
|
~BaseBackend();
|
||||||
|
|
||||||
virtual Common::EventManager *getEventManager();
|
virtual Common::EventManager *getEventManager();
|
||||||
virtual void displayMessageOnOSD(const char *msg);
|
virtual void displayMessageOnOSD(const char *msg);
|
||||||
virtual void fillScreen(uint32 col);
|
virtual void fillScreen(uint32 col);
|
||||||
|
|
||||||
virtual Common::SeekableReadStream *createConfigReadStream();
|
virtual Common::SeekableReadStream *createConfigReadStream();
|
||||||
virtual Common::WriteStream *createConfigWriteStream();
|
virtual Common::WriteStream *createConfigWriteStream();
|
||||||
|
|
||||||
|
virtual AudioCDManager *getAudioCDManager();
|
||||||
|
|
||||||
|
virtual void resetGraphicsScale();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
AudioCDManager *_audiocdManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ MODULE := backends
|
||||||
|
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
base-backend.o \
|
base-backend.o \
|
||||||
|
audiocd/default/default-audiocd.o \
|
||||||
|
audiocd/sdl/sdl-audiocd.o \
|
||||||
events/default/default-events.o \
|
events/default/default-events.o \
|
||||||
fs/abstract-fs.o \
|
fs/abstract-fs.o \
|
||||||
fs/stdiostream.o \
|
fs/stdiostream.o \
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#else
|
#else
|
||||||
#include "backends/saves/default/default-saves.h"
|
#include "backends/saves/default/default-saves.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "backends/audiocd/sdl/sdl-audiocd.h"
|
||||||
#include "backends/timer/default/default-timer.h"
|
#include "backends/timer/default/default-timer.h"
|
||||||
#include "sound/mixer_intern.h"
|
#include "sound/mixer_intern.h"
|
||||||
|
|
||||||
|
@ -814,88 +815,8 @@ Audio::Mixer *OSystem_SDL::getMixer() {
|
||||||
#pragma mark --- CD Audio ---
|
#pragma mark --- CD Audio ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
bool OSystem_SDL::openCD(int drive) {
|
AudioCDManager *OSystem_SDL::getAudioCDManager() {
|
||||||
if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
|
if (!_audiocdManager)
|
||||||
_cdrom = NULL;
|
_audiocdManager = new SdlAudioCDManager();
|
||||||
else {
|
return _audiocdManager;
|
||||||
_cdrom = SDL_CDOpen(drive);
|
|
||||||
// Did it open? Check if _cdrom is NULL
|
|
||||||
if (!_cdrom) {
|
|
||||||
warning("Couldn't open drive: %s", SDL_GetError());
|
|
||||||
} else {
|
|
||||||
_cdNumLoops = 0;
|
|
||||||
_cdStopTime = 0;
|
|
||||||
_cdEndTime = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (_cdrom != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_SDL::stopCD() { /* Stop CD Audio in 1/10th of a second */
|
|
||||||
_cdStopTime = SDL_GetTicks() + 100;
|
|
||||||
_cdNumLoops = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_SDL::playCD(int track, int num_loops, int start_frame, int duration) {
|
|
||||||
if (!num_loops && !start_frame)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!_cdrom)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (duration > 0)
|
|
||||||
duration += 5;
|
|
||||||
|
|
||||||
_cdTrack = track;
|
|
||||||
_cdNumLoops = num_loops;
|
|
||||||
_cdStartFrame = start_frame;
|
|
||||||
|
|
||||||
SDL_CDStatus(_cdrom);
|
|
||||||
if (start_frame == 0 && duration == 0)
|
|
||||||
SDL_CDPlayTracks(_cdrom, track, 0, 1, 0);
|
|
||||||
else
|
|
||||||
SDL_CDPlayTracks(_cdrom, track, start_frame, 0, duration);
|
|
||||||
_cdDuration = duration;
|
|
||||||
_cdStopTime = 0;
|
|
||||||
_cdEndTime = SDL_GetTicks() + _cdrom->track[track].length * 1000 / CD_FPS;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_SDL::pollCD() {
|
|
||||||
if (!_cdrom)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (_cdNumLoops != 0 && (SDL_GetTicks() < _cdEndTime || SDL_CDStatus(_cdrom) == CD_PLAYING));
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_SDL::updateCD() {
|
|
||||||
if (!_cdrom)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_cdStopTime != 0 && SDL_GetTicks() >= _cdStopTime) {
|
|
||||||
SDL_CDStop(_cdrom);
|
|
||||||
_cdNumLoops = 0;
|
|
||||||
_cdStopTime = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_cdNumLoops == 0 || SDL_GetTicks() < _cdEndTime)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_cdNumLoops != 1 && SDL_CDStatus(_cdrom) != CD_STOPPED) {
|
|
||||||
// Wait another second for it to be done
|
|
||||||
_cdEndTime += 1000;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_cdNumLoops > 0)
|
|
||||||
_cdNumLoops--;
|
|
||||||
|
|
||||||
if (_cdNumLoops != 0) {
|
|
||||||
if (_cdStartFrame == 0 && _cdDuration == 0)
|
|
||||||
SDL_CDPlayTracks(_cdrom, _cdTrack, 0, 1, 0);
|
|
||||||
else
|
|
||||||
SDL_CDPlayTracks(_cdrom, _cdTrack, _cdStartFrame, 0, _cdDuration);
|
|
||||||
_cdEndTime = SDL_GetTicks() + _cdrom->track[_cdTrack].length * 1000 / CD_FPS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,18 +186,7 @@ public:
|
||||||
|
|
||||||
virtual Audio::Mixer *getMixer();
|
virtual Audio::Mixer *getMixer();
|
||||||
|
|
||||||
// Poll CD status
|
virtual AudioCDManager *getAudioCDManager();
|
||||||
// Returns true if cd audio is playing
|
|
||||||
bool pollCD();
|
|
||||||
|
|
||||||
// Play CD audio track
|
|
||||||
void playCD(int track, int num_loops, int start_frame, int duration);
|
|
||||||
|
|
||||||
// Stop CD audio track
|
|
||||||
void stopCD();
|
|
||||||
|
|
||||||
// Update CD audio status
|
|
||||||
void updateCD();
|
|
||||||
|
|
||||||
// Quit
|
// Quit
|
||||||
virtual void quit(); // overloaded by CE backend
|
virtual void quit(); // overloaded by CE backend
|
||||||
|
@ -232,7 +221,6 @@ public:
|
||||||
virtual int getGraphicsMode() const;
|
virtual int getGraphicsMode() const;
|
||||||
|
|
||||||
virtual void setWindowCaption(const char *caption);
|
virtual void setWindowCaption(const char *caption);
|
||||||
virtual bool openCD(int drive);
|
|
||||||
|
|
||||||
virtual bool hasFeature(Feature f);
|
virtual bool hasFeature(Feature f);
|
||||||
virtual void setFeatureState(Feature f, bool enable);
|
virtual void setFeatureState(Feature f, bool enable);
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
#include "gui/message.h"
|
#include "gui/message.h"
|
||||||
#include "gui/error.h"
|
#include "gui/error.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
|
|
||||||
#include "backends/keymapper/keymapper.h"
|
#include "backends/keymapper/keymapper.h"
|
||||||
|
@ -444,15 +443,6 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
||||||
GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game"));
|
GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will destroy the AudioCDManager singleton here to save some memory.
|
|
||||||
// This will not make the CD audio stop, one would have to enable this:
|
|
||||||
//AudioCD.stop();
|
|
||||||
// but the engine is responsible for stopping CD playback anyway and
|
|
||||||
// this way we catch engines not doing it properly. For some more
|
|
||||||
// information about why AudioCDManager::destroy does not stop the CD
|
|
||||||
// playback read the FIXME in sound/audiocd.h
|
|
||||||
Audio::AudioCDManager::destroy();
|
|
||||||
|
|
||||||
// reset the graphics to default
|
// reset the graphics to default
|
||||||
setupGraphics(system);
|
setupGraphics(system);
|
||||||
launcherDialog();
|
launcherDialog();
|
||||||
|
|
|
@ -53,11 +53,3 @@ bool OSystem::setGraphicsMode(const char *name) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSystem::openCD(int drive) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem::pollCD() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
#include "graphics/pixelformat.h"
|
#include "graphics/pixelformat.h"
|
||||||
|
|
||||||
|
#include "backends/audiocd/audiocd.h"
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
class Mixer;
|
class Mixer;
|
||||||
}
|
}
|
||||||
|
@ -354,6 +356,13 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int getGraphicsMode() const = 0;
|
virtual int getGraphicsMode() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the graphics scale factor to x1. Games with large screen sizes
|
||||||
|
* reset the scale to x1 so the screen will not be too big when starting
|
||||||
|
* the game.
|
||||||
|
*/
|
||||||
|
virtual void resetGraphicsScale() = 0;
|
||||||
|
|
||||||
#ifdef USE_RGB_COLOR
|
#ifdef USE_RGB_COLOR
|
||||||
/**
|
/**
|
||||||
* Determine the pixel format currently in use for screen rendering.
|
* Determine the pixel format currently in use for screen rendering.
|
||||||
|
@ -926,46 +935,14 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** @name Audio CD */
|
||||||
* @name Audio CD
|
|
||||||
* The methods in this group deal with Audio CD playback.
|
|
||||||
* The default implementation simply does nothing.
|
|
||||||
* This is the lower level implementation as provided by the
|
|
||||||
* backends. The engines should use the Audio::AudioCDManager
|
|
||||||
* class instead of using it directly.
|
|
||||||
*/
|
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise the specified CD drive for audio playback.
|
* Return the audio cd manager. For more information, refer to the
|
||||||
* @return true if the CD drive was inited succesfully
|
* AudioCDManager documentation.
|
||||||
*/
|
*/
|
||||||
virtual bool openCD(int drive);
|
virtual AudioCDManager *getAudioCDManager() = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Poll CD status.
|
|
||||||
* @return true if CD audio is playing
|
|
||||||
*/
|
|
||||||
virtual bool pollCD();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start audio CD playback.
|
|
||||||
* @param track the track to play.
|
|
||||||
* @param num_loops how often playback should be repeated (-1 = infinitely often).
|
|
||||||
* @param start_frame the frame at which playback should start (75 frames = 1 second).
|
|
||||||
* @param duration the number of frames to play.
|
|
||||||
*/
|
|
||||||
virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop audio CD playback.
|
|
||||||
*/
|
|
||||||
virtual void stopCD() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update cdrom audio status.
|
|
||||||
*/
|
|
||||||
virtual void updateCD() {}
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
|
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/mods/protracker.h"
|
#include "sound/mods/protracker.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
namespace AGOS {
|
namespace AGOS {
|
||||||
|
|
||||||
|
@ -901,7 +900,7 @@ AGOSEngine::~AGOSEngine() {
|
||||||
_midi.close();
|
_midi.close();
|
||||||
delete _driver;
|
delete _driver;
|
||||||
|
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
|
|
||||||
for (uint i = 0; i < _itemHeap.size(); i++) {
|
for (uint i = 0; i < _itemHeap.size(); i++) {
|
||||||
delete[] _itemHeap[i];
|
delete[] _itemHeap[i];
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
|
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
namespace AGOS {
|
namespace AGOS {
|
||||||
|
|
||||||
|
@ -429,7 +428,7 @@ void AGOSEngine::delay(uint amount) {
|
||||||
uint32 cur = start;
|
uint32 cur = start;
|
||||||
uint this_delay, vgaPeriod;
|
uint this_delay, vgaPeriod;
|
||||||
|
|
||||||
AudioCD.updateCD();
|
_system->getAudioCDManager()->updateCD();
|
||||||
|
|
||||||
_debugger->onFrame();
|
_debugger->onFrame();
|
||||||
|
|
||||||
|
@ -534,7 +533,7 @@ void AGOSEngine::delay(uint amount) {
|
||||||
if (_leftButton == 1)
|
if (_leftButton == 1)
|
||||||
_leftButtonCount++;
|
_leftButtonCount++;
|
||||||
|
|
||||||
AudioCD.updateCD();
|
_system->getAudioCDManager()->updateCD();
|
||||||
|
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "agos/agos.h"
|
#include "agos/agos.h"
|
||||||
#include "agos/vga.h"
|
#include "agos/vga.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/mods/protracker.h"
|
#include "sound/mods/protracker.h"
|
||||||
|
@ -226,9 +225,9 @@ void AGOSEngine_Simon1::playMusic(uint16 music, uint16 track) {
|
||||||
stopMusic();
|
stopMusic();
|
||||||
|
|
||||||
// Support for compressed music from the ScummVM Music Enhancement Project
|
// Support for compressed music from the ScummVM Music Enhancement Project
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
AudioCD.play(music + 1, -1, 0, 0);
|
_system->getAudioCDManager()->play(music + 1, -1, 0, 0);
|
||||||
if (AudioCD.isPlaying())
|
if (_system->getAudioCDManager()->isPlaying())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (getPlatform() == Common::kPlatformAmiga) {
|
if (getPlatform() == Common::kPlatformAmiga) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
|
||||||
|
|
||||||
int cd_num = ConfMan.getInt("cdrom");
|
int cd_num = ConfMan.getInt("cdrom");
|
||||||
if (cd_num >= 0)
|
if (cd_num >= 0)
|
||||||
_system->openCD(cd_num);
|
_system->getAudioCDManager()->openCD(cd_num);
|
||||||
|
|
||||||
_lang = kEnglish;
|
_lang = kEnglish;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "sound/decoders/raw.h"
|
#include "sound/decoders/raw.h"
|
||||||
|
@ -123,20 +122,20 @@ void DrasculaEngine::finishSound() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrasculaEngine::playMusic(int p) {
|
void DrasculaEngine::playMusic(int p) {
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
AudioCD.play(p - 1, 1, 0, 0);
|
_system->getAudioCDManager()->play(p - 1, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrasculaEngine::stopMusic() {
|
void DrasculaEngine::stopMusic() {
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrasculaEngine::updateMusic() {
|
void DrasculaEngine::updateMusic() {
|
||||||
AudioCD.updateCD();
|
_system->getAudioCDManager()->updateCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DrasculaEngine::musicStatus() {
|
int DrasculaEngine::musicStatus() {
|
||||||
return AudioCD.isPlaying();
|
return _system->getAudioCDManager()->isPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrasculaEngine::stopSound() {
|
void DrasculaEngine::stopSound() {
|
||||||
|
@ -157,7 +156,7 @@ void DrasculaEngine::MusicFadeout() {
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
_system->delayMillis(50);
|
_system->delayMillis(50);
|
||||||
}
|
}
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
_system->delayMillis(100);
|
_system->delayMillis(100);
|
||||||
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol);
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol);
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ Common::Error GobEngine::run() {
|
||||||
|
|
||||||
int cd_num = ConfMan.getInt("cdrom");
|
int cd_num = ConfMan.getInt("cdrom");
|
||||||
if (cd_num >= 0)
|
if (cd_num >= 0)
|
||||||
_system->openCD(cd_num);
|
_system->getAudioCDManager()->openCD(cd_num);
|
||||||
|
|
||||||
_global->_debugFlag = 1;
|
_global->_debugFlag = 1;
|
||||||
_video->_doRangeClamp = true;
|
_video->_doRangeClamp = true;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
#include "common/str.h"
|
#include "common/str.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
#include "gob/gob.h"
|
#include "gob/gob.h"
|
||||||
#include "gob/sound/cdrom.h"
|
#include "gob/sound/cdrom.h"
|
||||||
|
@ -116,7 +115,7 @@ void CDROM::play(uint32 from, uint32 to) {
|
||||||
// HSG encodes frame information into a double word:
|
// HSG encodes frame information into a double word:
|
||||||
// minute multiplied by 4500, plus second multiplied by 75,
|
// minute multiplied by 4500, plus second multiplied by 75,
|
||||||
// plus frame, minus 150
|
// plus frame, minus 150
|
||||||
AudioCD.play(1, 1, from, to - from + 1);
|
g_system->getAudioCDManager()->play(1, 1, from, to - from + 1);
|
||||||
_cdPlaying = true;
|
_cdPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +160,7 @@ void CDROM::stopPlaying() {
|
||||||
|
|
||||||
void CDROM::stop() {
|
void CDROM::stop() {
|
||||||
_curTrackBuffer = 0;
|
_curTrackBuffer = 0;
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
_cdPlaying = false;
|
_cdPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ Common::Error GroovieEngine::run() {
|
||||||
// Initialize the CD
|
// Initialize the CD
|
||||||
int cd_num = ConfMan.getInt("cdrom");
|
int cd_num = ConfMan.getInt("cdrom");
|
||||||
if (cd_num >= 0)
|
if (cd_num >= 0)
|
||||||
_system->openCD(cd_num);
|
_system->getAudioCDManager()->openCD(cd_num);
|
||||||
|
|
||||||
while (!shouldQuit()) {
|
while (!shouldQuit()) {
|
||||||
// Give the debugger a chance to act
|
// Give the debugger a chance to act
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "common/macresman.h"
|
#include "common/macresman.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/midiparser.h"
|
#include "sound/midiparser.h"
|
||||||
|
|
||||||
namespace Groovie {
|
namespace Groovie {
|
||||||
|
@ -42,7 +41,7 @@ MusicPlayer::MusicPlayer(GroovieEngine *vm) :
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicPlayer::~MusicPlayer() {
|
MusicPlayer::~MusicPlayer() {
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MusicPlayer::playSong(uint32 fileref) {
|
void MusicPlayer::playSong(uint32 fileref) {
|
||||||
|
@ -90,7 +89,7 @@ void MusicPlayer::playCD(uint8 track) {
|
||||||
// the song number (it's track 2 on the 2nd CD)
|
// the song number (it's track 2 on the 2nd CD)
|
||||||
} else if ((track == 98) && (_prevCDtrack == 3)) {
|
} else if ((track == 98) && (_prevCDtrack == 3)) {
|
||||||
// Track 98 is used as a hack to stop the credits song
|
// Track 98 is used as a hack to stop the credits song
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,20 +100,20 @@ void MusicPlayer::playCD(uint8 track) {
|
||||||
// It was in the original interpreter, but it introduces a big delay
|
// It was in the original interpreter, but it introduces a big delay
|
||||||
// in the middle of the introduction, so it's disabled right now
|
// in the middle of the introduction, so it's disabled right now
|
||||||
/*
|
/*
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
while (AudioCD.isPlaying()) {
|
while (g_system->getAudioCDManager()->isPlaying()) {
|
||||||
// Wait a bit and try again
|
// Wait a bit and try again
|
||||||
_vm->_system->delayMillis(100);
|
_vm->_system->delayMillis(100);
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Play the track starting at the requested offset (1000ms = 75 frames)
|
// Play the track starting at the requested offset (1000ms = 75 frames)
|
||||||
AudioCD.play(track - 1, 1, startms * 75 / 1000, 0);
|
g_system->getAudioCDManager()->play(track - 1, 1, startms * 75 / 1000, 0);
|
||||||
|
|
||||||
// If the audio is not playing from the CD, play the "fallback" MIDI.
|
// If the audio is not playing from the CD, play the "fallback" MIDI.
|
||||||
// The Mac version has no CD tracks, so it will always use the MIDI.
|
// The Mac version has no CD tracks, so it will always use the MIDI.
|
||||||
if (!AudioCD.isPlaying()) {
|
if (!g_system->getAudioCDManager()->isPlaying()) {
|
||||||
if (track == 2) {
|
if (track == 2) {
|
||||||
// Intro MIDI fallback
|
// Intro MIDI fallback
|
||||||
if (_vm->getPlatform() == Common::kPlatformMacintosh)
|
if (_vm->getPlatform() == Common::kPlatformMacintosh)
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "kyra/sound_intern.h"
|
#include "kyra/sound_intern.h"
|
||||||
#include "kyra/screen.h"
|
#include "kyra/screen.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/decoders/raw.h"
|
#include "sound/decoders/raw.h"
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ SoundTowns::SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer)
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundTowns::~SoundTowns() {
|
SoundTowns::~SoundTowns() {
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
haltTrack();
|
haltTrack();
|
||||||
delete _driver;
|
delete _driver;
|
||||||
delete[] _musicTrackData;
|
delete[] _musicTrackData;
|
||||||
|
@ -75,7 +74,7 @@ bool SoundTowns::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundTowns::process() {
|
void SoundTowns::process() {
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundTowns::playTrack(uint8 track) {
|
void SoundTowns::playTrack(uint8 track) {
|
||||||
|
@ -83,7 +82,7 @@ void SoundTowns::playTrack(uint8 track) {
|
||||||
return;
|
return;
|
||||||
track -= 2;
|
track -= 2;
|
||||||
|
|
||||||
const int32 * const tTable = (const int32 *)cdaData();
|
const int32 *const tTable = (const int32 *const)cdaData();
|
||||||
int tTableIndex = 3 * track;
|
int tTableIndex = 3 * track;
|
||||||
|
|
||||||
int trackNum = (int)READ_LE_UINT32(&tTable[tTableIndex + 2]);
|
int trackNum = (int)READ_LE_UINT32(&tTable[tTableIndex + 2]);
|
||||||
|
@ -96,8 +95,8 @@ void SoundTowns::playTrack(uint8 track) {
|
||||||
|
|
||||||
if (_musicEnabled == 2 && trackNum != -1) {
|
if (_musicEnabled == 2 && trackNum != -1) {
|
||||||
_driver->setOutputVolume(1, 118, 118);
|
_driver->setOutputVolume(1, 118, 118);
|
||||||
AudioCD.play(trackNum+1, loop ? -1 : 1, 0, 0);
|
g_system->getAudioCDManager()->play(trackNum + 1, loop ? -1 : 1, 0, 0);
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
_cdaPlaying = true;
|
_cdaPlaying = true;
|
||||||
} else if (_musicEnabled) {
|
} else if (_musicEnabled) {
|
||||||
playEuphonyTrack(READ_LE_UINT32(&tTable[tTableIndex]), loop);
|
playEuphonyTrack(READ_LE_UINT32(&tTable[tTableIndex]), loop);
|
||||||
|
@ -109,8 +108,8 @@ void SoundTowns::playTrack(uint8 track) {
|
||||||
|
|
||||||
void SoundTowns::haltTrack() {
|
void SoundTowns::haltTrack() {
|
||||||
_lastTrack = -1;
|
_lastTrack = -1;
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
_cdaPlaying = false;
|
_cdaPlaying = false;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
|
@ -437,8 +436,8 @@ void SoundPC98::playTrack(uint8 track) {
|
||||||
|
|
||||||
void SoundPC98::haltTrack() {
|
void SoundPC98::haltTrack() {
|
||||||
_lastTrack = -1;
|
_lastTrack = -1;
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
_driver->reset();
|
_driver->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +520,7 @@ void SoundTownsPC98_v2::loadSoundFile(Common::String file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundTownsPC98_v2::process() {
|
void SoundTownsPC98_v2::process() {
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundTownsPC98_v2::playTrack(uint8 track) {
|
void SoundTownsPC98_v2::playTrack(uint8 track) {
|
||||||
|
@ -530,7 +529,7 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
|
||||||
if (track == _lastTrack && _musicEnabled)
|
if (track == _lastTrack && _musicEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const uint16 * const cdaTracks = (const uint16 *)cdaData();
|
const uint16 *const cdaTracks = (const uint16 *const) cdaData();
|
||||||
|
|
||||||
int trackNum = -1;
|
int trackNum = -1;
|
||||||
if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
|
if (_vm->gameFlags().platform == Common::kPlatformFMTowns) {
|
||||||
|
@ -558,8 +557,8 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
|
||||||
_driver->loadMusicData(_musicTrackData, true);
|
_driver->loadMusicData(_musicTrackData, true);
|
||||||
|
|
||||||
if (_musicEnabled == 2 && trackNum != -1) {
|
if (_musicEnabled == 2 && trackNum != -1) {
|
||||||
AudioCD.play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0);
|
g_system->getAudioCDManager()->play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0);
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
} else if (_musicEnabled) {
|
} else if (_musicEnabled) {
|
||||||
_driver->cont();
|
_driver->cont();
|
||||||
}
|
}
|
||||||
|
@ -569,8 +568,8 @@ void SoundTownsPC98_v2::playTrack(uint8 track) {
|
||||||
|
|
||||||
void SoundTownsPC98_v2::haltTrack() {
|
void SoundTownsPC98_v2::haltTrack() {
|
||||||
_lastTrack = -1;
|
_lastTrack = -1;
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
_driver->reset();
|
_driver->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "base/plugins.h"
|
#include "base/plugins.h"
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
#include "made/made.h"
|
#include "made/made.h"
|
||||||
|
@ -83,7 +82,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
|
||||||
|
|
||||||
int cd_num = ConfMan.getInt("cdrom");
|
int cd_num = ConfMan.getInt("cdrom");
|
||||||
if (cd_num >= 0)
|
if (cd_num >= 0)
|
||||||
_system->openCD(cd_num);
|
_system->getAudioCDManager()->openCD(cd_num);
|
||||||
|
|
||||||
_pmvPlayer = new PmvPlayer(this, _mixer);
|
_pmvPlayer = new PmvPlayer(this, _mixer);
|
||||||
_res = new ResourceReader();
|
_res = new ResourceReader();
|
||||||
|
@ -132,7 +131,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
|
||||||
}
|
}
|
||||||
|
|
||||||
MadeEngine::~MadeEngine() {
|
MadeEngine::~MadeEngine() {
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
|
|
||||||
delete _rnd;
|
delete _rnd;
|
||||||
delete _console;
|
delete _console;
|
||||||
|
@ -251,7 +250,7 @@ void MadeEngine::handleEvents() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioCD.updateCD();
|
_system->getAudioCDManager()->updateCD();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "sound/decoders/voc.h"
|
#include "sound/decoders/voc.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
#include "engines/engine.h"
|
#include "engines/engine.h"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/events.h"
|
#include "common/events.h"
|
||||||
#include "graphics/cursorman.h"
|
#include "graphics/cursorman.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/softsynth/pcspk.h"
|
#include "sound/softsynth/pcspk.h"
|
||||||
|
|
||||||
#include "made/made.h"
|
#include "made/made.h"
|
||||||
|
@ -654,9 +653,9 @@ int16 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
|
int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
|
||||||
AudioCD.play(argv[0] - 1, 1, 0, 0);
|
g_system->getAudioCDManager()->play(argv[0] - 1, 1, 0, 0);
|
||||||
_vm->_cdTimeStart = _vm->_system->getMillis();
|
_vm->_cdTimeStart = _vm->_system->getMillis();
|
||||||
if (AudioCD.isPlaying()) {
|
if (g_system->getAudioCDManager()->isPlaying()) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -664,8 +663,8 @@ int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
|
int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
|
||||||
if (AudioCD.isPlaying()) {
|
if (g_system->getAudioCDManager()->isPlaying()) {
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -673,11 +672,11 @@ int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 ScriptFunctions::sfGetCdStatus(int16 argc, int16 *argv) {
|
int16 ScriptFunctions::sfGetCdStatus(int16 argc, int16 *argv) {
|
||||||
return AudioCD.isPlaying() ? 1 : 0;
|
return g_system->getAudioCDManager()->isPlaying() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
|
int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
|
||||||
if (AudioCD.isPlaying()) {
|
if (g_system->getAudioCDManager()->isPlaying()) {
|
||||||
uint32 deltaTime = _vm->_system->getMillis() - _vm->_cdTimeStart;
|
uint32 deltaTime = _vm->_system->getMillis() - _vm->_cdTimeStart;
|
||||||
// This basically converts the time from milliseconds to MSF format to MADE's format
|
// This basically converts the time from milliseconds to MSF format to MADE's format
|
||||||
return (deltaTime / 1000 * 30) + (deltaTime % 1000 / 75 * 30 / 75);
|
return (deltaTime / 1000 * 30) + (deltaTime % 1000 / 75 * 30 / 75);
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
#ifndef SAGA_MUSIC_H
|
#ifndef SAGA_MUSIC_H
|
||||||
#define SAGA_MUSIC_H
|
#define SAGA_MUSIC_H
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/midiparser.h"
|
#include "sound/midiparser.h"
|
||||||
|
#include "sound/mixer.h"
|
||||||
#include "sound/decoders/mp3.h"
|
#include "sound/decoders/mp3.h"
|
||||||
#include "sound/decoders/vorbis.h"
|
#include "sound/decoders/vorbis.h"
|
||||||
#include "sound/decoders/flac.h"
|
#include "sound/decoders/flac.h"
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/decoders/aiff.h"
|
#include "sound/decoders/aiff.h"
|
||||||
#include "sound/decoders/flac.h"
|
#include "sound/decoders/flac.h"
|
||||||
|
@ -413,7 +412,7 @@ int AudioPlayer::audioCdPlay(int track, int start, int duration) {
|
||||||
|
|
||||||
// Subtract one from track. KQ6 starts at track 1, while ScummVM
|
// Subtract one from track. KQ6 starts at track 1, while ScummVM
|
||||||
// ignores the data track and considers track 2 to be track 1.
|
// ignores the data track and considers track 2 to be track 1.
|
||||||
AudioCD.play(track - 1, 1, start, duration);
|
g_system->getAudioCDManager()->play(track - 1, 1, start, duration);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
// Jones in the Fast Lane CD Audio format
|
// Jones in the Fast Lane CD Audio format
|
||||||
|
@ -436,7 +435,7 @@ int AudioPlayer::audioCdPlay(int track, int start, int duration) {
|
||||||
|
|
||||||
// Jones uses the track as the resource value in the map
|
// Jones uses the track as the resource value in the map
|
||||||
if (res == track) {
|
if (res == track) {
|
||||||
AudioCD.play(1, 1, startFrame, length);
|
g_system->getAudioCDManager()->play(1, 1, startFrame, length);
|
||||||
_audioCdStart = g_system->getMillis();
|
_audioCdStart = g_system->getMillis();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -450,16 +449,16 @@ int AudioPlayer::audioCdPlay(int track, int start, int duration) {
|
||||||
|
|
||||||
void AudioPlayer::audioCdStop() {
|
void AudioPlayer::audioCdStop() {
|
||||||
_audioCdStart = 0;
|
_audioCdStart = 0;
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioPlayer::audioCdUpdate() {
|
void AudioPlayer::audioCdUpdate() {
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioPlayer::audioCdPosition() {
|
int AudioPlayer::audioCdPosition() {
|
||||||
// Return -1 if the sample is done playing. Converting to frames to compare.
|
// Return -1 if the sample is done playing. Converting to frames to compare.
|
||||||
if (((g_system->getMillis() - _audioCdStart) * 75 / 1000) >= (uint32)AudioCD.getStatus().duration)
|
if (((g_system->getMillis() - _audioCdStart) * 75 / 1000) >= (uint32)g_system->getAudioCDManager()->getStatus().duration)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Return the position otherwise (in ticks).
|
// Return the position otherwise (in ticks).
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
#include "sound/decoders/adpcm.h"
|
#include "sound/decoders/adpcm.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/decoders/flac.h"
|
#include "sound/decoders/flac.h"
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include "scumm/he/sprite_he.h"
|
#include "scumm/he/sprite_he.h"
|
||||||
#include "scumm/verbs.h"
|
#include "scumm/verbs.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
#include "graphics/thumbnail.h"
|
#include "graphics/thumbnail.h"
|
||||||
|
@ -1107,7 +1106,7 @@ void ScummEngine::saveOrLoad(Serializer *s) {
|
||||||
// as AudioCDManager::Status::playing, and MSVC6 has
|
// as AudioCDManager::Status::playing, and MSVC6 has
|
||||||
// a fit with that. This typedef simplifies the notation
|
// a fit with that. This typedef simplifies the notation
|
||||||
// to something MSVC6 can grasp.
|
// to something MSVC6 can grasp.
|
||||||
typedef Audio::AudioCDManager::Status AudioCDManager_Status;
|
typedef AudioCDManager::Status AudioCDManager_Status;
|
||||||
const SaveLoadEntry audioCDEntries[] = {
|
const SaveLoadEntry audioCDEntries[] = {
|
||||||
MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)),
|
MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)),
|
||||||
MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)),
|
MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)),
|
||||||
|
@ -1408,15 +1407,15 @@ void ScummEngine::saveOrLoad(Serializer *s) {
|
||||||
// Save/load the Audio CD status
|
// Save/load the Audio CD status
|
||||||
//
|
//
|
||||||
if (s->getVersion() >= VER(24)) {
|
if (s->getVersion() >= VER(24)) {
|
||||||
Audio::AudioCDManager::Status info;
|
AudioCDManager::Status info;
|
||||||
if (s->isSaving())
|
if (s->isSaving())
|
||||||
info = AudioCD.getStatus();
|
info = _system->getAudioCDManager()->getStatus();
|
||||||
s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
|
s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
|
||||||
// If we are loading, and the music being loaded was supposed to loop
|
// If we are loading, and the music being loaded was supposed to loop
|
||||||
// forever, then resume playing it. This helps a lot when the audio CD
|
// forever, then resume playing it. This helps a lot when the audio CD
|
||||||
// is used to provide ambient music (see bug #788195).
|
// is used to provide ambient music (see bug #788195).
|
||||||
if (s->isLoading() && info.playing && info.numLoops < 0)
|
if (s->isLoading() && info.playing && info.numLoops < 0)
|
||||||
AudioCD.play(info.track, info.numLoops, info.start, info.duration);
|
_system->getAudioCDManager()->play(info.track, info.numLoops, info.start, info.duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1200,7 +1200,7 @@ void ScummEngine::setupScumm() {
|
||||||
|
|
||||||
int cd_num = ConfMan.getInt("cdrom");
|
int cd_num = ConfMan.getInt("cdrom");
|
||||||
if (cd_num >= 0)
|
if (cd_num >= 0)
|
||||||
_system->openCD(cd_num);
|
_system->getAudioCDManager()->openCD(cd_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the sound manager
|
// Create the sound manager
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "scumm/util.h"
|
#include "scumm/util.h"
|
||||||
|
|
||||||
#include "sound/decoders/adpcm.h"
|
#include "sound/decoders/adpcm.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/decoders/flac.h"
|
#include "sound/decoders/flac.h"
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
@ -89,7 +88,7 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
|
||||||
|
|
||||||
Sound::~Sound() {
|
Sound::~Sound() {
|
||||||
stopCDTimer();
|
stopCDTimer();
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
delete _sfxFile;
|
delete _sfxFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,7 +1026,7 @@ void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) {
|
||||||
|
|
||||||
// Play it
|
// Play it
|
||||||
if (!_soundsPaused)
|
if (!_soundsPaused)
|
||||||
AudioCD.play(track, numLoops, startFrame, duration);
|
g_system->getAudioCDManager()->play(track, numLoops, startFrame, duration);
|
||||||
|
|
||||||
// Start the timer after starting the track. Starting an MP3 track is
|
// Start the timer after starting the track. Starting an MP3 track is
|
||||||
// almost instantaneous, but a CD player may take some time. Hopefully
|
// almost instantaneous, but a CD player may take some time. Hopefully
|
||||||
|
@ -1036,15 +1035,15 @@ void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::stopCD() {
|
void Sound::stopCD() {
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Sound::pollCD() const {
|
int Sound::pollCD() const {
|
||||||
return AudioCD.isPlaying();
|
return g_system->getAudioCDManager()->isPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::updateCD() {
|
void Sound::updateCD() {
|
||||||
AudioCD.updateCD();
|
g_system->getAudioCDManager()->updateCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::saveLoadWithSerializer(Serializer *ser) {
|
void Sound::saveLoadWithSerializer(Serializer *ser) {
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "engines/advancedDetector.h"
|
#include "engines/advancedDetector.h"
|
||||||
#include "engines/util.h"
|
#include "engines/util.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "sound/decoders/raw.h"
|
#include "sound/decoders/raw.h"
|
||||||
|
|
||||||
|
@ -983,7 +982,7 @@ void TeenAgentEngine::setMusic(byte id) {
|
||||||
}
|
}
|
||||||
byte track = track2cd[id - 1];
|
byte track = track2cd[id - 1];
|
||||||
debug(0, "playing cd track %u", track);
|
debug(0, "playing cd track %u", track);
|
||||||
Audio::AudioCDManager::instance().play(track, -1, 0, 0);
|
_system->getAudioCDManager()->play(track, -1, 0, 0);
|
||||||
} else if (music->load(id))
|
} else if (music->load(id))
|
||||||
music->start();
|
music->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/softsynth/pcspk.h"
|
#include "sound/softsynth/pcspk.h"
|
||||||
|
|
||||||
#include "testbed/sound.h"
|
#include "testbed/sound.h"
|
||||||
|
@ -190,8 +189,8 @@ TestExitStatus SoundSubsystem::audiocdOutput() {
|
||||||
|
|
||||||
// Play all tracks
|
// Play all tracks
|
||||||
for (int i = 1; i < 5; i++) {
|
for (int i = 1; i < 5; i++) {
|
||||||
AudioCD.play(i, 1, 0, 0);
|
g_system->getAudioCDManager()->play(i, 1, 0, 0);
|
||||||
while (AudioCD.isPlaying()) {
|
while (g_system->getAudioCDManager()->isPlaying()) {
|
||||||
g_system->delayMillis(500);
|
g_system->delayMillis(500);
|
||||||
Testsuite::writeOnScreen(Common::String::format("Playing Now: track%02d", i), pt);
|
Testsuite::writeOnScreen(Common::String::format("Playing Now: track%02d", i), pt);
|
||||||
}
|
}
|
||||||
|
@ -200,7 +199,7 @@ TestExitStatus SoundSubsystem::audiocdOutput() {
|
||||||
|
|
||||||
Testsuite::clearScreen();
|
Testsuite::clearScreen();
|
||||||
if (Testsuite::handleInteractiveInput("Were all the tracks played in order i.e 1-2-3-last ?", "Yes", "No", kOptionRight)) {
|
if (Testsuite::handleInteractiveInput("Were all the tracks played in order i.e 1-2-3-last ?", "Yes", "No", kOptionRight)) {
|
||||||
Testsuite::logPrintf("Error! Error in AudioCD.play() or probably sound files were not detected, try -d1 (debuglevel 1)\n");
|
Testsuite::logPrintf("Error! Error in _system->getAudioCDManager()->play() or probably sound files were not detected, try -d1 (debuglevel 1)\n");
|
||||||
passed = kTestFailed;
|
passed = kTestFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/midiparser.h"
|
#include "sound/midiparser.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/decoders/adpcm.h"
|
#include "sound/decoders/adpcm.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
|
@ -191,11 +190,11 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
|
||||||
currentLoop = bLoop;
|
currentLoop = bLoop;
|
||||||
|
|
||||||
// try to play track, but don't fall back to a true CD
|
// try to play track, but don't fall back to a true CD
|
||||||
AudioCD.play(track, bLoop ? -1 : 1, 0, 0, true);
|
g_system->getAudioCDManager()->play(track, bLoop ? -1 : 1, 0, 0, true);
|
||||||
|
|
||||||
// Check if an enhanced audio track is being played.
|
// Check if an enhanced audio track is being played.
|
||||||
// If it is, stop here and don't load a MIDI track
|
// If it is, stop here and don't load a MIDI track
|
||||||
if (AudioCD.isPlaying()) {
|
if (g_system->getAudioCDManager()->isPlaying()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +269,7 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
|
||||||
*/
|
*/
|
||||||
bool MidiPlaying() {
|
bool MidiPlaying() {
|
||||||
if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
|
if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
|
||||||
if (AudioCD.isPlaying())
|
if (g_system->getAudioCDManager()->isPlaying())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return _vm->_midiMusic->isPlaying();
|
return _vm->_midiMusic->isPlaying();
|
||||||
|
@ -284,7 +283,7 @@ bool StopMidi() {
|
||||||
currentLoop = false;
|
currentLoop = false;
|
||||||
|
|
||||||
if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
|
if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
|
||||||
AudioCD.stop();
|
g_system->getAudioCDManager()->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
_vm->_midiMusic->stop();
|
_vm->_midiMusic->stop();
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
|
|
||||||
#include "sound/mididrv.h"
|
#include "sound/mididrv.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
#include "tinsel/actors.h"
|
#include "tinsel/actors.h"
|
||||||
#include "tinsel/background.h"
|
#include "tinsel/background.h"
|
||||||
|
@ -853,7 +852,7 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc)
|
||||||
|
|
||||||
int cd_num = ConfMan.getInt("cdrom");
|
int cd_num = ConfMan.getInt("cdrom");
|
||||||
if (cd_num >= 0)
|
if (cd_num >= 0)
|
||||||
_system->openCD(cd_num);
|
_system->getAudioCDManager()->openCD(cd_num);
|
||||||
|
|
||||||
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
|
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
|
||||||
bool native_mt32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"));
|
bool native_mt32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"));
|
||||||
|
@ -889,7 +888,7 @@ TinselEngine::~TinselEngine() {
|
||||||
if (_bmv->MoviePlaying())
|
if (_bmv->MoviePlaying())
|
||||||
_bmv->FinishBMV();
|
_bmv->FinishBMV();
|
||||||
|
|
||||||
AudioCD.stop();
|
_system->getAudioCDManager()->stop();
|
||||||
delete _bmv;
|
delete _bmv;
|
||||||
delete _sound;
|
delete _sound;
|
||||||
delete _midiMusic;
|
delete _midiMusic;
|
||||||
|
@ -999,7 +998,7 @@ Common::Error TinselEngine::run() {
|
||||||
// Check for time to do next game cycle
|
// Check for time to do next game cycle
|
||||||
if ((g_system->getMillis() > timerVal + GAME_FRAME_DELAY)) {
|
if ((g_system->getMillis() > timerVal + GAME_FRAME_DELAY)) {
|
||||||
timerVal = g_system->getMillis();
|
timerVal = g_system->getMillis();
|
||||||
AudioCD.updateCD();
|
_system->getAudioCDManager()->updateCD();
|
||||||
NextGameCycle();
|
NextGameCycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SOUND_AUDIOCD_H
|
|
||||||
#define SOUND_AUDIOCD_H
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
#include "common/singleton.h"
|
|
||||||
#include "sound/mixer.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Audio {
|
|
||||||
|
|
||||||
|
|
||||||
class AudioCDManager : public Common::Singleton<AudioCDManager> {
|
|
||||||
public:
|
|
||||||
struct Status {
|
|
||||||
bool playing;
|
|
||||||
int track;
|
|
||||||
int start;
|
|
||||||
int duration;
|
|
||||||
int numLoops;
|
|
||||||
int volume;
|
|
||||||
int balance;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start playback of the specified "CD" track. This method mimics
|
|
||||||
* the interface of OSystem::playCD (which it in fact may call, if an Audio CD is
|
|
||||||
* present), but also can play digital audio tracks in various formats.
|
|
||||||
*
|
|
||||||
* @param track the track to play.
|
|
||||||
* @param num_loops how often playback should be repeated (-1 = infinitely often).
|
|
||||||
* @param start_frame the frame at which playback should start (75 frames = 1 second).
|
|
||||||
* @param duration the number of frames to play (0: play until end)
|
|
||||||
* @param only_emulate if true, don't try to play from a real CD
|
|
||||||
*/
|
|
||||||
void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false);
|
|
||||||
void stop();
|
|
||||||
bool isPlaying() const;
|
|
||||||
|
|
||||||
void setVolume(byte volume);
|
|
||||||
void setBalance(int8 balance);
|
|
||||||
|
|
||||||
void updateCD();
|
|
||||||
|
|
||||||
Status getStatus() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
|
||||||
AudioCDManager();
|
|
||||||
|
|
||||||
// FIXME: It might make sense to stop CD playback, when the AudioCDManager singleton
|
|
||||||
// is destroyed. Currently we can not do this, since in worst case the OSystem and
|
|
||||||
// along with it the Mixer will be destroyed before the AudioCDManager, thus
|
|
||||||
// leading to invalid memory access. If we can fix up the code to destroy the
|
|
||||||
// AudioCDManager before OSystem in *all* cases, that is including calling
|
|
||||||
// OSystem::quit, we might be able to implement it via a simple "stop()"
|
|
||||||
// call in a custom destructor of AudioCDManager.
|
|
||||||
|
|
||||||
/* used for emulated CD music */
|
|
||||||
SoundHandle _handle;
|
|
||||||
bool _emulating;
|
|
||||||
|
|
||||||
Status _cd;
|
|
||||||
Mixer *_mixer;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Shortcut for accessing the audio CD manager. */
|
|
||||||
#define AudioCD Audio::AudioCDManager::instance()
|
|
||||||
|
|
||||||
} // End of namespace Audio
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
|
#define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
|
||||||
#include <FLAC/export.h>
|
#include <FLAC/export.h>
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
|
|
||||||
#include <mad.h>
|
#include <mad.h>
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
|
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
|
|
||||||
#ifdef USE_TREMOR
|
#ifdef USE_TREMOR
|
||||||
#if defined(__GP32__) // custom libtremor locations
|
#if defined(__GP32__) // custom libtremor locations
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "common/mutex.h"
|
#include "common/mutex.h"
|
||||||
|
#include "common/noncopyable.h"
|
||||||
|
|
||||||
#include "sound/timestamp.h"
|
#include "sound/timestamp.h"
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ public:
|
||||||
* The main audio mixer handles mixing of an arbitrary number of
|
* The main audio mixer handles mixing of an arbitrary number of
|
||||||
* audio streams (in the form of AudioStream instances).
|
* audio streams (in the form of AudioStream instances).
|
||||||
*/
|
*/
|
||||||
class Mixer {
|
class Mixer : Common::NonCopyable {
|
||||||
public:
|
public:
|
||||||
enum SoundType {
|
enum SoundType {
|
||||||
kPlainSoundType = 0,
|
kPlainSoundType = 0,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
MODULE := sound
|
MODULE := sound
|
||||||
|
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
audiocd.o \
|
|
||||||
audiostream.o \
|
audiostream.o \
|
||||||
fmopl.o \
|
fmopl.o \
|
||||||
mididrv.o \
|
mididrv.o \
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sound/softsynth/fmtowns_pc98/towns_audio.h"
|
#include "sound/softsynth/fmtowns_pc98/towns_audio.h"
|
||||||
#include "sound/audiocd.h"
|
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1405,8 +1404,8 @@ void TownsAudioInterface::updateOutputVolume() {
|
||||||
int volume = (int)(((float)(maxVol * 255) / 63.0f));
|
int volume = (int)(((float)(maxVol * 255) / 63.0f));
|
||||||
int balance = maxVol ? (int)( ( ((int)_outputLevel[13] - _outputLevel[12]) * 127) / (float)maxVol) : 0;
|
int balance = maxVol ? (int)( ( ((int)_outputLevel[13] - _outputLevel[12]) * 127) / (float)maxVol) : 0;
|
||||||
|
|
||||||
AudioCD.setVolume(volume);
|
g_system->getAudioCDManager()->setVolume(volume);
|
||||||
AudioCD.setBalance(balance);
|
g_system->getAudioCDManager()->setBalance(balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8 TownsAudioInterface::_chanFlags[] = {
|
const uint8 TownsAudioInterface::_chanFlags[] = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue