Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding DefineSound and StartSound tags.
- Loading branch information
Sean Fujiwara
committed
Sep 11, 2013
1 parent
e72f660
commit 6f6a859
Showing
8 changed files
with
220 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
SWFWireDecompiler/src/com/swfwire/decompiler/data/swf/enums/SoundFormat.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.swfwire.decompiler.data.swf.enums | ||
{ | ||
public class SoundFormat | ||
{ | ||
public static const UNCOMPRESSED:String = 'uncompressed'; | ||
public static const ADPCM:String = 'adpcm'; | ||
public static const MP3:String = 'mp3'; | ||
public static const UNCOMPRESSED_LITTLE_ENDIAN:String = 'uncompressedLittleEndian'; | ||
public static const NELLYMOSER:String = 'nellymoser'; | ||
public static const SPEEX:String = 'speex'; | ||
|
||
public function IdFromString(string:String):int | ||
{ | ||
var result:int = -1; | ||
switch(string) | ||
{ | ||
case UNCOMPRESSED: | ||
result = 0; | ||
break; | ||
case ADPCM: | ||
result = 1; | ||
break; | ||
case MP3: | ||
result = 2; | ||
break; | ||
case UNCOMPRESSED_LITTLE_ENDIAN: | ||
result = 3; | ||
break; | ||
case NELLYMOSER: | ||
result = 4; | ||
break; | ||
case SPEEX: | ||
result = 11; | ||
break; | ||
} | ||
return result; | ||
} | ||
|
||
public function stringFromId(id:uint):String | ||
{ | ||
var result:String = null; | ||
switch(id) | ||
{ | ||
case 0: | ||
result = UNCOMPRESSED; | ||
break; | ||
case 1: | ||
result = ADPCM; | ||
break; | ||
case 2: | ||
result = MP3; | ||
break; | ||
case 3: | ||
result = UNCOMPRESSED_LITTLE_ENDIAN; | ||
break; | ||
case 4: | ||
case 5: | ||
case 6: | ||
result = NELLYMOSER; | ||
break; | ||
case 11: | ||
result = SPEEX; | ||
break; | ||
} | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
SWFWireDecompiler/src/com/swfwire/decompiler/data/swf/records/SoundEnvelopeRecord.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.swfwire.decompiler.data.swf.records | ||
{ | ||
public class SoundEnvelopeRecord | ||
{ | ||
public var pos44:uint; | ||
public var leftLevel:uint; | ||
public var rightLevel:uint; | ||
|
||
public function SoundEnvelopeRecord(pos44:uint = 0, leftLevel:uint = 0, rightLevel:uint = 0) | ||
{ | ||
this.pos44 = pos44; | ||
this.leftLevel = leftLevel; | ||
this.rightLevel = rightLevel; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
SWFWireDecompiler/src/com/swfwire/decompiler/data/swf/records/SoundInfoRecord.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.swfwire.decompiler.data.swf.records | ||
{ | ||
public class SoundInfoRecord | ||
{ | ||
public var reserved:uint; | ||
public var syncStop:Boolean; | ||
public var syncNoMultiple:Boolean; | ||
public var hasEnvelope:Boolean; | ||
public var hasLoops:Boolean; | ||
public var hasOutPoint:Boolean; | ||
public var hasInPoint:Boolean; | ||
public var inPoint:uint; | ||
public var outPoint:uint; | ||
public var loopCount:uint; | ||
public var envPoints:uint; | ||
public var envelopeRecords:Vector.<SoundEnvelopeRecord>; | ||
|
||
public function SoundInfoRecord(reserved:uint = 0, syncStop:Boolean = false, syncNoMultiple:Boolean = false, hasEnvelope:Boolean = false, hasLoops:Boolean = false, hasOutPoint:Boolean = false, hasInPoint:Boolean = false, inPoint:uint = 0, outPoint:uint = 0, loopCount:uint = 0, envPoints:uint = 0, envelopeRecords:Vector.<SoundEnvelopeRecord> = null) | ||
{ | ||
if(envelopeRecords == null) | ||
{ | ||
envelopeRecords = new Vector.<SoundEnvelopeRecord>; | ||
} | ||
|
||
this.reserved = reserved; | ||
this.syncStop = syncStop; | ||
this.syncNoMultiple = syncNoMultiple; | ||
this.hasEnvelope = hasEnvelope; | ||
this.hasLoops = hasLoops; | ||
this.hasOutPoint = hasOutPoint; | ||
this.hasInPoint = hasInPoint; | ||
this.inPoint = inPoint; | ||
this.outPoint = outPoint; | ||
this.loopCount = loopCount; | ||
this.envPoints = envPoints; | ||
this.envelopeRecords = envelopeRecords; | ||
} | ||
} | ||
} |
26 changes: 24 additions & 2 deletions
26
SWFWireDecompiler/src/com/swfwire/decompiler/data/swf/tags/DefineSoundTag.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
package com.swfwire.decompiler.data.swf.tags | ||
{ | ||
import com.swfwire.decompiler.data.swf.SWF; | ||
import com.swfwire.decompiler.SWFByteArray; | ||
import flash.utils.ByteArray; | ||
|
||
public class DefineSoundTag extends SWFTag | ||
{ | ||
public var soundId:uint; | ||
public var soundFormat:uint; | ||
public var soundRate:uint; | ||
public var soundSize:uint; | ||
public var soundType:uint; | ||
public var soundSampleCount:uint; | ||
public var soundData:ByteArray; | ||
|
||
public function DefineSoundTag(soundId:uint = 0, soundFormat:uint = 0, soundRate:uint = 0, soundSize:uint = 0, soundType:uint = 0, soundSampleCount:uint = 0, soundData:ByteArray = null) | ||
{ | ||
if(soundData == null) | ||
{ | ||
soundData = new ByteArray(); | ||
} | ||
|
||
this.soundId = soundId; | ||
this.soundFormat = soundFormat; | ||
this.soundRate = soundRate; | ||
this.soundSize = soundSize; | ||
this.soundType = soundType; | ||
this.soundSampleCount = soundSampleCount; | ||
this.soundData = soundData; | ||
} | ||
} | ||
} |
13 changes: 10 additions & 3 deletions
13
SWFWireDecompiler/src/com/swfwire/decompiler/data/swf/tags/StartSoundTag.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
package com.swfwire.decompiler.data.swf.tags | ||
{ | ||
import com.swfwire.decompiler.data.swf.SWF; | ||
import com.swfwire.decompiler.SWFByteArray; | ||
|
||
import com.swfwire.decompiler.data.swf.records.SoundInfoRecord; | ||
|
||
public class StartSoundTag extends SWFTag | ||
{ | ||
public var soundId:uint; | ||
public var soundInfo:SoundInfoRecord; | ||
|
||
public function StartSoundTag(soundId:uint = 0, soundInfo:SoundInfoRecord = null) | ||
{ | ||
this.soundId = soundId; | ||
this.soundInfo = soundInfo; | ||
} | ||
} | ||
} |