home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectShow / Editing / SlideShowVB / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-10-08  |  59.3 KB  |  1,261 lines

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