with Allegro.Files; use Allegro.Files;
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings; use Interfaces.C.Strings;
package Allegro.Digital_Samples is
type Sample is private;
type A_Sample is access all Sample;
type A_Sample_Loader is
access function( filename : C.Strings.chars_ptr ) return A_Sample;
type A_Sample_Saver is
access function( filename : C.Strings.chars_ptr; spl : A_Sample ) return Integer;
type Volume_Type is range 0..255;
for Volume_Type'Size use Integer'Size;
type Pan_Type is range 0..255;
for Pan_Type'Size use Integer'Size;
procedure Adjust_Sample( spl : not null A_Sample;
vol : Volume_Type;
pan : Pan_Type;
freq : Integer;
loopit : Integer );
function Allocate_Voice( spl : not null A_Sample ) return Integer;
function Create_Sample( bits, stereo, freq, len : Integer ) return A_Sample;
procedure Deallocate_Voice( voice : Integer );
procedure Destroy_Sample( spl : in out A_Sample );
function Load_Sample( filename : String ) return A_Sample;
function Load_Voc( filename : String ) return A_Sample;
function Load_Voc_pf( f : not null A_Packfile ) return A_Sample;
function Load_Wav( filename : String ) return A_Sample;
function Load_Wav_pf( f : not null A_Packfile ) return A_Sample;
procedure Lock_Sample( spl : not null A_Sample );
function Play_Sample( spl : not null A_Sample;
vol : Volume_Type;
pan : Pan_Type;
freq : Integer;
loopit : Integer ) return Integer;
procedure Reallocate_Voice( voice : Integer; spl : not null A_Sample );
procedure Register_Sample_File_Type( ext : String;
load : A_Sample_Loader;
save : A_Sample_Saver );
function Save_Sample( filename : String; spl : not null A_Sample ) return Boolean;
procedure Stop_Sample( spl : not null A_Sample );
procedure Release_Voice( voice : Integer );
function Voice_Check( voice : Integer ) return A_Sample;
function Voice_Get_Frequency( voice : Integer ) return Integer;
function Voice_Get_Position( voice : Integer ) return Integer;
function Voice_Get_Volume( voice : Integer ) return Integer;
procedure Voice_Ramp_Volume( voice, time : Integer; endvol : Volume_Type );
procedure Voice_Set_Frequency( voice, frequency : Integer );
procedure Voice_Set_Playmode( voice, playmode : Integer );
procedure Voice_Set_Position( voice : Integer; position : Integer );
procedure Voice_Set_Priority( voice, priority : Integer );
procedure Voice_Set_Volume( voice : Integer; volume : Volume_Type );
procedure Voice_Start( voice : Integer );
procedure Voice_Stop( voice : Integer );
procedure Voice_Stop_Volumeramp( voice : Integer );
procedure Voice_Sweep_Frequency( voice, time, endfreq : Integer );
procedure Voice_Stop_Frequency_Sweep( voice : Integer );
function Voice_Get_Pan( voice : Integer ) return Integer;
procedure Voice_Set_Pan( voice : Integer; pan : Pan_Type );
procedure Voice_Sweep_Pan( voice, time : Integer; endpan : Pan_Type );
procedure Voice_Stop_Pan_Sweep( voice : Integer );
procedure Voice_Set_Echo( voice, strength, thedelay : Integer );
procedure Voice_Set_Tremolo( voice, rate, depth : Integer );
procedure Voice_Set_Vibrato( voice, rate, depth : Integer );
private
type Sample is
record
bits,
stereo,
freq,
priority : Integer;
len,
loop_start,
loop_end,
param : Interfaces.C.unsigned_long;
data : Address;
end record;
pragma Convention( C, Sample );
pragma Convention( C, A_Sample_Loader );
pragma Convention( C, A_Sample_Saver );
pragma Import( C, Adjust_Sample, "adjust_sample" );
pragma Import( C, Allocate_Voice, "allocate_voice" );
pragma Import( C, Create_Sample, "create_sample" );
pragma Import( C, Deallocate_Voice, "deallocate_voice" );
pragma Import( C, Load_Voc_pf, "load_voc_pf" );
pragma Import( C, Load_Wav_pf, "load_wav_pf" );
pragma Import( C, Lock_Sample, "lock_sample" );
pragma Import( C, Play_Sample, "play_sample" );
pragma Import( C, Reallocate_Voice, "reallocate_voice" );
pragma Import( C, Release_Voice, "release_voice" );
pragma Import( C, Stop_Sample, "stop_sample" );
pragma Import( C, Voice_Check, "voice_check" );
pragma Import( C, Voice_Get_Frequency, "voice_get_frequency" );
pragma Import( C, Voice_Get_Position, "voice_get_position" );
pragma Import( C, Voice_Get_Volume, "voice_get_volume" );
pragma Import( C, Voice_Ramp_Volume, "voice_ramp_volume" );
pragma Import( C, Voice_Set_Frequency, "voice_set_frequency" );
pragma Import( C, Voice_Set_Playmode, "voice_set_playmode" );
pragma Import( C, Voice_Set_Position, "voice_set_position" );
pragma Import( C, Voice_Set_Priority, "voice_set_priority" );
pragma Import( C, Voice_Set_Volume, "voice_set_volume" );
pragma Import( C, Voice_Start, "voice_start" );
pragma Import( C, Voice_Stop, "voice_stop" );
pragma Import( C, Voice_Stop_Volumeramp, "voice_stop_volumeramp" );
pragma Import( C, Voice_Sweep_Frequency, "voice_sweep_frequency" );
pragma Import( C, Voice_Stop_Frequency_Sweep, "voice_stop_frequency_sweep" );
pragma Import( C, Voice_Get_Pan, "voice_get_pan" );
pragma Import( C, Voice_Set_Pan, "voice_set_pan" );
pragma Import( C, Voice_Sweep_Pan, "voice_sweep_pan" );
pragma Import( C, Voice_Stop_Pan_Sweep, "voice_stop_pan_sweep" );
pragma Import( C, Voice_Set_Echo, "voice_set_echo" );
pragma Import( C, Voice_Set_Tremolo, "voice_set_tremolo" );
pragma Import( C, Voice_Set_Vibrato, "voice_set_vibrato" );
end Allegro.Digital_Samples;