1. with Events; 
  2.  
  3. pragma Elaborate_All( Events ); 
  4.  
  5. package Events.Audio is 
  6.  
  7.     PLAY_MUSIC_ID : constant Event_Id := To_Event_Id( "Play_Music" ); 
  8.  
  9.     -- A command to begin playing a looped music track. 
  10.     type Play_Music_Event is new Event with private; 
  11.     type A_Play_Music_Event is access all Play_Music_Event'Class; 
  12.  
  13.     -- Returns the filename of the music to play. 
  14.     function Get_Music_Name( this : not null access Play_Music_Event'Class ) return String; 
  15.     pragma Postcondition( Get_Music_Name'Result'Length > 0 ); 
  16.  
  17.     ---------------------------------------------------------------------------- 
  18.  
  19.     PLAY_SOUND_ID : constant Event_Id := To_Event_Id( "Play_Sound" ); 
  20.  
  21.     -- A command to play a sound effect once through. 
  22.     type Play_Sound_Event is new Event with private; 
  23.     type A_Play_Sound_Event is access all Play_Sound_Event'Class; 
  24.  
  25.     -- Returns the name of the sound effect to play. 
  26.     function Get_Sound_Name( this : not null access Play_Sound_Event'Class ) return String; 
  27.     pragma Postcondition( Get_Sound_Name'Result'Length > 0 ); 
  28.  
  29.     ---------------------------------------------------------------------------- 
  30.  
  31.     STOP_MUSIC_ID : constant Event_Id := To_Event_Id( "Stop_Music" ); 
  32.  
  33.     -- A command to stop any music currently playing. 
  34.     type Stop_Music_Event is new Event with private; 
  35.     type A_Stop_Music_Event is access all Stop_Music_Event'Class; 
  36.  
  37.     ---------------------------------------------------------------------------- 
  38.  
  39.     -- Queues a Play_Music_Event. 
  40.     procedure Queue_Play_Music( name : String ); 
  41.     pragma Precondition( name'Length > 0 ); 
  42.  
  43.     -- Queues a Play_Sound_Event. 
  44.     procedure Queue_Play_Sound( name : String ); 
  45.     pragma Precondition( name'Length > 0 ); 
  46.  
  47.     -- Queues a Stop_Music_Event. 
  48.     procedure Queue_Stop_Music; 
  49.  
  50. private 
  51.  
  52.     type Play_Sound_Event is new Event with 
  53.         record 
  54.             name : Unbounded_String; 
  55.         end record; 
  56.  
  57.     procedure Construct( this : access Play_Sound_Event; name : String ); 
  58.     pragma Precondition( name'Length > 0 ); 
  59.  
  60.     function To_String( this : access Play_Sound_Event ) return String; 
  61.  
  62.     ---------------------------------------------------------------------------- 
  63.  
  64.     type Play_Music_Event is new Event with 
  65.         record 
  66.             name : Unbounded_String; 
  67.         end record; 
  68.  
  69.     procedure Construct( this : access Play_Music_Event; name : String ); 
  70.     pragma Precondition( name'Length > 0 ); 
  71.  
  72.     function To_String( this : access Play_Music_Event ) return String; 
  73.  
  74.     ---------------------------------------------------------------------------- 
  75.  
  76.     type Stop_Music_Event is new Event with null record; 
  77.  
  78. end Events.Audio;