diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tinsel/music.cpp | 18 | ||||
-rw-r--r-- | engines/tinsel/music.h | 2 |
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; |