home *** CD-ROM | disk | FTP | other *** search
/ Beginning Direct3D Game Programming / Direct3D.iso / directx / dxf / samples / multimedia / vbsamples / directshow / editing / slideshowvb / frmmain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2000-10-17  |  58.4 KB  |  1,243 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmMain 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "SlideshowVB"
  6.    ClientHeight    =   6480
  7.    ClientLeft      =   60
  8.    ClientTop       =   345
  9.    ClientWidth     =   9045
  10.    Icon            =   "frmMain.frx":0000
  11.    LinkTopic       =   "frmMain"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   6480
  14.    ScaleWidth      =   9045
  15.    Visible         =   0   'False
  16.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  17.       DragMode        =   1  'Automatic
  18.       Height          =   1965
  19.       Index           =   0
  20.       Left            =   60
  21.       TabIndex        =   12
  22.       TabStop         =   0   'False
  23.       ToolTipText     =   "Source Clip"
  24.       Top             =   75
  25.       Width           =   2190
  26.       _ExtentX        =   3863
  27.       _ExtentY        =   3466
  28.       BorderColor     =   4210752
  29.       BorderSize      =   3
  30.    End
  31.    Begin VB.Frame fraOptions 
  32.       Height          =   1890
  33.       Left            =   60
  34.       TabIndex        =   6
  35.       Top             =   4050
  36.       Width           =   4420
  37.       Begin VB.TextBox txtMaxMediaLength 
  38.          Height          =   375
  39.          Left            =   150
  40.          OLEDropMode     =   1  'Manual
  41.          TabIndex        =   0
  42.          ToolTipText     =   "Maximum playback time per source clip."
  43.          Top             =   460
  44.          Width           =   4150
  45.       End
  46.       Begin VB.ComboBox cmbTransitions 
  47.          Height          =   315
  48.          Left            =   150
  49.          TabIndex        =   1
  50.          ToolTipText     =   "Default Transition"
  51.          Top             =   1440
  52.          Width           =   4150
  53.       End
  54.       Begin VB.Label lblTransitionDescription 
  55.          Caption         =   "Select a transition to use.  If the transition is not installed on your system, the default transition will be used."
  56.          Height          =   405
  57.          Index           =   0
  58.          Left            =   135
  59.          TabIndex        =   7
  60.          Top             =   915
  61.          Width           =   4155
  62.       End
  63.       Begin VB.Label lbltxtMaxMediaLength 
  64.          Caption         =   "Set the maximum time for each clip in the slideshow:"
  65.          Height          =   255
  66.          Index           =   0
  67.          Left            =   140
  68.          TabIndex        =   8
  69.          Top             =   225
  70.          Width           =   4155
  71.       End
  72.    End
  73.    Begin VB.Frame fraCommandFixture 
  74.       Height          =   1890
  75.       Left            =   4560
  76.       TabIndex        =   9
  77.       Top             =   4050
  78.       Width           =   4420
  79.       Begin MSComctlLib.ProgressBar ctrlProgress 
  80.          Height          =   405
  81.          Left            =   140
  82.          TabIndex        =   10
  83.          ToolTipText     =   "Current Progress"
  84.          Top             =   1350
  85.          Visible         =   0   'False
  86.          Width           =   4140
  87.          _ExtentX        =   7303
  88.          _ExtentY        =   714
  89.          _Version        =   393216
  90.          Appearance      =   1
  91.       End
  92.       Begin VB.Label lblInstructions 
  93.          Caption         =   "This interface supports drag-and-drop editing.  Drag your media files into the poster frames to preview, then select a transition."
  94.          BeginProperty Font 
  95.             Name            =   "Comic Sans MS"
  96.             Size            =   9.75
  97.             Charset         =   0
  98.             Weight          =   400
  99.             Underline       =   0   'False
  100.             Italic          =   0   'False
  101.             Strikethrough   =   0   'False
  102.          EndProperty
  103.          Height          =   990
  104.          Left            =   150
  105.          TabIndex        =   11
  106.          ToolTipText     =   "Note: This Interface allows drag-and-drop editing.  Drag your video files into the poster frames to preview."
  107.          Top             =   225
  108.          Width           =   4140
  109.       End
  110.    End
  111.    Begin VB.CommandButton cmdWriteXTL 
  112.       Caption         =   "Write &XTL"
  113.       Height          =   350
  114.       Left            =   5100
  115.       TabIndex        =   3
  116.       ToolTipText     =   "Export using XTL Format"
  117.       Top             =   6075
  118.       Width           =   1215
  119.    End
  120.    Begin VB.CommandButton cmdWriteAVI 
  121.       Caption         =   "&Write AVI"
  122.       Height          =   350
  123.       Left            =   6450
  124.       TabIndex        =   4
  125.       ToolTipText     =   "Export using AVI Format"
  126.       Top             =   6075
  127.       Width           =   1215
  128.    End
  129.    Begin VB.CommandButton cmdPlay 
  130.       Caption         =   "&Play"
  131.       Height          =   350
  132.       Left            =   3750
  133.       TabIndex        =   2
  134.       ToolTipText     =   "Play"
  135.       Top             =   6075
  136.       Width           =   1215
  137.    End
  138.    Begin VB.CommandButton cmdExit 
  139.       Caption         =   "&Exit"
  140.       Default         =   -1  'True
  141.       Height          =   350
  142.       Left            =   7785
  143.       TabIndex        =   5
  144.       ToolTipText     =   "Exit"
  145.       Top             =   6075
  146.       Width           =   1215
  147.    End
  148.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  149.       DragMode        =   1  'Automatic
  150.       Height          =   1965
  151.       Index           =   1
  152.       Left            =   2310
  153.       TabIndex        =   13
  154.       TabStop         =   0   'False
  155.       ToolTipText     =   "Source Clip"
  156.       Top             =   75
  157.       Width           =   2190
  158.       _ExtentX        =   3863
  159.       _ExtentY        =   3466
  160.       BorderColor     =   4210752
  161.       BorderSize      =   3
  162.    End
  163.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  164.       DragMode        =   1  'Automatic
  165.       Height          =   1965
  166.       Index           =   2
  167.       Left            =   4560
  168.       TabIndex        =   14
  169.       TabStop         =   0   'False
  170.       ToolTipText     =   "Source Clip"
  171.       Top             =   75
  172.       Width           =   2190
  173.       _ExtentX        =   3863
  174.       _ExtentY        =   3466
  175.       BorderColor     =   4210752
  176.       BorderSize      =   3
  177.    End
  178.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  179.       DragMode        =   1  'Automatic
  180.       Height          =   1965
  181.       Index           =   3
  182.       Left            =   6810
  183.       TabIndex        =   15
  184.       TabStop         =   0   'False
  185.       ToolTipText     =   "Source Clip"
  186.       Top             =   75
  187.       Width           =   2190
  188.       _ExtentX        =   3863
  189.       _ExtentY        =   3466
  190.       BorderColor     =   4210752
  191.       BorderSize      =   3
  192.    End
  193.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  194.       DragMode        =   1  'Automatic
  195.       Height          =   1965
  196.       Index           =   4
  197.       Left            =   60
  198.       TabIndex        =   16
  199.       TabStop         =   0   'False
  200.       ToolTipText     =   "Source Clip"
  201.       Top             =   2100
  202.       Width           =   2190
  203.       _ExtentX        =   3863
  204.       _ExtentY        =   3466
  205.       BorderColor     =   4210752
  206.       BorderSize      =   3
  207.    End
  208.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  209.       DragMode        =   1  'Automatic
  210.       Height          =   1965
  211.       Index           =   5
  212.       Left            =   2310
  213.       TabIndex        =   17
  214.       TabStop         =   0   'False
  215.       ToolTipText     =   "Source Clip"
  216.       Top             =   2100
  217.       Width           =   2190
  218.       _ExtentX        =   3863
  219.       _ExtentY        =   3466
  220.       BorderColor     =   4210752
  221.       BorderSize      =   3
  222.    End
  223.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  224.       DragMode        =   1  'Automatic
  225.       Height          =   1965
  226.       Index           =   6
  227.       Left            =   4560
  228.       TabIndex        =   18
  229.       TabStop         =   0   'False
  230.       ToolTipText     =   "Source Clip"
  231.       Top             =   2100
  232.       Width           =   2190
  233.       _ExtentX        =   3863
  234.       _ExtentY        =   3466
  235.       BorderColor     =   4210752
  236.       BorderSize      =   3
  237.    End
  238.    Begin SlideshowVB.SourceClip ctrlSourceClip 
  239.       DragMode        =   1  'Automatic
  240.       Height          =   1965
  241.       Index           =   7
  242.       Left            =   6810
  243.       TabIndex        =   19
  244.       TabStop         =   0   'False
  245.       ToolTipText     =   "Source Clip"
  246.       Top             =   2100
  247.       Width           =   2190
  248.       _ExtentX        =   3863
  249.       _ExtentY        =   3466
  250.       BorderColor     =   4210752
  251.       BorderSize      =   3
  252.    End
  253. Attribute VB_Name = "frmMain"
  254. Attribute VB_GlobalNameSpace = False
  255. Attribute VB_Creatable = False
  256. Attribute VB_PredeclaredId = True
  257. Attribute VB_Exposed = False
  258. '*******************************************************************************
  259. '*       This is a part of the Microsoft DXSDK Code Samples.
  260. '*       Copyright (C) 1999-2000 Microsoft Corporation.
  261. '*       All rights reserved.
  262. '*       This source code is only intended as a supplement to
  263. '*       Microsoft Development Tools and/or SDK documentation.
  264. '*       See these sources for detailed information regarding the
  265. '*       Microsoft samples programs.
  266. '*******************************************************************************
  267. Option Explicit
  268. Option Base 0
  269. Option Compare Text
  270. 'enable/disable clipsource dragdrop operations
  271. Private m_boolEnableDragDrop As Boolean
  272. 'default/highlight border color on clip controls
  273. Private Const HIGHLIGHT_CLIPBORDERCOLOR As Long = vbBlue
  274. Private Const DEFAULT_CLIPBORDERCOLOR As Long = &H404040
  275. 'temporary filename for writing out poster frames
  276. Private Const TEMPORARY_XTLFILENAME As String = "SlideshowVB.xtl"
  277. 'maximum preview per clip in the slideshow presentation, in seconds
  278. Private m_nMaximumClipLength As Long
  279. ' **************************************************************************************************************************************
  280. ' * PRIVATE INTERFACE- FORM EVENT HANDLERS
  281.             ' ******************************************************************************************************************************
  282.             ' * procedure name: Form_Initialize
  283.             ' * procedure description:  Occurs when an application creates an instance of a Form, MDIForm, or class.
  284.             ' *
  285.             ' ******************************************************************************************************************************
  286.             Private Sub Form_Initialize()
  287.             On Local Error GoTo ErrLine
  288.             
  289.             'instantiate global data
  290.             Set gbl_objTimeline = New AMTimeline
  291.             Set gbl_objRenderEngine = New RenderEngine
  292.             Set gbl_objMediaControl = New FilgraphManager
  293.             Exit Sub
  294.             
  295. ErrLine:
  296.             Err.Clear
  297.             Exit Sub
  298.             End Sub
  299.          
  300.          
  301.             ' ******************************************************************************************************************************
  302.             ' * procedure name: Form_Load
  303.             ' * procedure description:  Occurs when a form is loaded.
  304.             ' *
  305.             ' ******************************************************************************************************************************
  306.             Private Sub Form_Load()
  307.             On Local Error GoTo ErrLine
  308.             
  309.             'enable/disable application
  310.             Call AppEnable(False, True, True)
  311.             
  312.             'assign default value(s)
  313.             m_nMaximumClipLength = 8
  314.             
  315.             'setup default control(s)
  316.             txtMaxMediaLength.Text = 8
  317.             Call ViewTransitionFriendlyNamesDirect(cmbTransitions)
  318.             
  319.             'assign the default transition
  320.             If TransitionCLSIDToFriendlyName(gbl_objTimeline.GetDefaultTransitionB) <> vbNullString Then _
  321.                cmbTransitions.Text = TransitionCLSIDToFriendlyName(gbl_objTimeline.GetDefaultTransitionB)
  322.             Exit Sub
  323.             
  324. ErrLine:
  325.             Err.Clear
  326.             Exit Sub
  327.             End Sub
  328.             
  329.             
  330.             ' ******************************************************************************************************************************
  331.             ' * procedure name: Form_QueryUnload
  332.             ' * procedure description:  Occurs before a form or application closes.
  333.             ' *
  334.             ' ******************************************************************************************************************************
  335.             Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  336.             Dim frm As Form
  337.             On Local Error GoTo ErrLine
  338.             
  339.             Call RenderTimelineQuasiAsync(Nothing)
  340.             
  341.             Select Case UnloadMode
  342.                 Case vbFormControlMenu
  343.                          '0 The user chose the Close command from the Control menu on the form.
  344.                          For Each frm In Forms
  345.                                frm.Move Screen.Width * -8, Screen.Height * -8
  346.                                frm.Visible = False: Unload frm
  347.                          Next
  348.             
  349.                 Case vbFormCode
  350.                          '1 The Unload statement is invoked from code.
  351.                          Exit Sub
  352.                          
  353.                 Case vbAppWindows
  354.                          '2 The current Microsoft Windows operating environment session is ending.
  355.                          For Each frm In Forms
  356.                                frm.Move Screen.Width * -8, Screen.Height * -8
  357.                                frm.Visible = False: Unload frm
  358.                          Next
  359.                          
  360.                 Case vbAppTaskManager
  361.                          '3 The Microsoft Windows Task Manager is closing the application.
  362.                          For Each frm In Forms
  363.                                frm.Move Screen.Width * -8, Screen.Height * -8
  364.                                frm.Visible = False: Unload frm
  365.                          Next
  366.                          End
  367.                          
  368.                 Case vbFormMDIForm
  369.                          '4 An MDI child form is closing because the MDI form is closing.
  370.                          Exit Sub
  371.                          
  372.                 Case vbFormOwner
  373.                          '5 A form is closing because its owner is closing
  374.                          For Each frm In Forms
  375.                                frm.Move Screen.Width * -8, Screen.Height * -8
  376.                                frm.Visible = False: Unload frm
  377.                          Next
  378.             End Select
  379.             Exit Sub
  380.             
  381. ErrLine:
  382.             Err.Clear
  383.             Exit Sub
  384.             End Sub
  385.             
  386.             ' ******************************************************************************************************************************
  387.             ' * procedure name: Form_Unload
  388.             ' * procedure description:  Occurs when a form is about to be removed from the screen.
  389.             ' *
  390.             ' ******************************************************************************************************************************
  391.             Private Sub Form_Unload(Cancel As Integer)
  392.             On Local Error GoTo ErrLine
  393.             
  394.             'clean-up & dereference global data
  395.             If ObjPtr(gbl_objTimeline) > 0 Then Set gbl_objTimeline = Nothing
  396.             If ObjPtr(gbl_objMediaControl) > 0 Then Set gbl_objMediaControl = Nothing
  397.             If ObjPtr(gbl_objVideoWindow) > 0 Then Set gbl_objVideoWindow = Nothing
  398.             If ObjPtr(gbl_objRenderEngine) > 0 Then Set gbl_objRenderEngine = Nothing
  399.             Exit Sub
  400.             
  401. ErrLine:
  402.             Err.Clear
  403.             Exit Sub
  404.             End Sub
  405. ' **************************************************************************************************************************************
  406. ' * PRIVATE INTERFACE- CONTROL EVENT HANDLERS
  407.             ' ******************************************************************************************************************************
  408.             ' * procedure name: cmdExit_Click
  409.             ' * procedure description:  Occurs when the user presses and then releases a mouse button over an object.
  410.             ' *
  411.             ' ******************************************************************************************************************************
  412.             Private Sub cmdExit_Click()
  413.             Dim frm As Form
  414.             On Local Error GoTo ErrLine
  415.             
  416.             'Invoke the Unload statement on each loaded form
  417.             For Each frm In Forms
  418.                frm.Move Screen.Width * 8, Screen.Height * 8
  419.                Unload frm: Set frm = Nothing
  420.             Next
  421.             Exit Sub
  422.             
  423. ErrLine:
  424.             Err.Clear
  425.             Exit Sub
  426.             End Sub
  427.             
  428.             ' ******************************************************************************************************************************
  429.             ' * procedure name: cmdPlay_Click
  430.             ' * procedure description:  Occurs when the user presses and then releases a mouse button over an object.
  431.             ' *
  432.             ' ******************************************************************************************************************************
  433.             Private Sub cmdPlay_Click()
  434.             On Local Error GoTo ErrLine
  435.             
  436.             'assign the maximum media length per clip
  437.             If IsNumeric(txtMaxMediaLength.Text) Then _
  438.                m_nMaximumClipLength = CLng(txtMaxMediaLength.Text)
  439.                
  440.             'splice the video clip(s)
  441.             Set gbl_objTimeline = _
  442.                   SpliceVideo(TransitionFriendlyNameToCLSID _
  443.                   ( _
  444.                   cmbTransitions.Text), _
  445.                   ctrlSourceClip(0).MediaFile, _
  446.                   ctrlSourceClip(1).MediaFile, _
  447.                   ctrlSourceClip(2).MediaFile, _
  448.                   ctrlSourceClip(3).MediaFile, _
  449.                   ctrlSourceClip(4).MediaFile, _
  450.                   ctrlSourceClip(5).MediaFile, _
  451.                   ctrlSourceClip(6).MediaFile, _
  452.                   ctrlSourceClip(7).MediaFile _
  453.                   )
  454.             
  455.             'disable the ui
  456.             Call AppEnable(False, False)
  457.             
  458.             'obtain a reference to the filtergraph manager
  459.             If ObjPtr(gbl_objTimeline) > 0 Then
  460.                If ObjPtr(gbl_objRenderEngine) > 0 Then
  461.                   'set the timeline object
  462.                   Call gbl_objRenderEngine.SetTimelineObject(gbl_objTimeline)
  463.                   'playback the timeline
  464.                   Call RenderTimelineQuasiAsync(gbl_objTimeline)
  465.                End If
  466.             End If
  467.             
  468.             'enable the ui
  469.             If ObjPtr(gbl_objTimeline) > 0 Then
  470.                Call AppEnable(True, True)
  471.             End If
  472.             Exit Sub
  473.             
  474. ErrLine:
  475.             Err.Clear
  476.             Resume Next
  477.             Exit Sub
  478.             End Sub
  479.             
  480.             
  481.             ' ******************************************************************************************************************************
  482.             ' * procedure name: cmdWriteAVI_Click
  483.             ' * procedure description:  Occurs when the user presses and then releases a mouse button over an object.
  484.             ' *
  485.             ' ******************************************************************************************************************************
  486.             Private Sub cmdWriteAVI_Click()
  487.             Dim nState As Long
  488.             Dim nReturnCode As Long
  489.             Dim dblPosition As Double
  490.             Dim dblDuration As Double
  491.             Dim bstrFileName As String
  492.             Dim objMediaEvent As IMediaEvent
  493.             Dim objMediaPosition As IMediaPosition
  494.             Dim objFilterGraphManager As FilgraphManager
  495.             Dim objSmartRenderEngine As SmartRenderEngine
  496.             On Error GoTo ErrLine
  497.             
  498.             'assign the maximum media length per clip
  499.             If IsNumeric(txtMaxMediaLength.Text) Then _
  500.                m_nMaximumClipLength = CLng(txtMaxMediaLength.Text)
  501.             
  502.             'splice the video clip(s)
  503.             Set gbl_objTimeline = _
  504.                   SpliceVideo(TransitionFriendlyNameToCLSID _
  505.                   ( _
  506.                   cmbTransitions.Text), _
  507.                   ctrlSourceClip(0).MediaFile, _
  508.                   ctrlSourceClip(1).MediaFile, _
  509.                   ctrlSourceClip(2).MediaFile, _
  510.                   ctrlSourceClip(3).MediaFile, _
  511.                   ctrlSourceClip(4).MediaFile, _
  512.                   ctrlSourceClip(5).MediaFile, _
  513.                   ctrlSourceClip(6).MediaFile, _
  514.                   ctrlSourceClip(7).MediaFile _
  515.                   )
  516.             
  517.                   
  518.             'disable the ui
  519.             Call AppEnable(False, False, False)
  520.             
  521.             'delete the previous file if it exists
  522.             bstrFileName = ShowCommonDlgSave(, "AVI", "*.avi|*.avi")
  523.             If bstrFileName = vbNullString Then
  524.                'enable the ui / user cancel
  525.                Call AppEnable(True, True, True)
  526.                Exit Sub
  527.             End If
  528.             
  529.             
  530.             'instantiate a smart render engine
  531.             Set objSmartRenderEngine = New SmartRenderEngine
  532.             'set the timeline object to the render engine
  533.             objSmartRenderEngine.SetTimelineObject gbl_objTimeline
  534.             'connect-up the render engine's frontend
  535.             objSmartRenderEngine.ConnectFrontEnd
  536.             'obtain an instance of the filtergraph manager
  537.             objSmartRenderEngine.GetFilterGraph objFilterGraphManager
  538.             'append a filewriter and av mux filter to the graph
  539.             AddFileWriterAndMux objFilterGraphManager, bstrFileName
  540.             'render the output pins on the smart render engine
  541.             RenderGroupPins objSmartRenderEngine, gbl_objTimeline
  542.             'render the filtergraph
  543.             objFilterGraphManager.Run
  544.             'derive the media event interface from the filtergraph manager
  545.             Set objMediaEvent = objFilterGraphManager
  546.             Set objMediaPosition = objMediaEvent
  547.             
  548.             'display the progress during render
  549.             ctrlProgress.Value = 0
  550.             ctrlProgress.Visible = True
  551.             dblDuration = objMediaPosition.Duration
  552.             If dblDuration > 0 Then
  553.                Do Until ctrlProgress.Value = 100: DoEvents
  554.                      'query current position
  555.                      dblPosition = objMediaPosition.CurrentPosition
  556.                      'set the progress bar's current position
  557.                      If dblPosition <> 0 Then
  558.                         If dblDuration > 0 Then
  559.                            ctrlProgress.Value = dblPosition * 100 / dblDuration
  560.                         Else: ctrlProgress.Value = 100: Exit Do
  561.                         End If
  562.                      Else: ctrlProgress.Value = 100: Exit Do
  563.                      End If
  564.                Loop
  565.             End If
  566.             ctrlProgress.Value = 100
  567.             ctrlProgress.Visible = False
  568.             
  569.             'enable the ui
  570.             Call AppEnable(True, True, True)
  571.             
  572.             'clean-up & dereference
  573.             If ObjPtr(objMediaEvent) > 0 Then Set objMediaEvent = Nothing
  574.             If ObjPtr(objMediaPosition) > 0 Then Set objMediaPosition = Nothing
  575.             If ObjPtr(objFilterGraphManager) > 0 Then Set objFilterGraphManager = Nothing
  576.             If ObjPtr(objSmartRenderEngine) > 0 Then Set objSmartRenderEngine = Nothing
  577.             Exit Sub
  578.             
  579. ErrLine:
  580.             Err.Clear
  581.             Resume Next
  582.             Exit Sub
  583.             End Sub
  584.             
  585.             
  586.             ' ******************************************************************************************************************************
  587.             ' * procedure name: cmdWriteXTL_Click
  588.             ' * procedure description:  Occurs when the user presses and then releases a mouse button over an object.
  589.             ' *
  590.             ' ******************************************************************************************************************************
  591.             Private Sub cmdWriteXTL_Click()
  592.             Dim bstrFileName As String
  593.             Dim objXml2Dex As Xml2Dex
  594.             On Local Error GoTo ErrLine
  595.             
  596.             'assign the maximum media length per clip
  597.             If IsNumeric(txtMaxMediaLength.Text) Then _
  598.                m_nMaximumClipLength = CLng(txtMaxMediaLength.Text)
  599.                
  600.             'splice the video clip(s)
  601.             Set gbl_objTimeline = _
  602.                   SpliceVideo(TransitionFriendlyNameToCLSID _
  603.                   ( _
  604.                   cmbTransitions.Text), _
  605.                   ctrlSourceClip(0).MediaFile, _
  606.                   ctrlSourceClip(1).MediaFile, _
  607.                   ctrlSourceClip(2).MediaFile, _
  608.                   ctrlSourceClip(3).MediaFile, _
  609.                   ctrlSourceClip(4).MediaFile, _
  610.                   ctrlSourceClip(5).MediaFile, _
  611.                   ctrlSourceClip(6).MediaFile, _
  612.                   ctrlSourceClip(7).MediaFile _
  613.                   )
  614.             
  615.             'disable the ui
  616.             Call AppEnable(False, False, False)
  617.             
  618.             'delete the previous file if it exists
  619.             bstrFileName = ShowCommonDlgSave(, "XTL", "*.xtl|*.xtl")
  620.             If bstrFileName = vbNullString Then
  621.                'enable the ui
  622.                Call AppEnable(True, True, True)
  623.                Exit Sub
  624.             Else: If File_Exists(bstrFileName) Then _
  625.                         Call File_Delete(bstrFileName, False, False, False)
  626.             End If
  627.             
  628.             'obtain a reference to the filtergraph manager
  629.             If ObjPtr(gbl_objTimeline) > 0 Then
  630.                If ObjPtr(gbl_objRenderEngine) > 0 Then
  631.                   'set the timeline object
  632.                   Call gbl_objRenderEngine.SetTimelineObject(gbl_objTimeline)
  633.                   'render the timeline
  634.                   Call SaveTimeline(gbl_objTimeline, bstrFileName, DEXExportXTL)
  635.                End If
  636.             End If
  637.             
  638.             'enable the ui
  639.             Call AppEnable(True, True, True)
  640.             Exit Sub
  641.             
  642. ErrLine:
  643.             Err.Clear
  644.             Resume Next
  645.             Exit Sub
  646.             End Sub
  647.             
  648.             
  649.             ' ******************************************************************************************************************************
  650.             ' * procedure name: ctrlSourceClip_Import
  651.             ' * procedure description:  Occurs whenever an import of a media file into the clipsource control is attempted.
  652.             ' *                                       Set the second argument, 'Cancel' to true to cancel the operation and prevent the import.
  653.             ' ******************************************************************************************************************************
  654.             Private Sub ctrlSourceClip_Import(Index As Integer, bstrFileName As String, Cancel As Boolean)
  655.             On Local Error GoTo ErrLine
  656.             
  657.             'enable/disable drag/drop
  658.             If m_boolEnableDragDrop = False Then
  659.                Cancel = True
  660.                Exit Sub
  661.             End If
  662.             
  663.             'otherwise enable everything
  664.             Call AppEnable(True, True, True)
  665.             Exit Sub
  666.             
  667. ErrLine:
  668.             Err.Clear
  669.             Exit Sub
  670.             End Sub
  671.             
  672.             
  673.             ' ******************************************************************************************************************************
  674.             ' * procedure name: ctrlSourceClip_DragDrop
  675.             ' * procedure description:  Occurs when a drag-and-drop operation is completed.
  676.             ' *
  677.             ' ******************************************************************************************************************************
  678.             Private Sub ctrlSourceClip_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
  679.             Dim nCount As Long
  680.             On Local Error GoTo ErrLine
  681.             
  682.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  683.                If nCount <> Index Then
  684.                   If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  685.                      ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  686.                Else
  687.                   If ctrlSourceClip(nCount).BorderColor <> HIGHLIGHT_CLIPBORDERCOLOR Then _
  688.                      ctrlSourceClip(nCount).BorderColor = HIGHLIGHT_CLIPBORDERCOLOR
  689.                End If
  690.             Next
  691.             'reset default media file
  692.             ctrlSourceClip(Index).MediaFile = Source.MediaFile
  693.             'reset the default color to the clip control
  694.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  695.                If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  696.                   ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  697.                Next
  698.             Exit Sub
  699.             
  700. ErrLine:
  701.             Err.Clear
  702.             Exit Sub
  703.             End Sub
  704.             
  705.             
  706.             ' ******************************************************************************************************************************
  707.             ' * procedure name: ctrlSourceClip_DragOver
  708.             ' * procedure description:  Occurs when a drag-and-drop operation is in progress.
  709.             ' *
  710.             ' ******************************************************************************************************************************
  711.             Private Sub ctrlSourceClip_DragOver(Index As Integer, Source As Control, X As Single, Y As Single, State As Integer)
  712.             Dim nCount As Long
  713.             On Local Error GoTo ErrLine
  714.             
  715.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  716.                If nCount <> Index Then
  717.                   If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  718.                      ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  719.                Else
  720.                   If ctrlSourceClip(nCount).BorderColor <> HIGHLIGHT_CLIPBORDERCOLOR Then _
  721.                      ctrlSourceClip(nCount).BorderColor = HIGHLIGHT_CLIPBORDERCOLOR
  722.                End If
  723.             Next
  724.             Exit Sub
  725.             
  726. ErrLine:
  727.             Err.Clear
  728.             Exit Sub
  729.             End Sub
  730.             
  731. ' **************************************************************************************************************************************
  732. ' * PRIVATE INTERFACE- CONTROL EVENT HANDLERS
  733.             ' ******************************************************************************************************************************
  734.             ' * procedure name: cmdPlay_MouseMove
  735.             ' * procedure description:  Occurs when the user moves the mouse.
  736.             ' *                                        Reset control parameter(s) to default setting(s)
  737.             ' ******************************************************************************************************************************
  738.             Private Sub cmdPlay_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  739.             Dim nCount As Long
  740.             On Local Error GoTo ErrLine
  741.             
  742.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  743.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  744.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  745.             Next
  746.             Exit Sub
  747.             
  748. ErrLine:
  749.             Err.Clear
  750.             Exit Sub
  751.             End Sub
  752.             
  753.             
  754.             ' ******************************************************************************************************************************
  755.             ' * procedure name: cmdWriteAVI_MouseMove
  756.             ' * procedure description:  Occurs when the user moves the mouse.
  757.             ' *                                        Reset control parameter(s) to default setting(s)
  758.             ' ******************************************************************************************************************************
  759.             Private Sub cmdWriteAVI_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  760.             Dim nCount As Long
  761.             On Local Error GoTo ErrLine
  762.             
  763.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  764.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  765.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  766.             Next
  767.             Exit Sub
  768.             
  769. ErrLine:
  770.             Err.Clear
  771.             Exit Sub
  772.             End Sub
  773.             
  774.             
  775.             ' ******************************************************************************************************************************
  776.             ' * procedure name: cmdWriteXTL_MouseMove
  777.             ' * procedure description:  Occurs when the user moves the mouse.
  778.             ' *                                        Reset control parameter(s) to default setting(s)
  779.             ' ******************************************************************************************************************************
  780.             Private Sub cmdWriteXTL_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  781.             Dim nCount As Long
  782.             On Local Error GoTo ErrLine
  783.             
  784.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  785.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  786.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  787.             Next
  788.             Exit Sub
  789.             
  790. ErrLine:
  791.             Err.Clear
  792.             Exit Sub
  793.             End Sub
  794.             
  795.             
  796.             ' ******************************************************************************************************************************
  797.             ' * procedure name: cmdExit_MouseMove
  798.             ' * procedure description:  Occurs when the user moves the mouse.
  799.             ' *                                        Reset control parameter(s) to default setting(s)
  800.             ' ******************************************************************************************************************************
  801.             Private Sub cmdExit_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  802.             Dim nCount As Long
  803.             On Local Error GoTo ErrLine
  804.             
  805.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  806.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  807.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  808.             Next
  809.             Exit Sub
  810.             
  811. ErrLine:
  812.             Err.Clear
  813.             Exit Sub
  814.             End Sub
  815.             
  816.             
  817.             ' ******************************************************************************************************************************
  818.             ' * procedure name: ctrlProgress_MouseMove
  819.             ' * procedure description:  Occurs when the user moves the mouse.
  820.             ' *                                        Reset control parameter(s) to default setting(s)
  821.             ' ******************************************************************************************************************************
  822.             Private Sub ctrlProgress_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  823.             Dim nCount As Long
  824.             On Local Error GoTo ErrLine
  825.             
  826.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  827.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  828.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  829.             Next
  830.             Exit Sub
  831.             
  832. ErrLine:
  833.             Err.Clear
  834.             Exit Sub
  835.             End Sub
  836.             
  837.             
  838.             ' ******************************************************************************************************************************
  839.             ' * procedure name: Form_MouseMove
  840.             ' * procedure description:  Occurs when the user moves the mouse.
  841.             ' *                                        Reset control parameter(s) to default setting(s)
  842.             ' ******************************************************************************************************************************
  843.             Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  844.             Dim nCount As Long
  845.             On Local Error GoTo ErrLine
  846.             
  847.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  848.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  849.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  850.             Next
  851.             Exit Sub
  852.             
  853. ErrLine:
  854.             Err.Clear
  855.             Exit Sub
  856.             End Sub
  857.             
  858.             
  859.             ' ******************************************************************************************************************************
  860.             ' * procedure name: fraCommandFixture_MouseMove
  861.             ' * procedure description:  Occurs when the user moves the mouse.
  862.             ' *                                        Reset control parameter(s) to default setting(s)
  863.             ' ******************************************************************************************************************************
  864.             Private Sub fraCommandFixture_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  865.             Dim nCount As Long
  866.             On Local Error GoTo ErrLine
  867.             
  868.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  869.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  870.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  871.             Next
  872.             Exit Sub
  873.             
  874. ErrLine:
  875.             Err.Clear
  876.             Exit Sub
  877.             End Sub
  878.             
  879.             
  880.             ' ******************************************************************************************************************************
  881.             ' * procedure name: fraOptions_MouseMove
  882.             ' * procedure description:  Occurs when the user moves the mouse.
  883.             ' *                                        Reset control parameter(s) to default setting(s)
  884.             ' ******************************************************************************************************************************
  885.             Private Sub fraOptions_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  886.             Dim nCount As Long
  887.             On Local Error GoTo ErrLine
  888.             
  889.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  890.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  891.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  892.             Next
  893.             Exit Sub
  894.             
  895. ErrLine:
  896.             Err.Clear
  897.             Exit Sub
  898.             End Sub
  899.             
  900.             
  901.             ' ******************************************************************************************************************************
  902.             ' * procedure name: lblInstructions_MouseMove
  903.             ' * procedure description:  Occurs when the user moves the mouse.
  904.             ' *                                        Reset control parameter(s) to default setting(s)
  905.             ' ******************************************************************************************************************************
  906.             Private Sub lblInstructions_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  907.             Dim nCount As Long
  908.             On Local Error GoTo ErrLine
  909.             
  910.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  911.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  912.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  913.             Next
  914.             Exit Sub
  915.             
  916. ErrLine:
  917.             Err.Clear
  918.             Exit Sub
  919.             End Sub
  920.             
  921.             
  922.             ' ******************************************************************************************************************************
  923.             ' * procedure name: lblTransitionDescription_MouseMove
  924.             ' * procedure description:  Occurs when the user moves the mouse.
  925.             ' *                                        Reset control parameter(s) to default setting(s)
  926.             ' ******************************************************************************************************************************
  927.             Private Sub lblTransitionDescription_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  928.             Dim nCount As Long
  929.             On Local Error GoTo ErrLine
  930.             
  931.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  932.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  933.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  934.             Next
  935.             Exit Sub
  936.             
  937. ErrLine:
  938.             Err.Clear
  939.             Exit Sub
  940.             End Sub
  941.             
  942.             
  943.             ' ******************************************************************************************************************************
  944.             ' * procedure name: lbltxtMaxMediaLength_MouseMove
  945.             ' * procedure description:  Occurs when the user moves the mouse.
  946.             ' *                                        Reset control parameter(s) to default setting(s)
  947.             ' ******************************************************************************************************************************
  948.             Private Sub lbltxtMaxMediaLength_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  949.             Dim nCount As Long
  950.             On Local Error GoTo ErrLine
  951.             
  952.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  953.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  954.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  955.             Next
  956.             Exit Sub
  957.             
  958. ErrLine:
  959.             Err.Clear
  960.             Exit Sub
  961.             End Sub
  962.             
  963.             
  964.             ' ******************************************************************************************************************************
  965.             ' * procedure name: txtMaxMediaLength_MouseMove
  966.             ' * procedure description:  Occurs when the user moves the mouse.
  967.             ' *                                        Reset control parameter(s) to default setting(s)
  968.             ' ******************************************************************************************************************************
  969.             Private Sub txtMaxMediaLength_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  970.             Dim nCount As Long
  971.             On Local Error GoTo ErrLine
  972.             
  973.             For nCount = ctrlSourceClip.LBound To ctrlSourceClip.UBound
  974.             If ctrlSourceClip(nCount).BorderColor <> DEFAULT_CLIPBORDERCOLOR Then _
  975.                ctrlSourceClip(nCount).BorderColor = DEFAULT_CLIPBORDERCOLOR
  976.             Next
  977.             Exit Sub
  978.             
  979. ErrLine:
  980.             Err.Clear
  981.             Exit Sub
  982.             End Sub
  983.             
  984.             
  985. ' **************************************************************************************************************************************
  986. ' * PRIVATE INTERFACE- PROCEDURES
  987.             ' ******************************************************************************************************************************
  988.             ' * procedure name: SpliceVideo
  989.             ' * procedure description:  Splices a variable number of video files together using the given transition.
  990.             ' *                                       DefaultTransitionCLSID evaluates to the CLSID of the desired transition to use.
  991.             ' *                                       Files evaluates to a variable number of BSTR String arguments containing the filename(s)
  992.             ' ******************************************************************************************************************************
  993.             Private Function SpliceVideo(DefaultTransitionCLSID As String, ParamArray Files()) As AMTimeline
  994.             Dim nCount As Long
  995.             Dim nCount2 As Long
  996.             Dim bstrCurrentFile As String
  997.             Dim boolAudioGroup As Boolean
  998.             Dim boolVideoGroup As Boolean
  999.             Dim dblAudioStartTime As Double
  1000.             Dim dblAudioStopTime As Double
  1001.             Dim dblVideoStartTime As Double
  1002.             Dim dblVideoStopTime As Double
  1003.             Dim objTimeline As AMTimeline
  1004.             Dim objNewSource As AMTimelineSrc
  1005.             Dim objNewTrack As AMTimelineTrack
  1006.             Dim objTransition As AMTimelineTrans
  1007.             Dim objAudioGroup As AMTimelineGroup
  1008.             Dim objVideoGroup As AMTimelineGroup
  1009.             Dim objTimelineTrackObject As AMTimelineObj
  1010.             Dim objTimelineSourceObject As AMTimelineObj
  1011.             Dim objTimelineAudioGroupObject As AMTimelineObj
  1012.             Dim objTimelineVideoGroupObject As AMTimelineObj
  1013.             On Local Error GoTo ErrLine
  1014.             
  1015.             'instantiate new timeline
  1016.             Set objTimeline = CreateTimeline
  1017.             
  1018.             'enable transitions on the timeline
  1019.             Call objTimeline.EnableTransitions(1)
  1020.             
  1021.             'enumerate the files and place the group(s) on the timeline
  1022.             For nCount = LBound(Files) To UBound(Files)
  1023.                   If TypeName(Files(nCount)) = "String" Then
  1024.                      If Files(nCount) <> vbNullString Then
  1025.                         bstrCurrentFile = Files(nCount)
  1026.                         If HasStreams(bstrCurrentFile) Then
  1027.                            If HasAudioStream(bstrCurrentFile) Then
  1028.                               'enumerate all the groups in the timeline to ensure audio has not yet been added
  1029.                               If GetGroupCount(objTimeline) > 0 Then
  1030.                                  For nCount2 = 0 To GetGroupCount(objTimeline)
  1031.                                     If ObjPtr(GroupFromTimeline(objTimeline, nCount2)) > 0 Then
  1032.                                        If GroupFromTimeline(objTimeline, nCount2).GetGroupName = "AUDIO" Then
  1033.                                            boolAudioGroup = True
  1034.                                        End If
  1035.                                     End If
  1036.                                  Next
  1037.                                  If boolAudioGroup = False Then
  1038.                                     'insert an audio group into the timeline
  1039.                                     Set objAudioGroup = CreateGroup(objTimeline, "AUDIO", DEXMediaTypeAudio)
  1040.                                     Call InsertGroup(objTimeline, objAudioGroup)
  1041.                                     Set objTimelineAudioGroupObject = objAudioGroup
  1042.                                     boolAudioGroup = True
  1043.                                  End If
  1044.                               Else:
  1045.                                        'insert an audio group into the timeline
  1046.                                        Set objAudioGroup = CreateGroup(objTimeline, "AUDIO", DEXMediaTypeAudio)
  1047.                                        Call InsertGroup(objTimeline, objAudioGroup)
  1048.                                        Set objTimelineAudioGroupObject = objAudioGroup
  1049.                                        boolAudioGroup = True
  1050.                               End If
  1051.                            End If
  1052.                            
  1053.                            If HasVideoStream(bstrCurrentFile) Then
  1054.                               'enumerate all the groups in the timeline to ensure audio has not yet been added
  1055.                               If GetGroupCount(objTimeline) > 0 Then
  1056.                                  For nCount2 = 0 To GetGroupCount(objTimeline)
  1057.                                     If ObjPtr(GroupFromTimeline(objTimeline, nCount2)) > 0 Then
  1058.                                        If GroupFromTimeline(objTimeline, nCount2).GetGroupName = "VIDEO" Then
  1059.                                           boolVideoGroup = True
  1060.                                        End If
  1061.                                     End If
  1062.                                  Next
  1063.                                  If boolVideoGroup = False Then
  1064.                                     'insert a video group into the timeline
  1065.                                     Set objVideoGroup = CreateGroup(objTimeline, "VIDEO", DEXMediaTypeVideo)
  1066.                                     Call InsertGroup(objTimeline, objVideoGroup)
  1067.                                     Set objTimelineVideoGroupObject = objVideoGroup
  1068.                                     boolVideoGroup = True
  1069.                                  End If
  1070.                               Else:
  1071.                                        'insert a video group into the timeline
  1072.                                        Set objVideoGroup = CreateGroup(objTimeline, "VIDEO", DEXMediaTypeVideo)
  1073.                                        Call InsertGroup(objTimeline, objVideoGroup)
  1074.                                        Set objTimelineVideoGroupObject = objVideoGroup
  1075.                                        boolVideoGroup = True
  1076.                               End If
  1077.                            End If
  1078.                         End If
  1079.                      End If
  1080.                   End If
  1081.             Next
  1082.             
  1083.             'enumerate the files and place the tracks/source(s) on the timeline
  1084.             For nCount = LBound(Files) To UBound(Files)
  1085.                   If TypeName(Files(nCount)) = "String" Then
  1086.                      If Files(nCount) <> vbNullString Then
  1087.                         bstrCurrentFile = Files(nCount)
  1088.                         If HasVideoStream(bstrCurrentFile) Then
  1089.                            'insert a new video track for the clip in the timeline
  1090.                            Set objNewTrack = CreateTrack(objTimeline)
  1091.                            Set objTimelineTrackObject = objNewTrack
  1092.                            Call InsertTrack(objNewTrack, objTimelineVideoGroupObject)
  1093.                            'inset a new sourceclip into the timeline
  1094.                            Set objNewSource = CreateSource(objTimeline)
  1095.                            'insert the new source clip into the new track
  1096.                            If dblVideoStopTime = 0 Then
  1097.                               dblVideoStartTime = m_nMaximumClipLength * (nCount): dblVideoStopTime = (m_nMaximumClipLength * (nCount + 1)) + 1
  1098.                            Else: dblVideoStartTime = (m_nMaximumClipLength * (nCount)) - 1: dblVideoStopTime = (m_nMaximumClipLength * (nCount + 1)) + 1
  1099.                            End If
  1100.                            Call InsertSource(objNewTrack, objNewSource, bstrCurrentFile, dblVideoStartTime, dblVideoStopTime)
  1101.                            'insert a new transition into each track on the timeline
  1102.                            If DefaultTransitionCLSID <> vbNullString Then
  1103.                               Set objTransition = CreateTransition(objTimeline)
  1104.                               dblVideoStartTime = ((m_nMaximumClipLength * (nCount))) - 1: dblVideoStopTime = (m_nMaximumClipLength * nCount + 1)
  1105.                               If dblVideoStartTime < 0 Then dblVideoStartTime = 0
  1106.                               Call InsertTransition(objTransition, objTimelineTrackObject, DefaultTransitionCLSID, dblVideoStartTime, dblVideoStopTime)
  1107.                            End If
  1108.                         End If
  1109.                         
  1110.                         If HasAudioStream(bstrCurrentFile) Then
  1111.                            'insert a new audio track for the clip in the timeline
  1112.                            Set objNewTrack = CreateTrack(objTimeline)
  1113.                            Set objTimelineTrackObject = objNewTrack
  1114.                            Call InsertTrack(objNewTrack, objTimelineAudioGroupObject)
  1115.                            'inset a new sourceclip into the timeline
  1116.                            Set objNewSource = CreateSource(objTimeline)
  1117.                            'insert the new source clip into the new track
  1118.                            If dblAudioStopTime = 0 Then
  1119.                               dblAudioStartTime = m_nMaximumClipLength * (nCount): dblAudioStopTime = (m_nMaximumClipLength * (nCount + 1)) + 1
  1120.                            Else: dblAudioStartTime = (m_nMaximumClipLength * (nCount)) - 1: dblAudioStopTime = (m_nMaximumClipLength * (nCount + 1)) + 1
  1121.                            End If
  1122.                            Call InsertSource(objNewTrack, objNewSource, bstrCurrentFile, dblAudioStartTime, dblAudioStopTime)
  1123.                         End If
  1124.                      End If
  1125.                   End If
  1126.             Next
  1127.             
  1128.             'return the timeline
  1129.             If ObjPtr(objTimeline) > 0 Then Set SpliceVideo = objTimeline
  1130.             
  1131.             'clean-up & dereference
  1132.             If ObjPtr(objTimeline) > 0 Then Set objTimeline = Nothing  ' AMTimeline
  1133.             If ObjPtr(objNewSource) > 0 Then Set objNewSource = Nothing  ' AMTimelineSrc
  1134.             If ObjPtr(objNewTrack) > 0 Then Set objNewTrack = Nothing  ' AMTimelineTrack
  1135.             If ObjPtr(objTransition) > 0 Then Set objTransition = Nothing ' AMTimelineTrans
  1136.             If ObjPtr(objAudioGroup) > 0 Then Set objAudioGroup = Nothing  ' AMTimelineGroup
  1137.             If ObjPtr(objVideoGroup) > 0 Then Set objVideoGroup = Nothing  ' AMTimelineGroup
  1138.             If ObjPtr(objTimelineTrackObject) > 0 Then Set objTimelineTrackObject = Nothing  ' AMTimelineObj
  1139.             If ObjPtr(objTimelineSourceObject) > 0 Then Set objTimelineSourceObject = Nothing  ' AMTimelineObj
  1140.             If ObjPtr(objTimelineAudioGroupObject) > 0 Then Set objTimelineAudioGroupObject = Nothing  ' AMTimelineObj
  1141.             If ObjPtr(objTimelineVideoGroupObject) > 0 Then Set objTimelineVideoGroupObject = Nothing  ' AMTimelineObj
  1142.             Exit Function
  1143.             
  1144. ErrLine:
  1145.             Err.Clear
  1146.             Exit Function
  1147.             End Function
  1148.             ' ******************************************************************************************************************************
  1149.             ' * procedure name: ViewTransitionFriendlyNamesDirect
  1150.             ' * procedure description:  Maps transition friendly names to a combobox for easy viewing.
  1151.             ' *
  1152.             ' ******************************************************************************************************************************
  1153.             Private Sub ViewTransitionFriendlyNamesDirect(cmbComboBox As Control)
  1154.             On Local Error GoTo ErrLine
  1155.             
  1156.             If ObjPtr(cmbComboBox) > 0 Then
  1157.                If TypeName(cmbComboBox) = "ComboBox" Then
  1158.                   With cmbComboBox
  1159.                      .AddItem "Barn"
  1160.                      .AddItem "Blinds"
  1161.                      .AddItem "BurnFilm"
  1162.                      .AddItem "CenterCurls"
  1163.                      .AddItem "ColorFade"
  1164.                      .AddItem "Compositor"
  1165.                      .AddItem "Curls"
  1166.                      .AddItem "Curtains"
  1167.                      .AddItem "Fade"
  1168.                      .AddItem "FadeWhite"
  1169.                      .AddItem "FlowMotion"
  1170.                      .AddItem "GlassBlock"
  1171.                      .AddItem "Grid"
  1172.                      .AddItem "Inset"
  1173.                      .AddItem "Iris"
  1174.                      .AddItem "Jaws"
  1175.                      .AddItem "Lens"
  1176.                      .AddItem "LightWipe"
  1177.                      .AddItem "Liquid"
  1178.                      .AddItem "PageCurl"
  1179.                      .AddItem "PeelABCD"
  1180.                      .AddItem "Pixelate"
  1181.                      .AddItem "RadialWipe"
  1182.                      .AddItem "Ripple"
  1183.                      .AddItem "RollDown"
  1184.                      .AddItem "Slide"
  1185.                      .AddItem "SMPTE Wipe"
  1186.                      .AddItem "Spiral"
  1187.                      .AddItem "Stretch"
  1188.                      .AddItem "Threshold"
  1189.                      .AddItem "Twister"
  1190.                      .AddItem "Vacuum"
  1191.                      .AddItem "Water"
  1192.                      .AddItem "Wheel"
  1193.                      .AddItem "Wipe"
  1194.                      .AddItem "WormHole"
  1195.                      .AddItem "Zigzag"
  1196.                   End With
  1197.                End If
  1198.             End If
  1199.             Exit Sub
  1200.             
  1201. ErrLine:
  1202.             Err.Clear
  1203.             Exit Sub
  1204.             End Sub
  1205.             
  1206.             
  1207.             ' ******************************************************************************************************************************
  1208.             ' * procedure name: AppEnable
  1209.             ' * procedure description:  Enabled/Disables the application's controls.
  1210.             ' *
  1211.             ' ******************************************************************************************************************************
  1212.             Private Sub AppEnable(EnableControls As Boolean, Optional EnableDragDrop As Boolean = True, Optional EnableExit As Boolean = True)
  1213.             On Local Error GoTo ErrLine
  1214.             
  1215.             'enable/disable controls
  1216.             If EnableControls Then
  1217.                cmdPlay.Enabled = True
  1218.                cmdWriteAVI.Enabled = True
  1219.                cmdWriteXTL.Enabled = True
  1220.             Else
  1221.                cmdPlay.Enabled = False
  1222.                cmdWriteAVI.Enabled = False
  1223.                cmdWriteXTL.Enabled = False
  1224.             End If
  1225.             
  1226.             'enable/disable drag/drop
  1227.             If EnableDragDrop Then
  1228.                m_boolEnableDragDrop = True
  1229.             Else: m_boolEnableDragDrop = False
  1230.             End If
  1231.             
  1232.             'enable/disable exit
  1233.             If EnableExit Then
  1234.                cmdExit.Enabled = True
  1235.             Else: cmdExit.Enabled = False
  1236.             End If
  1237.             Exit Sub
  1238.             
  1239. ErrLine:
  1240.             Err.Clear
  1241.             Exit Sub
  1242.             End Sub
  1243.