indexing description: "[ EiffelMedia audio effects example. Plays a sound file with an echo effect. ]" date: "$Date$" revision: "$Revision$" class EFFECTS inherit EM_SHARED_SUBSYSTEMS export {NONE} all end EM_SHARED_AUDIO_FACTORY export {NONE} all end EM_AUDIO_CONSTANTS export {NONE} all end KL_SHARED_FILE_SYSTEM export {NONE} all end KL_SHARED_EXECUTION_ENVIRONMENT export {NONE} all end create make feature -- Initialization make is -- This example shows how to use effects. -- As there is nothing else using CPU resources, -- this example shows how to set better values as -- standard ones. local echo: EM_ECHO_EFFECT do -- Initialize audio subsystem audio_subsystem.enable if audio_subsystem.is_enabled then -- Open mixer with a frequency of 44.1 kHz audio_subsystem.mixer.open (44100, Em_audio_format_s16sys, Em_stereo, Em_default_chunk_size) audio_subsystem.mixer.channels.extend (1) -- Create echo instance create echo.make (2000, 0.4) audio_subsystem.mixer.channels.i_th (1).register_effect (echo, default_pointer) -- Load sound and play audio_factory.create_sound_from_file (sound_directory + "/channel_0.ogg") audio_subsystem.mixer.channels.i_th (1).play (audio_factory.last_sound, -1) -- Prevent window from closing io.put_string ("You should now hear drums with an echo effect! Press Return to quit!%N") io.read_line -- Halt and free up resources audio_subsystem.mixer.channels.i_th (1).stop audio_subsystem.mixer.channels.i_th (1).unregister_all_effects audio_subsystem.disable else io.put_string ("Audio subsystem could not be enabled!%N") end end feature {NONE} -- Implementation sound_directory: STRING is -- Sound directory once Result := file_system.pathname_from_file_system ("$EM/example/resources/sound", unix_file_system) Result := execution_environment.interpreted_string (Result) if not file_system.directory_exists (Result) then Result := "." end end end