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