Fixed #1869 Replace references now replaces all references, not just PlaceObject

Fixed Handle StartSound tag as CharacterIdTag
This commit is contained in:
Jindra Petřík
2022-11-20 22:12:19 +01:00
parent 8a5433b49c
commit 61c5e6b5da
4 changed files with 37 additions and 14 deletions
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.SWFInputStream;
import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.tags.base.CharacterIdTag;
import com.jpexs.decompiler.flash.types.BasicType;
import com.jpexs.decompiler.flash.types.SOUNDINFO;
import com.jpexs.decompiler.flash.types.annotations.SWFType;
@@ -31,7 +32,7 @@ import java.io.IOException;
* @author JPEXS
*/
@SWFVersion(from = 1)
public class StartSoundTag extends Tag {
public class StartSoundTag extends Tag implements CharacterIdTag {
public static final int ID = 15;
@@ -80,5 +81,15 @@ public class StartSoundTag extends Tag {
public void getData(SWFOutputStream sos) throws IOException {
sos.writeUI16(soundId);
sos.writeSOUNDINFO(soundInfo);
}
@Override
public int getCharacterId() {
return soundId;
}
@Override
public void setCharacterId(int characterId) {
soundId = characterId;
}
}
@@ -227,10 +227,16 @@ public class SoundFormat {
int inPointBytes = inPoint * 2 /*16bit*/ * (stereo ? 2 : 1);
int outPointBytes = soundInfo.hasOutPoint ? outPoint * 2 /*16bit*/ * (stereo ? 2 : 1) : data.length;
for (int i = inPointBytes; i < outPointBytes; i += (stereo ? 4 : 2)) {
if (i + 1 >= data.length) {
break;
}
int left = ((data[i] & 0xff) + ((data[i + 1] & 0xff) << 8)) << 16 >> 16;
int right = left;
if (stereo) {
right = ((data[i + 2] & 0xff) + ((data[i + 3] & 0xff) << 8)) << 16 >> 16;
if (i + 3 >= data.length) {
break;
}
right = ((data[i + 2] & 0xff) + ((data[i + 3] & 0xff) << 8)) << 16 >> 16;
}
if (soundInfo.hasEnvelope) {