with Events; use Events;
with Events.Corrals; use Events.Corrals;
with Events.Listeners; use Events.Listeners;
with Objects; use Objects;
with Processes; use Processes;
private with Ada.Containers.Indefinite_Hashed_Maps;
private with Ada.Strings.Equal_Case_Insensitive;
private with Ada.Strings.Hash_Case_Insensitive;
private with Allegro.Audio;
private with Resources;
package Audio_Players is
type Audio_Player is new Limited_Object and Process and Event_Listener with private;
type A_Audio_Player is access all Audio_Player'Class;
function Create_Audio_Player( corral : not null A_Corral ) return A_Audio_Player;
pragma Postcondition( Create_Audio_Player'Result /= null );
procedure Delete( this : in out A_Audio_Player );
pragma Postcondition( this = null );
private
use Allegro.Audio;
use Resources;
type Sound;
type A_Sound is access all Sound;
package Sound_Maps is new
Ada.Containers.Indefinite_Hashed_Maps( String,
A_Sound,
Ada.Strings.Hash_Case_Insensitive,
Ada.Strings.Equal_Case_Insensitive,
"=" );
type Audio_Player is new Limited_Object and Process and Event_Listener with
record
voice : A_Allegro_Voice := null;
mixer : A_Allegro_Mixer := null;
corral : A_Corral := null;
musicRes : A_Resource_File := null;
musicStream : A_Allegro_Audio_Stream := null;
sounds : Sound_Maps.Map;
end record;
procedure Construct( this : access Audio_Player; corral : not null A_Corral );
procedure Delete( this : in out Audio_Player );
procedure Handle_Event( this : access Audio_Player;
evt : in out A_Event;
resp : out Response_Type );
pragma Precondition( evt /= null );
function Get_Process_Name( this : access Audio_Player ) return String;
procedure Tick( this : access Audio_Player; time : Tick_Time );
end Audio_Players;