1. with Allegro.Files;                     use Allegro.Files; 
  2. with Interfaces.C;                      use Interfaces.C; 
  3. with Interfaces.C.Strings;              use Interfaces.C.Strings; 
  4.  
  5. package Allegro.Digital_Samples is 
  6.  
  7.     -- Allegro 4.2.2 - Digital Sample routines 
  8.     -- This package is complete 
  9.  
  10.     type Sample is private; 
  11.     type A_Sample is access all Sample; 
  12.  
  13.     type A_Sample_Loader is 
  14.         access function( filename : C.Strings.chars_ptr ) return A_Sample; 
  15.  
  16.     type A_Sample_Saver is 
  17.         access function( filename : C.Strings.chars_ptr; spl : A_Sample ) return Integer; 
  18.  
  19.     type Volume_Type is range 0..255; 
  20.     for Volume_Type'Size use Integer'Size; 
  21.  
  22.     type Pan_Type is range 0..255; 
  23.     for Pan_Type'Size use Integer'Size; 
  24.  
  25.     ---------------------------------------------------------------------------- 
  26.  
  27.     procedure Adjust_Sample( spl    : not null A_Sample; 
  28.                              vol    : Volume_Type; 
  29.                              pan    : Pan_Type; 
  30.                              freq   : Integer; 
  31.                              loopit : Integer ); 
  32.  
  33.     function Allocate_Voice( spl : not null A_Sample ) return Integer; 
  34.  
  35.     function Create_Sample( bits, stereo, freq, len : Integer ) return A_Sample; 
  36.  
  37.     procedure Deallocate_Voice( voice : Integer ); 
  38.  
  39.     procedure Destroy_Sample( spl : in out A_Sample ); 
  40.  
  41.     function Load_Sample( filename : String ) return A_Sample; 
  42.  
  43.     function Load_Voc( filename : String ) return A_Sample; 
  44.  
  45.     function Load_Voc_pf( f : not null A_Packfile ) return A_Sample; 
  46.  
  47.     function Load_Wav( filename : String ) return A_Sample; 
  48.  
  49.     function Load_Wav_pf( f : not null A_Packfile ) return A_Sample; 
  50.  
  51.     procedure Lock_Sample( spl : not null A_Sample ); 
  52.  
  53.     function Play_Sample( spl    : not null A_Sample; 
  54.                           vol    : Volume_Type; 
  55.                           pan    : Pan_Type; 
  56.                           freq   : Integer; 
  57.                           loopit : Integer ) return Integer; 
  58.  
  59.     procedure Reallocate_Voice( voice : Integer; spl : not null A_Sample ); 
  60.  
  61.     procedure Register_Sample_File_Type( ext  : String; 
  62.                                          load : A_Sample_Loader; 
  63.                                          save : A_Sample_Saver ); 
  64.  
  65.     function Save_Sample( filename : String; spl : not null A_Sample ) return Boolean; 
  66.  
  67.     procedure Stop_Sample( spl : not null A_Sample ); 
  68.  
  69.     procedure Release_Voice( voice : Integer ); 
  70.  
  71.     function Voice_Check( voice : Integer ) return A_Sample; 
  72.  
  73.     function Voice_Get_Frequency( voice : Integer ) return Integer; 
  74.  
  75.     function Voice_Get_Position( voice : Integer ) return Integer; 
  76.  
  77.     function Voice_Get_Volume( voice : Integer ) return Integer; 
  78.  
  79.     procedure Voice_Ramp_Volume( voice, time : Integer; endvol : Volume_Type ); 
  80.  
  81.     procedure Voice_Set_Frequency( voice, frequency : Integer ); 
  82.  
  83.     procedure Voice_Set_Playmode( voice, playmode : Integer ); 
  84.  
  85.     procedure Voice_Set_Position( voice : Integer; position : Integer ); 
  86.  
  87.     procedure Voice_Set_Priority( voice, priority : Integer ); 
  88.  
  89.     procedure Voice_Set_Volume( voice : Integer; volume : Volume_Type ); 
  90.  
  91.     procedure Voice_Start( voice : Integer ); 
  92.  
  93.     procedure Voice_Stop( voice : Integer ); 
  94.  
  95.     procedure Voice_Stop_Volumeramp( voice : Integer ); 
  96.  
  97.     procedure Voice_Sweep_Frequency( voice, time, endfreq : Integer ); 
  98.  
  99.     procedure Voice_Stop_Frequency_Sweep( voice : Integer ); 
  100.  
  101.     function Voice_Get_Pan( voice : Integer ) return Integer; 
  102.  
  103.     procedure Voice_Set_Pan( voice : Integer; pan : Pan_Type ); 
  104.  
  105.     procedure Voice_Sweep_Pan( voice, time : Integer; endpan : Pan_Type ); 
  106.  
  107.     procedure Voice_Stop_Pan_Sweep( voice : Integer ); 
  108.  
  109.     procedure Voice_Set_Echo( voice, strength, thedelay : Integer ); 
  110.  
  111.     procedure Voice_Set_Tremolo( voice, rate, depth : Integer ); 
  112.  
  113.     procedure Voice_Set_Vibrato( voice, rate, depth : Integer ); 
  114.  
  115. private 
  116.  
  117.     type Sample is 
  118.         record 
  119.             bits,                      -- 8 or 16 
  120.             stereo,                    -- sample type flag 
  121.             freq,                      -- sample type flag 
  122.             priority   : Integer;      -- 0-255 
  123.             len,                       -- length (in samples) 
  124.             loop_start,                -- loop start position 
  125.             loop_end,                  -- loop finish position 
  126.             param      : Interfaces.C.unsigned_long;  -- for internal use by the driver 
  127.             data       : Address;      -- sample data 
  128.         end record; 
  129.     pragma Convention( C, Sample ); 
  130.  
  131.     ---------------------------------------------------------------------------- 
  132.  
  133.     pragma Convention( C, A_Sample_Loader ); 
  134.     pragma Convention( C, A_Sample_Saver ); 
  135.  
  136.     pragma Import( C, Adjust_Sample, "adjust_sample" ); 
  137.     pragma Import( C, Allocate_Voice, "allocate_voice" ); 
  138.     pragma Import( C, Create_Sample, "create_sample" ); 
  139.     pragma Import( C, Deallocate_Voice, "deallocate_voice" ); 
  140.     pragma Import( C, Load_Voc_pf, "load_voc_pf" ); 
  141.     pragma Import( C, Load_Wav_pf, "load_wav_pf" ); 
  142.     pragma Import( C, Lock_Sample, "lock_sample" ); 
  143.     pragma Import( C, Play_Sample, "play_sample" ); 
  144.     pragma Import( C, Reallocate_Voice, "reallocate_voice" ); 
  145.     pragma Import( C, Release_Voice, "release_voice" ); 
  146.     pragma Import( C, Stop_Sample, "stop_sample" ); 
  147.     pragma Import( C, Voice_Check, "voice_check" ); 
  148.     pragma Import( C, Voice_Get_Frequency, "voice_get_frequency" ); 
  149.     pragma Import( C, Voice_Get_Position, "voice_get_position" ); 
  150.     pragma Import( C, Voice_Get_Volume, "voice_get_volume" ); 
  151.     pragma Import( C, Voice_Ramp_Volume, "voice_ramp_volume" ); 
  152.     pragma Import( C, Voice_Set_Frequency, "voice_set_frequency" ); 
  153.     pragma Import( C, Voice_Set_Playmode, "voice_set_playmode" ); 
  154.     pragma Import( C, Voice_Set_Position, "voice_set_position" ); 
  155.     pragma Import( C, Voice_Set_Priority, "voice_set_priority" ); 
  156.     pragma Import( C, Voice_Set_Volume, "voice_set_volume" ); 
  157.     pragma Import( C, Voice_Start, "voice_start" ); 
  158.     pragma Import( C, Voice_Stop, "voice_stop" ); 
  159.     pragma Import( C, Voice_Stop_Volumeramp, "voice_stop_volumeramp" ); 
  160.     pragma Import( C, Voice_Sweep_Frequency, "voice_sweep_frequency" ); 
  161.     pragma Import( C, Voice_Stop_Frequency_Sweep, "voice_stop_frequency_sweep" ); 
  162.     pragma Import( C, Voice_Get_Pan, "voice_get_pan" ); 
  163.     pragma Import( C, Voice_Set_Pan, "voice_set_pan" ); 
  164.     pragma Import( C, Voice_Sweep_Pan, "voice_sweep_pan" ); 
  165.     pragma Import( C, Voice_Stop_Pan_Sweep, "voice_stop_pan_sweep" ); 
  166.     pragma Import( C, Voice_Set_Echo, "voice_set_echo" ); 
  167.     pragma Import( C, Voice_Set_Tremolo, "voice_set_tremolo" ); 
  168.     pragma Import( C, Voice_Set_Vibrato, "voice_set_vibrato" ); 
  169.  
  170. end Allegro.Digital_Samples;