Adsense Ad

Tuesday 11 February 2020

Oracle Forms: Play Sound In Forms

PLAY_SOUND examples
The following plsql block you can write in when-button-pressed trigger for a push button item, when button clicked read a sound object from the file system and play it. Note: since an item must have focus in order to play a sound, the trigger code includes a call to the built-in procedure GO_ITEM:
BEGIN
IF :last_name = ’SCOTT’ THEN
GO_ITEM(’block.field’);
READ_SOUND_FILE(’C:\Sounds\scott.wav’,’wave’,’block.field’);
PLAY_SOUND(’block.field’);
END IF;
END;

OR
set_custom_property('BLOCK.PUSH_BUTTON1', 1, 'PLAY', 'FILE:///C:\sound_file.wav');

Oracle Forms 6i Guide: 

PLAY_SOUND built-in 

Description
Plays the sound object in the specified sound item. 

Syntax 
PLAY_SOUND(item_id ITEM); 
PLAY_SOUND(item_name VARCHAR2); 

Built-in Type restricted Enter 

Query Mode No 

Parameters: 
item_id The unique ID Form Builder gave the sound item when you created it. 
item_name The name you gave the sound item when you created it. 

PLAY_SOUND examples /* 

Example 1: 
This procedure call (attached to a menu item) 
** plays a sound object from the specified sound item: */

 GO_ITEM(’about.abc_inc’); 
 PLAY_SOUND(’about.abc_inc’); 

/* Example 2: 
These procedure calls (attached to a 
** When-Button-Pressed trigger) read a sound object from the 
** file system and play it. Note: since an item must have focus 
** in order to play a sound, the trigger code includes a call 
** to the built-in procedure GO_ITEM: */ 

BEGIN 
IF :clerks.last_name EQ ’BARNES’ THEN 
GO_ITEM(’orders.filled_by’); 
READ_SOUND_FILE(’t:\orders\clerk\barnes.wav’, ’wave’, ’orders.filled_by’); PLAY_SOUND(’orders.filled_by’); 
END IF; 
END;