svn-id: r25910
This commit is contained in:
Max Horn 2007-02-28 15:04:02 +00:00
parent 8c8abca6f8
commit 5e2fe7dc7f
4 changed files with 20 additions and 53 deletions

View File

@ -73,9 +73,6 @@ private:
bool _keepSize;
protected:
void handleStrk(Chunk &c);
void handleSmrk(Chunk &c);
void handleShdr(Chunk &c);
bool handleSubTags(int32 &offset);
public:
@ -106,9 +103,6 @@ private:
protected:
void decode();
bool handleMap(Chunk &c);
bool handleFormat(Chunk &c);
bool handleRegion(Chunk &c);
bool handleStop(Chunk &c);
bool handleSubTags(int32 &offset);
public:

View File

@ -101,43 +101,30 @@ bool ImuseChannel::appendData(Chunk &b, int32 size) {
return true;
}
bool ImuseChannel::handleFormat(Chunk &src) {
if (src.size() != 20) error("invalid size for FRMT Chunk");
/*uint32 imuse_start =*/ src.readUint32BE();
src.skip(4);
_bitsize = src.readUint32BE();
_rate = src.readUint32BE();
_channels = src.readUint32BE();
assert(_channels == 1 || _channels == 2);
return true;
}
bool ImuseChannel::handleRegion(Chunk &src) {
if (src.size() != 8)
error("invalid size for REGN Chunk");
return true;
}
bool ImuseChannel::handleStop(Chunk &src) {
if (src.size() != 4)
error("invalid size for STOP Chunk");
return true;
}
bool ImuseChannel::handleMap(Chunk &map) {
while (!map.eos()) {
Chunk *sub = map.subBlock();
switch (sub->getType()) {
case MKID_BE('FRMT'):
handleFormat(*sub);
if (sub->size() != 20)
error("invalid size for FRMT Chunk");
/*uint32 imuse_start =*/ sub->readUint32BE();
sub->skip(4);
_bitsize = sub->readUint32BE();
_rate = sub->readUint32BE();
_channels = sub->readUint32BE();
assert(_channels == 1 || _channels == 2);
break;
case MKID_BE('TEXT'):
// Ignore this
break;
case MKID_BE('REGN'):
handleRegion(*sub);
if (sub->size() != 8)
error("invalid size for REGN Chunk");
break;
case MKID_BE('STOP'):
handleStop(*sub);
if (sub->size() != 4)
error("invalid size for STOP Chunk");
break;
default:
error("Unknown iMUS subChunk found : %s, %d", tag2str(sub->getType()), sub->size());

View File

@ -40,23 +40,6 @@ bool SaudChannel::isTerminated() const {
return (_markReached && _dataSize == 0 && _sbuffer == 0);
}
void SaudChannel::handleStrk(Chunk &b) {
int32 size = b.size();
if (size != 14 && size != 10) {
error("STRK has an invalid size : %d", size);
}
}
void SaudChannel::handleSmrk(Chunk &b) {
_markReached = true;
}
void SaudChannel::handleShdr(Chunk &b) {
int32 size = b.size();
if (size != 4)
error("SHDR has an invalid size : %d", size);
}
bool SaudChannel::handleSubTags(int32 &offset) {
if (_tbufferSize - offset >= 8) {
Chunk::type type = READ_BE_UINT32(_tbuffer + offset);
@ -68,7 +51,9 @@ bool SaudChannel::handleSubTags(int32 &offset) {
_inData = false;
if (available_size >= (size + 8)) {
MemoryChunk c((byte *)_tbuffer + offset);
handleStrk(c);
if (c.size() != 14 && c.size() != 10) {
error("STRK has an invalid size : %d", c.size());
}
} else
return false;
break;
@ -76,7 +61,7 @@ bool SaudChannel::handleSubTags(int32 &offset) {
_inData = false;
if (available_size >= (size + 8)) {
MemoryChunk c((byte *)_tbuffer + offset);
handleSmrk(c);
_markReached = true;
} else
return false;
break;
@ -84,7 +69,8 @@ bool SaudChannel::handleSubTags(int32 &offset) {
_inData = false;
if (available_size >= (size + 8)) {
MemoryChunk c((byte *)_tbuffer + offset);
handleShdr(c);
if (c.size() != 4)
error("SHDR has an invalid size : %d", c.size());
} else
return false;
break;

View File

@ -366,7 +366,7 @@ void SmushPlayer::handleSoundBuffer(int32 track_id, int32 index, int32 max_frame
_smixer->addChannel(c);
}
if (_middleAudio || (index == 0)) {
if (_middleAudio || index == 0) {
c->setParameters(max_frames, flags, vol, pan, index);
} else {
c->checkParameters(index, max_frames, flags, vol, pan);