scratchpad:custom_audio
Quick Example
Create the file server/skin/custom.js within your remote XUL directory.
Edit the file and enter lines derived from this pattern:
urls['AUDIO_event_EVENT_TEXTCODE_GOES_HERE'] = '/xul/server/skin/media/audio/path_to_custom_sound_goes_here.wav';
For example:
urls['AUDIO_event_COPY_ALERT_MESSAGE'] = '/xul/server/skin/media/audio/redalert.wav'; urls['AUDIO_event_COPY_BAD_STATUS'] = '/xul/server/skin/media/audio/redalert.wav';
Lines in custom.js will override similar lines in the stock server/main/constants.js
See ils_events.xml for a list of textcodes and their descriptions. In the staff client, the textcode for overridable events will show up in red in the upper left of override dialogs. You may also use the debug console to watch for events as you simulate various situations.
Comprehensive example for Check-In workflows
////////////////////////////////////////////////////////////////////////// // Configuring audio for check-in scenarios var customized = 'phasefx'; // For a clean slate urls['AUDIO_good'] = ''; urls['AUDIO_bad'] = ''; // This isn't necessarily for "bad" things, and gets used with most pop-up dialogs urls['AUDIO_horrible'] = ''; urls['AUDIO_circ_good'] = ''; // This gets used for basically anything showing up in the Check-In list urls['AUDIO_circ_bad'] = ''; urls['AUDIO_event_ASSET_COPY_NOT_FOUND'] = ''; ////////////////////////////////////////////////////////////////////////// // Scenario 1: Scanning (or mis-scanning) a barcode not in the database // // The event returned: urls['AUDIO_event_ASSET_COPY_NOT_FOUND'] = '/xul/server/skin/media/audio/bonus.wav'; // From the pop-up dialog (this dialog gets re-used throughout the client, so effectively it can only have one // defined sound globally): urls['AUDIO_bad'] = '/xul/server/skin/media/audio/question.wav'; ////////////////////////////////////////////////////////////////////////// // Scenario 2: Scanning an item that goes smoothly into Reshelving status // // The event returned: urls['AUDIO_event_SUCCESS'] = ''; // Hard-coded sound: urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav'; ////////////////////////////////////////////////////////////////////////// // Scenario 3: Scanning an item that is already checked-in and for which no action is needed // // The event returned: urls['AUDIO_event_NO_CHANGE'] = ''; // Hard-coded sound: urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav'; // Already defined previously, but here for completeness. Any value here would override // previous assignments. There can only be one global value for any given sound label, // even if the sound gets used in different contexts. ////////////////////////////////////////////////////////////////////////// // Note: For both scenario 2 and scenario 3, the code dictates that an AUDIO_circ_good sound plays. This sound // will come after any sound defined for the event, but it can possibly trump or truncate that sound. So, if // you wanted scenario 2 and 3 to have completely different sounds, it would be best to set AUDIO_circ_good // (the sound they have in common) to an empty string (''), and rely on just the configured sound for the // specific event. ////////////////////////////////////////////////////////////////////////// // Scenario 4: Scanning an item that needs to transit // // The event returned: urls['AUDIO_event_ROUTE_ITEM'] = '/xul/server/skin/media/audio/redalert.wav'; // From the pop-up dialog (which may be suppressed): urls['AUDIO_bad'] = '/xul/server/skin/media/audio/question.wav'; // Hard-coded sound, once the dialog closes and the list shows the item: urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav'; ////////////////////////////////////////////////////////////////////////// // Scenario 5: Scanning an item that needs to go to the Hold Shelf // // The event returned: urls['AUDIO_event_SUCCESS'] = ''; // From the pop-up dialog (which may be suppressed): urls['AUDIO_bad'] = '/xul/server/skin/media/audio/question.wav'; // Hard-coded sound: urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav'; ////////////////////////////////////////////////////////////////////////// // Note: There's no way currently to distinguish between scenario 2 (normal reshelving check-in) and // scenario 5 (check-in for hold shelf) with this configuration file. Both scenarios use the same // event. The difference is with the payload delivered with the events (scenario 5 will contain an // action::hold_request object). However, it is easy development to add more hard-coded sounds when // needed to arbitrary code-paths. So, for example, we could create a configurable AUDIO_hold_shelf // sound, and create a .hold_shelf() method to the sound object to insert into the check-in code. A // similar situation exists with scenario 4, if you need to distinguish between a normal transit and // a hold-transit. ////////////////////////////////////////////////////////////////////////// // Scenario 6: Scanning an item that is marked Claimed Returned // // The event returned: urls['AUDIO_event_CIRC_CLAIMS_RETURNED'] = '/xul/server/skin/media/audio/redalert.wav'; // From the pop-up dialog for check-in failure override: urls['AUDIO_bad'] = '/xul/server/skin/media/audio/question.wav'; // Hard-coded sound (if the failure is overriden): urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav'; ////////////////////////////////////////////////////////////////////////// // Scenario 7: Scanning an item that is marked Lost // // The event returned: urls['AUDIO_event_COPY_STATUS_LOST'] = '/xul/server/skin/media/audio/redalert.wav'; // From the pop-up dialog for check-in failure override: urls['AUDIO_bad'] = '/xul/server/skin/media/audio/question.wav'; // Hard-coded sound (if the failure is overriden): urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav'; ////////////////////////////////////////////////////////////////////////// // Scenario 8: Scanning a pre-cataloged item // // The event returned: urls['AUDIO_event_ITEM_NOT_CATALOGED'] = '/xul/server/skin/media/audio/redalert.wav'; // From the pop-up dialog for route to cataloging (which may be suppressed): urls['AUDIO_bad'] = '/xul/server/skin/media/audio/question.wav'; // Hard-coded sound post-dialog: urls['AUDIO_circ_good'] = '/xul/server/skin/media/audio/toggled.wav';
scratchpad/custom_audio.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1