13 from pyfbsdk_additions
import *
23 def BrowseCallback(control, event):
26 lFp.Caption =
"Select the audio track definition file:"
27 lFp.Style = FBFilePopupStyle.kFBFilePopupOpen
29 if os.path.isdir(os.path.splitext(traceback.extract_stack()[-1][0])[0]):
30 lFp.Path = os.path.normpath(os.path.splitext(traceback.extract_stack()[-1][0])[0])
32 lFp.Path = os.path.normpath(os.path.dirname(traceback.extract_stack()[-1][0]))
36 eButt.Text = os.path.join(lFp.Path,lFp.FileName)
38 def SetupCallback(control, event):
41 f=open(os.path.join(lFp.Path,lFp.FileName),
'r') #Open the Audio Track Definition File
42 shotInfoFile = f.readlines()
44 lTrackAudio =
FBStoryTrack(FBStoryTrackType.kFBStoryTrackAudio)
45 shotCnt = len(shotInfoFile)
48 for shotInfo
in shotInfoFile:
50 shots = shotInfo.split()
54 iShotStart = int(shotStart)
55 iShotEnd = int(shotEnd)
57 audioPath = os.path.join(lFp.Path,
"Audio_Clip_0" + str(counter) +
".wav")
59 audioPath = os.path.join(lFp.Path,
"Audio_Clip_" + str(counter) +
".wav")
62 lClip = FBStoryClip (lAudio, lTrackAudio,
FBTime(0,0,0,iShotStart))
63 if lastClipEnd<iShotEnd: lastClipEnd=iShotEnd
68 FBMessageBox(
"Cannot Continue",
"Unable to read the audio track definition file you selected or you have not selected one.",
"OK",
None,
None )
71 def CloseCallback(control, event):
74 def PopulateLayout(mainLyt):
78 l.Caption =
"Select the audio track definition file to use:"
79 l.Style = FBTextStyle.kFBTextStyleBold
87 mainLyt.AddRegion(
"lab",
"lab", x, y, w, h)
88 mainLyt.SetControl(
"lab",l)
100 mainLyt.AddRegion(
"path",
"path", x2, y2, w2, h2)
101 mainLyt.SetControl(
"path",e)
105 b2.Caption =
"Browse..."
106 b2.Justify = FBTextJustify.kFBTextJustifyCenter
113 mainLyt.AddRegion(
"but",
"but", x3, y3, w3, h3)
114 mainLyt.SetControl(
"but",b2)
118 b2.OnClick.Add(BrowseCallback)
122 b3.Caption =
"Setup Audio"
123 b3.Justify = FBTextJustify.kFBTextJustifyCenter
130 mainLyt.AddRegion(
"audio",
"audio", x4, y4, w4, h4)
131 mainLyt.SetControl(
"audio",b3)
132 b3.OnClick.Add(SetupCallback)
137 b4.Justify = FBTextJustify.kFBTextJustifyCenter
144 mainLyt.AddRegion(
"close",
"close", x5, y5, w5, h5)
145 mainLyt.SetControl(
"close",b4)
146 b4.OnClick.Add(CloseCallback)