indexing description: "[ Class for wrapping C SDL_CDtrack struct. ]" date: "$Date$" revision: "$Revision$" class EM_CDROM_TRACK inherit EM_CONSTANTS export {NONE} all end SDL_CDTRACK_STRUCT_EXTERNAL export {NONE} all end EWG_STRUCT create make_new_shared, make_shared feature -- Implementation sizeof: INTEGER is do Result := sizeof_external end feature {ANY} -- Member Access track_number: INTEGER is -- track number require exists: exists do result := get_id_external (item) ensure result_correct: result = get_id_external (item) end is_audio_track: BOOLEAN is -- is this track an audio track? require exists: exists do if get_type_external (item) = em_cdrom_audio_track then result := true end ensure result_correct: result implies get_type_external (item) = em_cdrom_audio_track end is_data_track: BOOLEAN is -- is this track a data track? require exists: exists do if get_type_external (item) = em_cdrom_data_track then result := true end ensure result_correct: result implies get_type_external (item) = em_cdrom_data_track end type: INTEGER is -- return the type of this track (use is_data_track or is_audio_track) require exists: exists do result := get_type_external (item) ensure result_correct: result = get_type_external (item) end length: INTEGER is -- length of this track in seconds require exists: exists do result := get_length_external (item) // em_cdrom_fps ensure result_correct: result = get_length_external (item) // em_cdrom_fps end length_string: STRING is -- return an human readable length string (hh:mm:ss) require exists: exists local len: INTEGER hours, minutes, seconds: INTEGER do create result.make_empty len := length seconds := len \\ 60 minutes := (len // 60) \\ 60 hours := (len // 3600) \\ 60 -- format the time in a human readable form (hh:mm:ss) if hours < 10 then result := "0" end result := result + hours.out + ":" if minutes < 10 then result := result + "0" end result := result + minutes.out + ":" if seconds < 10 then result := result + "0" end result := result + seconds.out end offset: INTEGER is -- time in seconds elapsed since track began require exists: exists do result := get_offset_external (item) // em_cdrom_fps ensure result_correct: result = get_offset_external (item) // em_cdrom_fps end offset_string: STRING is -- return an human readable offset string (hh:mm:ss) require exists: exists local len: INTEGER hours, minutes, seconds: INTEGER do create result.make_empty len := offset seconds := len \\ 60 minutes := (len // 60) \\ 60 hours := (len // 3600) \\ 60 -- format the time in a human readable form (hh:mm:ss) if hours < 10 then result := "0" end result := result + hours.out + ":" if minutes < 10 then result := result + "0" end result := result + minutes.out + ":" if seconds < 10 then result := result + "0" end result := result + seconds.out end end