1. with Allegro.Digital_Samples;           use Allegro.Digital_Samples; 
  2.  
  3. package Allegro.Audio_Streams is 
  4.  
  5.     -- Allegro 4.2.2 - Audio stream routines 
  6.     -- This package is complete 
  7.  
  8.     type Audiostream is private; 
  9.     type A_Audiostream is access all Audiostream; 
  10.  
  11.     type Bits_Type is ( Eight_Bits, Sixteen_Bits ); 
  12.     for Bits_Type use (Eight_Bits => 8, Sixteen_Bits => 16); 
  13.     for Bits_Type'Size use Integer'Size; 
  14.  
  15.     ---------------------------------------------------------------------------- 
  16.  
  17.     procedure Free_Audio_Stream_Buffer( stream : A_Audiostream ); 
  18.  
  19.     function Get_Audio_Stream_Buffer( stream : not null A_Audiostream ) return Address; 
  20.  
  21.     function Play_Audio_Stream( len    : Natural; 
  22.                                 bits   : Bits_Type; 
  23.                                 stereo : Integer; 
  24.                                 freq   : Integer; 
  25.                                 vol    : Volume_Type; 
  26.                                 pan    : Pan_Type ) return A_Audiostream; 
  27.  
  28.     procedure Stop_Audio_Stream( stream : in out A_Audiostream ); 
  29.  
  30. private 
  31.  
  32.     type Audiostream is 
  33.         record 
  34.             voice    : Integer;        -- the voice we are playing on 
  35.             samp     : A_Sample;       -- the sample we are using 
  36.             len,                       -- buffer length 
  37.             bufcount,                  -- number of buffers per sample half 
  38.             bufnum,                    -- current refill buffer 
  39.             active   : Integer;        -- which half is currently playing 
  40.             locked   : Address;        -- the locked buffer 
  41.         end record; 
  42.     pragma Convention( C, Audiostream ); 
  43.  
  44.     ---------------------------------------------------------------------------- 
  45.  
  46.     pragma Import( C, Free_Audio_Stream_Buffer, "free_audio_stream_buffer" ); 
  47.     pragma Import( C, Get_Audio_Stream_Buffer, "get_audio_stream_buffer" ); 
  48.     pragma Import( C, Play_Audio_Stream, "play_audio_stream" ); 
  49.  
  50. end Allegro.Audio_Streams;