home *** CD-ROM | disk | FTP | other *** search
- ' -------------------------------------
- ' Event notification script for ReClock
- ' -------------------------------------
- '
- ' This script will be called when ReClock change the media adaptation of a played file
- ' either automatically or after some manual change made in the properties panel
- ' It is called only for media file which contain a video stream, and when frame rate of this file is known
- '
- ' ---------------------------------------------------------------------------------------------
- ' The 7 parameters received by this script are explained below:
- '
- ' (1) contains the event name that just occurred:
- ' - "GREEN" : tray icon just got green (all is fine)
- ' - "YELLOW" : tray icon just got yellow. We should make what is necessary
- ' to change the monitor refresh rate
- '
- ' (2) contains the type of media file currently played:
- ' - "CINEMA" : frame rate of source file is around 24 fps
- ' - "PAL" : frame rate of source file is around 25 fps
- ' - "NTSC" : frame rate of source file is around 30 fps
- ' - "CUSTOM" : frame rate of source file does not fall in previous categories
- '
- ' (3) contains the current sound playback mode:
- ' - "PCM" : PCM mode
- ' - "SPDIF" : AC3 passthrough SPDIF
- '
- ' (4) contains the current resolution of your monitor (WIDTHxHEIGHT)
- '
- ' (5) contains the current refresh rate of your monitor (in Hz)
- '
- ' (6) contains the original playback rate of the file (in fps multiplied by 1000)
- '
- ' (7) contains the current playback rate of the file (in fps multiplied by 1000)
- '
- ' ---------------------------------------------------------------------------------------------
- ' Notifications examples:
- ' - GREEN CINEMA PCM 1024x768 72 23976 24000 : all is good
- ' - GREEN NTSC PCM 1024x768 60 29970 30000 : all is good
- ' - YELLOW PAL SPDIF 1024x768 72 25000 25000 : please switch to a multiple of 25 hz since PAL wants 25 fps
- ' - YELLOW CINEMA SPDIF 1024x768 75 23976 23976 : please switch to 71.928 hz
- '
- ' ---------------------------------------------------------------------------------------------
- ' Here is a sample in VbScript that will call Powerstrip to change the monitor refresh rate
- ' using the /T parameter (to obtain the timings parameters go to the timings setup in powerstrip and copy
- ' them to the clipboard)
- ' There is a VERY important thing to note. Powerstrip change the timings directly in the hardware, but
- ' forget to notify Windows applications it did that (including ReClock). So i provided a little tool
- ' called NotifyDisplayChange.exe that MUST be called after each reconfiguration by Powerstrip. If you
- ' don't do that ReClock won't see the changes and will get confused ...
-
- ' Decode the parameters
- Set objArgs = WScript.Arguments
- If objArgs.Count < 7 Then
- MsgBox "Bad argument count !", MB_OK, "ReClock Event Notification"
- WScript.Quit
- End If
-
- eventName = objArgs(0)
- mediaType = objArgs(1)
- soundMode = objArgs(2)
- currentResolution = objArgs(3)
- currentRefreshRate = objArgs(4)
- originalPlaybackSpeed = objArgs(5)
- currentPlaybackSpeed = objArgs(6)
-
- ' If you need to debug, replace false with true in the following line
- if false Then MsgBox _
- eventName & " " & _
- mediaType & " " & _
- soundMode & " " & _
- currentResolution & " " & _
- currentRefreshRate & " " & _
- originalPlaybackSpeed & " " & _
- currentPlaybackSpeed, _
- MB_OK, "ReClock Event Notification"
-
- ' Here is a sample of what can be done with PowerStrip
- Set wshShell = CreateObject("WScript.Shell")
-
- ' We will put new timings here if necessary
- newTimings = ""
-
- ' Obviously we have something to do only if the icon is yellow
- If eventName = "YELLOW" Then
-
- If soundMode = "PCM" Then
-
- ' Call the profile that match best what we need in PCM mode
- Select Case mediaType & ":" & currentResolution
- Case "CINEMA:1024x768"
- If currentRefreshRate <> "72" Then newTimings = "1024,40,136,144,768,3,6,29,77953,2054" ' 71.928 hz
-
- Case "PAL:1024x768"
- If currentRefreshRate <> "75" Then newTimings = "1024,40,136,144,768,3,6,29,81254,2054" ' 75 hz
-
- Case "NTSC:1024x768"
- If currentRefreshRate <> "60" Then newTimings = "1024,40,136,144,768,3,6,29,64894,2054" ' 59.98 hz
- End Select
-
- ElseIf soundMode = "SPDIF" Then
-
- ' In SPDIF mode we need an exact multiple to minimize the drops/repeats
- ' Note: be careful in NTSC mode, because if "currentRefreshRate" is already "60"
- ' when we go here then we won't switch but it may be 60 "bad" hz instead of 59.94 "wanted" hz
- ' The same problem exists for NTSC film (23.976fps)
- ' A solution is to force settings in the GREEN icon notification, but that would mean a pause
- ' each time we play a file with SPDIF ...
- ' That's why we use 59.94 hz and 71.928 hz for PCM too so we will never user 60 and 72 hz
- Select Case currentResolution & "x" & originalPlaybackSpeed
- Case "1024x768x23976"
- If currentRefreshRate <> "72" Then newTimings = "1024,40,136,144,768,3,6,29,77953,2054" ' 71.928 hz
-
- Case "1024x768x25000"
- If currentRefreshRate <> "75" Then newTimings = "1024,40,136,144,768,3,6,29,81254,2054" ' 75 hz
-
- Case "1024x768x29970"
- If currentRefreshRate <> "60" Then newTimings = "1024,40,136,144,768,3,6,29,64942,2054" ' 59.98 hz
- End Select
-
- End if
-
- End If
-
- ' Do we have new timings to apply ?
- If newTimings <> "" Then
- Set objShell = CreateObject("Shell.Application")
- Set objFolder = objShell.Namespace(&H26&)
- Set objFolderItem = objFolder.Self
-
- ' Run Powerstrip
- WshShell.Run """" & objFolderItem.Path & "\PowerStrip\pstrip.exe"" /T:" & newTimings
- ' Notify the changes. Never ever forget to do that !
- WshShell.Run "NotifyDisplayChange.exe"
- End If
-
- ' All done, goodbye !
- WScript.Quit
-