public void WriteSoundStoryboard(SoundInstance sound) { // <MediaTimeline Source="stevie.mp3" Storyboard.TargetName="stevieSound" BeginTime="0:0:1"/> xw.WriteStartElement("MediaTimeline"); xw.WriteStartAttribute("Source"); xw.WriteValue(sound.Path); xw.WriteEndAttribute(); xw.WriteStartAttribute("Storyboard.TargetName"); xw.WriteValue(VexObject.SoundPrefix + sound.DefinitionId); xw.WriteEndAttribute(); xw.WriteStartAttribute("BeginTime"); xw.WriteMilliseconds(sound.StartTime); xw.WriteEndAttribute(); xw.WriteEndElement(); }
//public abstract void WriteStoryboards(List<IInstance> instances, bool isRoot); //public abstract void WriteStoryboard(IDefinition s, Instance inst); //public abstract void WriteVisibility(Instance inst); public abstract void WriteSoundInstance(SoundInstance sound);
public override void WriteSoundInstance(SoundInstance sound) { // note: Silverlight doesn't support media element, // so starting sounds at certain times is not possible without code xw.WriteStartElement("MediaElement"); xw.WriteStartAttribute("Source"); xw.WriteValue(sound.Path); xw.WriteEndAttribute(); xw.WriteStartAttribute("Name"); xw.WriteValue(VexObject.SoundPrefix + sound.DefinitionId); xw.WriteEndAttribute(); xw.WriteEndElement(); }
public override void WriteSoundInstance(SoundInstance sound) { //<MediaElement Name="sndInst_0"/> xw.WriteStartElement("MediaElement"); xw.WriteStartAttribute("Name"); xw.WriteValue(VexObject.SoundPrefix + sound.DefinitionId); xw.WriteEndAttribute(); xw.WriteEndElement(); }
private void ParseStartSound(StartSoundTag tag) { //v.Definitions.Add(null); string path = soundPaths[tag.SoundId]; if (path != null) { uint curTime = (uint)((curFrame * (1 / swf.Header.FrameRate)) * 1000); SoundInstance snd = new SoundInstance(path, v.NextId()); snd.StartTime = curTime; this.curTimeline.AddInstance(snd); } else { this.curTimeline.AddInstance(null); } }
private void ParseSoundStreamHead(SoundStreamHeadTag tag) { if (tag.StreamSoundCompression == SoundCompressionType.Nellymoser) { Debug.WriteLine("Nellymoser Sound not supported"); Log.AppendLine( "Nellymoser Sound not supported" + " at frame " + this.curFrame + " in clip " + this.curTimeline.Name); return; } else if (tag.StreamSoundCompression == SoundCompressionType.ADPMC) { Debug.WriteLine("ADPMC Sound not supported"); Log.AppendLine( "ADPMC Sound not supported" + " at frame " + this.curFrame + " in clip " + this.curTimeline.Name); return; } // some swfs have soundStreamHeader, but no blocks if (swf.TimelineStream.Count > 0) { string ext = SoundStreamHeadTag.SoundExtentions[(int)tag.StreamSoundCompression]; string path = v.ResourceFolder + @"/" + VexObject.SoundPrefix + tag.SoundId + ext; WriteSoundToDisk(path, swf.TimelineStream); uint curTime = (uint)((curFrame * (1 / swf.Header.FrameRate)) * 1000); SoundInstance snd = new SoundInstance(path, v.NextId()); snd.StartTime = curTime; lastSoundDef = snd; this.curTimeline.AddInstance(snd); } }
private void ParseTag(ISwfTag tag) { switch (tag.TagType) { case TagType.FileAttributes: ParseFileAttributesTag((FileAttributesTag)tag); break; case TagType.BackgroundColor: ParseBackgroundColor((BackgroundColorTag)tag); break; case TagType.End: // nothing to do break; case TagType.DefineSprite: ParseDefineSpriteTag((DefineSpriteTag)tag); break; case TagType.PlaceObject: ParsePlaceObjectTag((PlaceObjectTag)tag); break; case TagType.PlaceObject2: ParsePlaceObject2Tag((PlaceObject2Tag)tag); break; case TagType.PlaceObject3: ParsePlaceObject3Tag((PlaceObject3Tag)tag); break; case TagType.RemoveObject: ParseRemoveObjectTag((RemoveObjectTag)tag); break; case TagType.RemoveObject2: ParseRemoveObject2Tag((RemoveObject2Tag)tag); break; case TagType.ShowFrame: curFrame += 1; break; case TagType.FrameLabel: uint curTime = (uint)((curFrame * (1 / swf.Header.FrameRate)) * 1000); curTimeline.Labels.Add(new Label(curTime, ((FrameLabelTag)tag).TargetName)); break; case TagType.DefineShape: ParseDefineShapeTag((DefineShapeTag)tag); break; case TagType.DefineShape2: ParseDefineShape2Tag((DefineShape2Tag)tag); break; case TagType.DefineShape3: ParseDefineShape3Tag((DefineShape3Tag)tag); break; case TagType.DefineShape4: ParseDefineShape4Tag((DefineShape4Tag)tag); break; case TagType.JPEGTables: // not retained break; case TagType.DefineBits: ParseDefineBits((DefineBitsTag)tag); break; case TagType.DefineBitsJPEG2: // v.NextId(); ParseDefineBits((DefineBitsTag)tag); //ParseDefineBitsJPEG2((DefineBitsJPEG2Tag)tag); break; case TagType.DefineBitsJPEG3: //v.NextId(); ParseDefineBits((DefineBitsTag)tag); //ParseDefineBitsJPEG3((DefineBitsJPEG3Tag)tag); break; case TagType.DefineBitsLossless: ParseDefineBitsLossless((DefineBitsLosslessTag)tag); break; case TagType.DefineBitsLossless2: ParseDefineBitsLossless((DefineBitsLosslessTag)tag); break; case TagType.DefineSound: ParseDefineSound((DefineSoundTag)tag); break; case TagType.StartSound: ParseStartSound((StartSoundTag)tag); break; case TagType.SoundStreamHead: ParseSoundStreamHead((SoundStreamHeadTag)tag); break; case TagType.SoundStreamBlock: if (lastSoundDef != null) { lastSoundDef.StartTime = (uint)((curFrame * (1 / swf.Header.FrameRate)) * 1000); lastSoundDef = null; } break; case TagType.DefineFontInfo: break; case TagType.DefineFontInfo2: break; case TagType.DefineFont: //temp v.NextId(); break; case TagType.DefineFont2: //temp v.NextId(); break; case TagType.DefineFont3: //temp v.NextId(); break; case TagType.DefineFontAlignZones: break; case TagType.CSMTextSettings: break; case TagType.DefineText: ParseDefineText((DefineTextTag)tag); break; case TagType.DefineText2: ParseDefineText((DefineTextTag)tag); break; case TagType.DefineEditText: ParseEditText((DefineEditTextTag)tag); break; case TagType.ExportAssets: ParseExportAssets((ExportAssetsTag)tag); break; case TagType.UnsupportedDefinition: v.NextId(); Log.AppendLine( ((UnsupportedDefinitionTag)tag).Message + " at frame " + this.curFrame + " in clip " + this.curTimeline.Name); break; //case TagType.DefineButtonCxform: // ParseDefineButtonCxform((DefineButtonCxformTag)tag); // break; //case TagType.Protect: // ParseProtect((ProtectTag)tag); // break; //case TagType.PathsArePostScript: // ParsePathsArePostScript((PathsArePostScriptTag)tag); // break; //case TagType.SyncFrame: // ParseSyncFrame((SyncFrameTag)tag); // break; //case TagType.FreeAll: // ParseFreeAll((FreeAllTag)tag); // break; //case TagType.DefineText2: // ParseDefineText2((DefineText2Tag)tag); // break; //case TagType.DefineButton2: // ParseDefineButton2((DefineButton2Tag)tag); // break; //case TagType.DefineSprite: // ParseDefineSprite((DefineSpriteTag)tag); // break; //case TagType.NameCharacter: // ParseNameCharacter((NameCharacterTag)tag); // break; //case TagType.SerialNumber: // ParseSerialNumber((SerialNumberTag)tag); // break; //case TagType.DefineTextFormat: // ParseDefineTextFormat((DefineTextFormatTag)tag); // break; //case TagType.SoundStreamHead2: // ParseSoundStreamHead2((SoundStreamHead2Tag)tag); // break; //case TagType.DefineMorphShape: // ParseDefineMorphShape((DefineMorphShapeTag)tag); // break; //case TagType.FrameTag: // ParseFrameTag((FrameTagTag)tag); // break; //case TagType.DefineFont2: // ParseDefineFont2((DefineFont2Tag)tag); // break; //case TagType.GenCommand: // ParseGenCommand((GenCommandTag)tag); // break; //case TagType.DefineCommandObj: // ParseDefineCommandObj((DefineCommandObjTag)tag); // break; //case TagType.CharacterSet: // ParseCharacterSet((CharacterSetTag)tag); // break; //case TagType.FontRef: // ParseFontRef((FontRefTag)tag); // break; //case TagType.ImportAssets: // ParseImportAssets((ImportAssetsTag)tag); // break; //case TagType.EnableDebugger: // ParseEnableDebugger((EnableDebuggerTag)tag); // break; //case TagType.EnableDebugger2: // ParseEnableDebugger2((EnableDebugger2Tag)tag); // break; //case TagType.ScriptLimits: // ParseScriptLimits((ScriptLimitsTag)tag); // break; //case TagType.SetTabIndex: // ParseSetTabIndex((SetTabIndexTag)tag); // break; //case TagType.DefineEditText: // ParseDefineEditText((DefineEditTextTag)tag); // break; //case TagType.DefineVideo: // ParseDefineVideo((DefineVideoTag)tag); // break; //case TagType.FreeCharacter: // ParseFreeCharacter((FreeCharacterTag)tag); // break; //case TagType.PlaceObject: // ParsePlaceObject((PlaceObjectTag)tag); // break; //case TagType.RemoveObject: // ParseRemoveObject((RemoveObjectTag)tag); // break; //case TagType.DefineButton: // ParseDefineButton((DefineButtonTag)tag); // break; //case TagType.DefineFont: // ParseDefineFont((DefineFontTag)tag); // break; //case TagType.DefineText: // ParseDefineText((DefineTextTag)tag); // break; //case TagType.DoAction: // ParseDoAction((DoActionTag)tag); // break; //case TagType.DefineFontInfo: // ParseDefineFontInfo((DefineFontInfoTag)tag); // break; //case TagType.DefineSound: // ParseDefineSound((DefineSoundTag)tag); // break; //case TagType.StartSound: // ParseStartSound((StartSoundTag)tag); // break; //case TagType.DefineButtonSound: // ParseDefineButtonSound((DefineButtonSoundTag)tag); // break; //case TagType.SoundStreamHead: // ParseSoundStreamHead((SoundStreamHeadTag)tag); // break; } }