aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2011-04-12 16:06:33 +0200
committerMax Horn2011-04-12 16:06:39 +0200
commitf5ff6e9e181c984f62000bd4dab4ac0c61dc52b4 (patch)
treeb2e35839aa40df4b939067f3b1d3ebf0eb99bd19 /engines
parente2adf5babcc7c04368fbb5c9fb8df170bbfdd7d0 (diff)
downloadscummvm-rg350-f5ff6e9e181c984f62000bd4dab4ac0c61dc52b4.tar.gz
scummvm-rg350-f5ff6e9e181c984f62000bd4dab4ac0c61dc52b4.tar.bz2
scummvm-rg350-f5ff6e9e181c984f62000bd4dab4ac0c61dc52b4.zip
TINSEL: cleanup
Diffstat (limited to 'engines')
-rw-r--r--engines/tinsel/music.cpp18
-rw-r--r--engines/tinsel/music.h2
2 files changed, 8 insertions, 12 deletions
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index dd5ca27772..49eacce9ae 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -465,7 +465,6 @@ PCMMusicPlayer::PCMMusicPlayer() {
_silenceSamples = 0;
_curChunk = 0;
- _fileName = 0;
_state = S_IDLE;
_mState = S_IDLE;
_scriptNum = -1;
@@ -488,15 +487,13 @@ PCMMusicPlayer::PCMMusicPlayer() {
PCMMusicPlayer::~PCMMusicPlayer() {
_vm->_mixer->stopHandle(_handle);
-
- delete[] _fileName;
}
void PCMMusicPlayer::startPlay(int id) {
- if (!_fileName)
+ if (_filename.empty())
return;
- debugC(DEBUG_DETAILED, kTinselDebugMusic, "Playing PCM music %s, index %d", _fileName, id);
+ debugC(DEBUG_DETAILED, kTinselDebugMusic, "Playing PCM music %s, index %d", _filename.c_str(), id);
Common::StackLock slock(_mutex);
@@ -611,8 +608,7 @@ void PCMMusicPlayer::setMusicSceneDetails(SCNHANDLE hScript,
_hScript = hScript;
_hSegment = hSegment;
- _fileName = new char[strlen(fileName) + 1];
- strcpy(_fileName, fileName);
+ _filename = fileName;
// Start scene with music not dimmed
_dimmed = false;
@@ -768,19 +764,19 @@ bool PCMMusicPlayer::getNextChunk() {
sampleLength = FROM_LE_32(musicSegments[snum].sampleLength);
sampleCLength = (((sampleLength + 63) & ~63)*33)/64;
- if (!file.open(_fileName))
- error(CANNOT_FIND_FILE, _fileName);
+ if (!file.open(_filename))
+ error(CANNOT_FIND_FILE, _filename.c_str());
file.seek(sampleOffset);
if (file.eos() || file.err() || (uint32)file.pos() != sampleOffset)
- error(FILE_IS_CORRUPT, _fileName);
+ error(FILE_IS_CORRUPT, _filename.c_str());
buffer = (byte *) malloc(sampleCLength);
assert(buffer);
// read all of the sample
if (file.read(buffer, sampleCLength) != sampleCLength)
- error(FILE_IS_CORRUPT, _fileName);
+ error(FILE_IS_CORRUPT, _filename.c_str());
debugC(DEBUG_DETAILED, kTinselDebugMusic, "Creating ADPCM music chunk with size %d, "
"offset %d (script %d.%d)", sampleCLength, sampleOffset,
diff --git a/engines/tinsel/music.h b/engines/tinsel/music.h
index af089caf24..9003e60078 100644
--- a/engines/tinsel/music.h
+++ b/engines/tinsel/music.h
@@ -148,7 +148,7 @@ protected:
int32 _scriptIndex;
SCNHANDLE _hScript;
SCNHANDLE _hSegment;
- char *_fileName;
+ Common::String _filename;
uint8 _volume;