[nvda-addons] Re: commit/StationPlaylist: josephsl: Intro monitoring: NVDA will beep when song intro is about to end.

  • From: "Joseph Lee" <joseph.lee22590@xxxxxxxxx>
  • To: <nvda-addons@xxxxxxxxxxxxx>
  • Date: Sat, 13 Sep 2014 09:52:05 -0700

Hi all, mostly SPL users,
One of your suggestions is now a reality: starting from October snapshot, if
you set intro time, you'll be able to hear a long beep when song intros are
about to end. You'll also be able to configure this alarm between 1 and 9
seconds via a dedicated dialog, accessed using Alt+NVDA+2 (it works even in
SPL 4.x as well).
For code reviewers: should I create a dedicated function, just like time
announcements to let scripts call it to set appropriate setting? This could
help reduce duplication.
Cheers,
Joseph

-----Original Message-----
From: nvda-addons-commits-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-commits-bounce@xxxxxxxxxxxxx] On Behalf Of
commits-noreply@xxxxxxxxxxxxx
Sent: Saturday, September 13, 2014 9:44 AM
To: nvda-addons-commits@xxxxxxxxxxxxx
Subject: commit/StationPlaylist: josephsl: Intro monitoring: NVDA will beep
when song intro is about to end.

1 new commit in StationPlaylist:

https://bitbucket.org/nvdaaddonteam/stationplaylist/commits/4806c6363fb9/
Changeset:   4806c6363fb9
Branch:      introductionMonitoring
User:        josephsl
Date:        2014-09-13 18:43:33
Summary:     Intro monitoring: NVDA will beep when song intro is about to
end.
Using end of track alarm feature as the basis, added a dialog to configure
sont ingros (also known as song ramp) between 1 and 9 seconds. When the
intro is playing, Studio changes the label for remaining time, so use this
to provide a notification (a longer, high pitch beep) to alert the
broadcaster that the vocals are about to begin.
As this is available frm both 4.x and 5.x, this will be added to both
4.0-dev and the compatibility version.o

Affected #:  2 files

diff --git a/addon/appModules/splstudio.py b/addon/appModules/splstudio.py
index 1c65061..f3093a2 100644
--- a/addon/appModules/splstudio.py
+++ b/addon/appModules/splstudio.py
@@ -82,7 +82,9 @@ class AppModule(appModuleHandler.AppModule):
                                obj.name = fieldName.text
 
        # Check the following variable for end of track announcement.
-       SPLEndOfTrackTime = "00:05" # Should be adjustable by the user in
the end. Also find a way to announce this even if SPL Studio is minimized.
+       SPLEndOfTrackTime = "00:05"
+       # Check for end of song intros.
+       SPLSongRampTime = "00:05"
        # Keep an eye on library scans in insert tracks window.
        libraryScanning = False
        scanCount = 0
@@ -144,9 +146,12 @@ class AppModule(appModuleHandler.AppModule):
                                                if obj.name == "Cart Edit
On": ui.message(_("Cart explorer is active"))
                                                # Translators: Presented
when cart edit mode is toggled off while cart explorer is on.
                                                elif obj.name == "Cart Edit
Off": ui.message(_("Please reenter cart explorer to view updated cart
assignments"))
-                       # Monitor the end of track time and announce it.
-                       elif obj.windowClassName == "TStaticText" and
obj.name == self.SPLEndOfTrackTime and obj.simpleParent.name == "Remaining
Time": tones.beep(440, 200) # SPL 4.x.
-                       elif obj.windowClassName == "TStaticText" and
obj.name == self.SPLEndOfTrackTime and obj.simplePrevious != None and
obj.simplePrevious.name == "Remaining Time": tones.beep(440, 200) # SPL 5.x.
+                       # Monitor the end of track and song intro time and
announce it.
+                       elif obj.windowClassName == "TStaticText": # For
future extensions.
+                               if obj.name == self.SPLEndOfTrackTime and
obj.simpleParent.name == "Remaining Time": tones.beep(440, 200) # End of
track for SPL 4.x.
+                               elif obj.name == self.SPLSongRampTime and
obj.simpleParent.name == "Remaining Song Ramp": tones.beep(512, 400) # Song
intro for SPL 4.x.
+                               elif obj.name == self.SPLEndOfTrackTime and
obj.simplePrevious != None and obj.simplePrevious.name == "Remaining Time":
tones.beep(440, 200) # End of track for SPL 5.x.
+                               elif obj.name == self.SPLSongRampTime and
obj.simplePrevious != None and obj.simplePrevious.name == "Remaining Song
Ramp": tones.beep(512, 400) # Song intro for SPL 5.x.
                        # Clean this mess with a more elegant solution.
                nextHandler()
 
@@ -228,6 +233,30 @@ class AppModule(appModuleHandler.AppModule):
        # Translators: Input help mode message for a command in Station
Playlist Studio.
        script_setEndOfTrackTime.__doc__=_("sets end of track alarm (default
is 5 seconds).")
 
