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