[rom] Fix writing AUDI data
The length of the audio chunk was incorrect and did not include the format bytes. This was also the source of the "garbage four bytes" that were being chopped off before.
This commit is contained in:
parent
2b9bc6f09f
commit
6831274a25
|
|
@ -56,7 +56,9 @@ func (sb *StudyBox) rawBytes() ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = binary.Write(buffer, binary.LittleEndian, uint32(len(sb.Audio.Data)))
|
// This length is the full size of the chunk, including the format from the
|
||||||
|
// switch below.
|
||||||
|
err = binary.Write(buffer, binary.LittleEndian, uint32(len(sb.Audio.Data)+4))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +83,7 @@ func (sb *StudyBox) rawBytes() ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// For some reason there's 4 extra bytes. no idea why. chomp them off.
|
_, err = buffer.Write(sb.Audio.Data[0 : uint32(len(sb.Audio.Data))])
|
||||||
_, err = buffer.Write(sb.Audio.Data[0 : uint32(len(sb.Audio.Data))-4])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue