aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2008-07-29 16:09:10 +0000
committerMax Horn2008-07-29 16:09:10 +0000
commit0be985ce833d03e4458bb4512d5bed377c13d9c7 (patch)
tree0306c88a96f5eba14268fb33cc3cb45a5c8ba51e /sound
parentc9051fcfbd9b1f227bf5bddd81aac478d139e358 (diff)
downloadscummvm-rg350-0be985ce833d03e4458bb4512d5bed377c13d9c7.tar.gz
scummvm-rg350-0be985ce833d03e4458bb4512d5bed377c13d9c7.tar.bz2
scummvm-rg350-0be985ce833d03e4458bb4512d5bed377c13d9c7.zip
Changed class File (and derived classes) to only support read-only access; added a new class DumpFile for writing
svn-id: r33412
Diffstat (limited to 'sound')
-rw-r--r--sound/softsynth/mt32.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 053df544b1..360ef4539d 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -80,37 +80,41 @@ public:
};
class MT32File : public MT32Emu::File {
- Common::File file;
+ Common::File _in;
+ Common::DumpFile _out;
public:
bool open(const char *filename, OpenMode mode) {
- Common::File::AccessMode accessMode = mode == OpenMode_read ? Common::File::kFileReadMode : Common::File::kFileWriteMode;
- return file.open(filename, accessMode);
+ if (mode == OpenMode_read)
+ return _in.open(filename);
+ else
+ return _out.open(filename);
}
void close() {
- return file.close();
+ _in.close();
+ _out.close();
}
size_t read(void *in, size_t size) {
- return file.read(in, size);
+ return _in.read(in, size);
}
bool readLine(char *in, size_t size) {
- return file.readLine(in, size) != NULL;
+ return _in.readLine(in, size) != NULL;
}
bool readBit8u(MT32Emu::Bit8u *in) {
- byte b = file.readByte();
- if (file.eof())
+ byte b = _in.readByte();
+ if (_in.eof())
return false;
*in = b;
return true;
}
size_t write(const void *in, size_t size) {
- return file.write(in, size);
+ return _out.write(in, size);
}
bool writeBit8u(MT32Emu::Bit8u out) {
- file.writeByte(out);
- return !file.ioFailed();
+ _out.writeByte(out);
+ return !_out.ioFailed();
}
bool isEOF() {
- return file.eof();
+ return _in.isOpen() ? _in.eof() : _out.eof();
}
};