with Allegro.Audio_Streams; use Allegro.Audio_Streams;
with Allegro.Digital_Samples; use Allegro.Digital_Samples;
with System; use System;
package Almp3 is
ALMP3_OK : constant Integer := 0;
ALMP3_PLAY_BUFFERTOOSMALL : constant Integer := -1;
ALMP3_POLL_PLAYJUSTFINISHED : constant Integer := 1;
ALMP3_POLL_NOTPLAYING : constant Integer := -1;
ALMP3_POLL_FRAMECORRUPT : constant Integer := -2;
ALMP3_POLL_BUFFERUNDERRUN : constant Integer := -3;
ALMP3_POLL_INTERNALERROR : constant Integer := -4;
ALMP3_PLAY_SPEED_NORMAL : constant Integer := 1000;
type ALMP3_MP3 is private;
type A_mp3 is access all ALMP3_MP3;
type ALMP3_MP3STREAM is private;
type A_mp3stream is access all ALMP3_MP3STREAM;
function Almp3_Version return String;
pragma Postcondition( Almp3_Version'Result'Length > 0 );
function Create_mp3( data : Address; data_len : Natural ) return A_mp3;
pragma Postcondition( data /= Null_Address );
procedure Destroy_mp3( mp3 : in out A_mp3 );
pragma Postcondition( mp3 = null );
function Play_mp3( mp3 : not null A_mp3;
buffer_len : Natural;
vol : Volume_Type;
pan : Pan_Type
) return Integer;
function Play_Ex_mp3( mp3 : not null A_mp3;
buffer_len : Natural;
vol : Volume_Type;
pan : Pan_Type;
speed : Positive;
doloop : Boolean
) return Integer;
procedure Stop_mp3( mp3 : not null A_mp3 );
procedure Rewind_mp3( mp3 : not null A_mp3 );
procedure Seek_Abs_Frames_mp3( mp3 : not null A_mp3; frame : Natural );
procedure Seek_Abs_Msecs_mp3( mp3 : not null A_mp3; msecs : Natural );
procedure Seek_Abs_Secs_mp3( mp3 : not null A_mp3; secs : Natural );
procedure Seek_Abs_Bytes_mp3( mp3 : not null A_mp3; bytes : Natural );
procedure Seek_Rel_Frames_mp3( mp3 : not null A_mp3; frame : Integer );
procedure Seek_Rel_Msecs_mp3( mp3 : not null A_mp3; msec : Integer );
procedure Seek_Rel_Secs_mp3( mp3 : not null A_mp3; sec : Integer );
procedure Seek_Rel_Bytes_mp3( mp3 : not null A_mp3; bytes : Integer );
procedure Adjust_mp3( mp3 : not null A_mp3;
vol : Volume_Type;
pan : Pan_Type;
speed : Positive;
doloop : Natural );
function Poll_mp3( mp3 : not null A_mp3 ) return Integer;
procedure Start_Autopoll_mp3( mp3 : not null A_mp3; speed : Positive );
procedure Stop_Autopoll_mp3( mp3 : not null A_mp3 );
function Get_Pos_Frames_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Pos_Msecs_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Pos_Secs_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Pos_Bytes_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Length_Frames_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Length_Secs_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Length_Msecs_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Length_Bytes_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Msecs_Per_Frame_mp3( mp3 : A_mp3 ) return Natural;
function Get_Bitrate_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Layer_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Is_Stereo_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Wave_Bits_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Wave_Is_Stereo_mp3( mp3 : not null A_mp3 ) return Natural;
function Get_Wave_Freq_mp3( mp3 : not null A_mp3 ) return Natural;
function Create_Sample_From_mp3( mp3 : not null A_mp3 ) return A_Sample;
function Get_Output_Wave_mp3( mp3 : not null A_mp3;
buffer_size : access Natural
) return Address;
function Is_Playing_mp3( mp3 : not null A_mp3 ) return Natural;
function Is_Looping_mp3( mp3 : not null A_mp3 ) return Integer;
function Get_Audiostream_mp3( mp3 : not null A_mp3 ) return A_Audiostream;
function Create_mp3stream( first_data_buffer : Address;
data_buffer_len,
last_block : Natural
) return A_mp3stream;
pragma Precondition( first_data_buffer /= Null_Address );
function Create_mp3stream_Ex( first_data_buffer : Address;
data_buffer_len,
last_block,
downsample,
downmix : Natural
) return A_mp3stream;
pragma Precondition( first_data_buffer /= Null_Address );
procedure Destroy_mp3stream( mp3 : in out A_mp3stream );
pragma Postcondition( mp3 = null );
function Play_mp3stream( mp3 : not null A_mp3stream;
buffer_len : Natural;
vol : Volume_Type;
pan : Pan_Type ) return Integer;
function Play_Ex_mp3stream( mp3 : not null A_mp3stream;
buffer_len : Natural;
vol : Volume_Type;
pan : Pan_Type;
speed : Positive ) return Integer;
procedure Stop_mp3stream( mp3 : not null A_mp3stream );
procedure Adjust_mp3stream( mp3 : not null A_mp3stream;
vol : Volume_Type;
pan : Pan_Type;
speed : Positive );
function Poll_mp3stream( mp3 : not null A_mp3stream ) return Integer;
procedure Start_Autopoll_mp3stream( mp3 : not null A_mp3stream; speed : Positive );
procedure Stop_Autopoll_mp3stream( mp3 : not null A_mp3stream );
function Get_mp3stream_Buffer( mp3 : not null A_mp3stream ) return Address;
procedure Free_mp3stream_Buffer( mp3 : not null A_mp3stream; bytes_used : Integer );
function Get_Length_Frames_mp3stream( mp3 : not null A_mp3stream; total_size : Natural ) return Natural;
function Get_Length_Secs_mp3stream( mp3 : not null A_mp3stream; total_size : Natural ) return Natural;
function Get_Length_Msecs_mp3stream( mp3 : not null A_mp3stream; total_size : Natural ) return Natural;
function Get_Length_Bytes_mp3stream( mp3 : not null A_mp3stream; total_size : Natural ) return Natural;
function Get_Pos_Frames_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Pos_Msecs_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Pos_Secs_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Pos_Bytes_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Msecs_Per_Frame_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Bitrate_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Layer_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Is_Stereo_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Wave_Bits_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Wave_Is_Stereo_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Wave_Freq_mp3stream( mp3 : not null A_mp3stream ) return Natural;
function Get_Output_Wave_mp3stream( mp3 : not null A_mp3stream;
buffer_size : access Natural ) return Address;
function Is_Playing_mp3stream( mp3 : not null A_mp3stream ) return Integer;
function Get_Audiostream_mp3stream( mp3 : not null A_mp3stream ) return A_Audiostream;
function Seek_Abs_Frames_mp3stream( mp3 : not null A_mp3stream; frame, total_size : Natural ) return Natural;
function Seek_Abs_Msecs_mp3stream( mp3 : not null A_mp3stream; msecs, total_size : Natural ) return Natural;
function Seek_Abs_Secs_mp3stream( mp3 : not null A_mp3stream; msecs, total_size : Natural ) return Natural;
function Seek_Abs_Bytes_mp3stream( mp3 : not null A_mp3stream; bytes, total_size : Natural ) return Natural;
function Seek_Rel_Frames_mp3stream( mp3 : not null A_mp3stream; frame, total_size : Natural ) return Natural;
function Seek_Rel_Msecs_mp3stream( mp3 : not null A_mp3stream; msec, total_size : Natural ) return Natural;
function Seek_Rel_Secs_mp3stream( mp3 : not null A_mp3stream; sec, total_size : Natural ) return Natural;
function Seek_Rel_Bytes_mp3stream( mp3 : not null A_mp3stream; bytes, total_size : Natural ) return Natural;
private
type ALMP3_MP3 is null record;
type ALMP3_MP3STREAM is null record;
pragma Import( C, Create_mp3, "almp3_create_mp3" );
pragma Import( C, Play_mp3, "almp3_play_mp3" );
pragma Import( C, Stop_mp3, "almp3_stop_mp3" );
pragma Import( C, Rewind_mp3, "almp3_rewind_mp3" );
pragma Import( C, Seek_Abs_Frames_mp3, "almp3_seek_abs_frames_mp3" );
pragma Import( C, Seek_Abs_Msecs_mp3, "almp3_seek_abs_msecs_mp3" );
pragma Import( C, Seek_Abs_Secs_mp3, "almp3_seek_abs_secs_mp3" );
pragma Import( C, Seek_Abs_Bytes_mp3, "almp3_seek_abs_bytes_mp3" );
pragma Import( C, Seek_Rel_Frames_mp3, "almp3_seek_rel_frames_mp3" );
pragma Import( C, Seek_Rel_Msecs_mp3, "almp3_seek_rel_msecs_mp3" );
pragma Import( C, Seek_Rel_Secs_mp3, "almp3_seek_rel_secs_mp3" );
pragma Import( C, Seek_Rel_Bytes_mp3, "almp3_seek_rel_bytes_mp3" );
pragma Import( C, Adjust_mp3, "almp3_adjust_mp3" );
pragma Import( C, Poll_mp3, "almp3_poll_mp3" );
pragma Import( C, Start_Autopoll_mp3, "almp3_start_autopoll_mp3" );
pragma Import( C, Stop_Autopoll_mp3, "almp3_stop_autopoll_mp3" );
pragma Import( C, Get_Pos_Frames_mp3, "almp3_get_pos_frames_mp3" );
pragma Import( C, Get_Pos_Msecs_mp3, "almp3_get_pos_msecs_mp3" );
pragma Import( C, Get_Pos_Secs_mp3, "almp3_get_pos_secs_mp3" );
pragma Import( C, Get_Pos_Bytes_mp3, "almp3_get_pos_bytes_mp3" );
pragma Import( C, Get_Length_Frames_mp3, "almp3_get_length_frames_mp3" );
pragma Import( C, Get_Length_Secs_mp3, "almp3_get_length_secs_mp3" );
pragma Import( C, Get_Length_Msecs_mp3, "almp3_get_length_msecs_mp3" );
pragma Import( C, Get_Length_Bytes_mp3, "almp3_get_length_bytes_mp3" );
pragma Import( C, Get_Msecs_Per_Frame_mp3, "almp3_get_msecs_per_frame_mp3" );
pragma Import( C, Get_Bitrate_mp3, "almp3_get_bitrate_mp3" );
pragma Import( C, Get_Layer_mp3, "almp3_get_layer_mp3" );
pragma Import( C, Get_Is_Stereo_mp3, "almp3_get_is_stereo_mp3" );
pragma Import( C, Get_Wave_Bits_mp3, "almp3_get_wave_bits_mp3" );
pragma Import( C, Get_Wave_Is_Stereo_mp3, "almp3_get_wave_is_stereo_mp3" );
pragma Import( C, Get_Wave_Freq_mp3, "almp3_get_wave_freq_mp3" );
pragma Import( C, Create_Sample_From_mp3, "almp3_create_sample_from_mp3" );
pragma Import( C, Get_Output_Wave_mp3, "almp3_get_output_wave_mp3" );
pragma Import( C, Is_Playing_mp3, "almp3_is_playing_mp3" );
pragma Import( C, Is_Looping_mp3, "almp3_is_looping_mp3" );
pragma Import( C, Get_Audiostream_mp3, "almp3_get_audiostream_mp3" );
pragma Import( C, Create_mp3stream, "almp3_create_mp3stream" );
pragma Import( C, Create_mp3stream_Ex, "almp3_create_mp3stream_Ex" );
pragma Import( C, Play_mp3stream, "almp3_play_mp3stream" );
pragma Import( C, Play_Ex_mp3stream, "almp3_play_ex_mp3stream" );
pragma Import( C, Stop_mp3stream, "almp3_stop_mp3stream" );
pragma Import( C, Adjust_mp3stream, "almp3_adjust_mp3stream" );
pragma Import( C, Poll_mp3stream, "almp3_poll_mp3stream" );
pragma Import( C, Start_Autopoll_mp3stream, "almp3_start_autopoll_mp3stream" );
pragma Import( C, Stop_Autopoll_mp3stream, "almp3_stop_autopoll_mp3stream" );
pragma Import( C, Get_mp3stream_Buffer, "almp3_get_mp3stream_buffer" );
pragma Import( C, Free_mp3stream_Buffer, "almp3_free_mp3stream_buffer" );
pragma Import( C, Get_Length_Frames_mp3stream, "almp3_get_length_frames_mp3stream" );
pragma Import( C, Get_Length_Secs_mp3stream, "almp3_get_length_secs_mp3stream" );
pragma Import( C, Get_Length_Msecs_mp3stream, "almp3_get_length_msecs_mp3stream" );
pragma Import( C, Get_Length_Bytes_mp3stream, "almp3_get_length_bytes_mp3stream" );
pragma Import( C, Get_Pos_Frames_mp3stream, "almp3_get_pos_frames_mp3stream" );
pragma Import( C, Get_Pos_Msecs_mp3stream, "almp3_get_pos_msecs_mp3stream" );
pragma Import( C, Get_Pos_Secs_mp3stream, "almp3_get_pos_secs_mp3stream" );
pragma Import( C, Get_Pos_Bytes_mp3stream, "almp3_get_pos_bytes_mp3stream" );
pragma Import( C, Get_Msecs_Per_Frame_mp3stream, "almp3_get_msecs_per_frame_mp3stream" );
pragma Import( C, Get_Bitrate_mp3stream, "almp3_get_bitrate_mp3stream" );
pragma Import( C, Get_Layer_mp3stream, "almp3_get_layer_mp3stream" );
pragma Import( C, Get_Is_Stereo_mp3stream, "almp3_get_is_stereo_mp3stream" );
pragma Import( C, Get_Wave_Bits_mp3stream, "almp3_get_wave_bits_mp3stream" );
pragma Import( C, Get_Wave_Is_Stereo_mp3stream, "almp3_get_wave_is_stereo_mp3stream" );
pragma Import( C, Get_Wave_Freq_mp3stream, "almp3_get_wave_freq_mp3stream" );
pragma Import( C, Get_Output_Wave_mp3stream, "almp3_get_output_wave_mp3stream" );
pragma Import( C, Is_Playing_mp3stream, "almp3_is_playing_mp3stream" );
pragma Import( C, Get_Audiostream_mp3stream, "almp3_get_audiostream_mp3stream" );
pragma Import( C, Seek_Abs_Frames_mp3stream, "almp3_seek_abs_frames_mp3stream" );
pragma Import( C, Seek_Abs_Msecs_mp3stream, "almp3_seek_abs_msecs_mp3stream" );
pragma Import( C, Seek_Abs_Secs_mp3stream, "almp3_seek_abs_secs_mp3stream" );
pragma Import( C, Seek_Abs_Bytes_mp3stream, "almp3_seek_abs_bytes_mp3stream" );
pragma Import( C, Seek_Rel_Frames_mp3stream, "almp3_seek_rel_frames_mp3stream" );
pragma Import( C, Seek_Rel_Msecs_mp3stream, "almp3_seek_rel_msecs_mp3stream" );
pragma Import( C, Seek_Rel_Secs_mp3stream, "almp3_seek_rel_secs_mp3stream" );
pragma Import( C, Seek_Rel_Bytes_mp3stream, "almp3_seek_rel_bytes_mp3stream" );
end Almp3;