+       # Set song ramp (introduction) time between 1 and 9 seconds.
+
+       def script_setSongRampTime(self, gesture):
+               rampVal = self.SPLSongRampTime[-2:]
+               # Translators: A dialog message to set song ramp alarm
(curRampSec is the current intro monitoring alarm in seconds).
+               timeMSG = _("Enter song intro alarm time in seconds
(currently {curRampSec})").format(curRampSec = rampVal if int(rampVal) >= 10
else rampVal[-1])
+               dlg = wx.TextEntryDialog(gui.mainFrame,
+               timeMSG,
+               # Translators: The title of song intro alarm dialog.
+               _("Song intro alarm"), defaultValue=rampVal if int(rampVal)
>= 10 else rampVal[-1])
+               def callback(result):
+                       if result == wx.ID_OK:
+                               if not dlg.GetValue().isdigit() or
int(dlg.GetValue()) < 1 or int(dlg.GetValue()) > 9:
+                                       # Translators: The error message
presented when incorrect alarm time value has been entered.
+                                       wx.CallAfter(gui.messageBox,
_("Incorrect value entered."),
+                                       # Translators: Standard title for
error dialog (copy this from main nvda.po file).
+                                       _("Error"),wx.OK|wx.ICON_ERROR)
+                               else:
+                                       newAlarmSec = "0" + dlg.GetValue()
+                                       self.SPLSongRampTime =
self.SPLSongRampTime.replace(self.SPLSongRampTime[-2:], newAlarmSec) # Quite
a complicated replacement expression, but it works in this case.
+               gui.runScriptModalDialog(dlg, callback)
+       # Translators: Input help mode message for a command in Station
Playlist Studio.
+       script_setEndOfTrackTime.__doc__=_("sets song intro alarm (default
is 
+5 seconds).")
+
        # Other commands (track finder and others)
 
        # Toggle whether beeps should be heard instead of toggle
announcements.
@@ -628,6 +657,7 @@ class AppModule(appModuleHandler.AppModule):
                "kb:shift+nvda+f12":"sayBroadcasterTime",
                "kb:control+nvda+1":"toggleBeepAnnounce",
                "kb:control+nvda+2":"setEndOfTrackTime",
+               "kb:alt+nvda+2":"setSongRampTime",
                "kb:control+nvda+f":"findTrack",
                "kb:nvda+f3":"findTrackNext",
                "kb:shift+nvda+f3":"findTrackPrevious",

diff --git a/readme.md b/readme.md
index dbd4433..a2c8c25 100755
--- a/readme.md
+++ b/readme.md
@@ -17,6 +17,7 @@ IMPORTANT: Due to major incompatible changes and key
assignments, please remove
 * NVDA+Shift+F12 from Studio window: announces broadcaster time such as 5
minutes to top of the hour.
 * Control+NVDA+1 from Studio window: toggles announcement of toggle
messages (such as automation) between words and beeps.
 * Control+NVDA+2 from Studio window: Opens end of track setting dialog.
+* Alt+NVDA+2 from Studio window: Opens song intro alarm setting dialog.
 * Control+NVDA+3 from Studio window: Toggles cart explorer to learn cart
assignments.
 * Control+NVDA+f from Studio window: Opens a dialog to find a track based
on artist or song name. Press NvDA+F3 to find forward or NVDA+Shift+F3 to
find backward.
 
@@ -78,6 +79,10 @@ The available SPL Controller commands are:
 
 Five seconds before the current track ends, NVDA will play a short beep to
indicate that the track is about to end. This works anywhere (even within
SPL Studio window). Press Control+NVDA+2 to configure this between 1 and 59
seconds.
 
+## Song intro alarm
+
+If you have configured song intro time via Track Tool, NVDA will beep when
the vocals are about to begin. From Studio window, press Alt+NVDA+2 to
configure song intro alarm between 1 and 9 seconds.
+
 ## Track Finder
 
 If you wish to quickly find a song by an artist or by song name, from track
lisst, press Control+NVDA+F. Type the name of the artist or the song name.
NVDA will either place you at the song if found or will display an error if
it cannot find the song you're looking for. To find a previously entered
song or artist, press NVDA+F3 or NVDA+Shift+F3 to find forward or backward.
@@ -95,6 +100,7 @@ To learn cart assignments, from SPL Studio, press
Control+NVDA+3. Pressing the c  Version 4.0 supports SPL Studio 5.00 and
later, with 3.x released designed to provide some new features from 4.0 for
users using earlier versions of Studio.
 
 * New SPL Assistant keys, including schedule time for the track (S) and
remaining duration for the playlist (D). In addition, for Studio 5.x, added
playlist modification (Y) and track pitch (Shift+P).
+* Added a command (Alt+NvDA+2) to set song intro alarm time between 1 and 9
seconds.
 
 ## Changes for 3.0

Repository URL: https://bitbucket.org/nvdaaddonteam/stationplaylist/

--

This is a commit notification from bitbucket.org. You are receiving this
because you have the service enabled, addressing the recipient of this
email.

----------------------------------------------------------------

NVDA add-ons Central: A list for discussing NVDA add-ons

To post a message, send an email to nvda-addons@xxxxxxxxxxxxx.

To unsubscribe, send an email with the subject line of "unsubscribe" (without 
quotes) to nvda-addons-request@xxxxxxxxxxxxx.

If you have questions for list moderators, please send a message to 
nvda-addons-moderators@xxxxxxxxxxxxx.

Community addons can be found here: http://addons.nvda-project.org

Other related posts: