indexing description: "[ Implementation of a movie stream. Use this class to play an additional audiotrack in movies. ]" date: "$Date$" revision: "$Revision$" class EM_AUDIO_MOVIE_STREAM inherit EM_SHARED_AUDIO_FACTORY export {NONE} all end EM_AUDIO_STREAM export {NONE} all end create make feature {NONE} -- Initialization make (a_buffer: like buffer) is -- Create new movie stream instance. require a_buffer_exist: a_buffer /= Void local i: INTEGER do buffer := a_buffer create audio_none.make_new_unshared (audio_factory.audio_subsystem.mixer.chunk_size) from i := 0 until i >= audio_none.count loop audio_none.put (0, i) i := i + 1 end is_playing := false audio_factory.create_stream (Current, default_pointer) mix_pause_music_external ensure stopped: not is_playing end feature -- Playback start is -- Start playing. require stopped: not is_playing do is_playing := true mix_resume_music_external ensure playing: is_playing end stop is -- Stop playing. require playing: is_playing do mix_pause_music_external is_playing := false ensure stopped: not is_playing end feature -- Status is_playing: BOOLEAN feature {NONE} -- Implementation hook_music_function (a_userdata, a_stream: POINTER; a_length: INTEGER) is -- music playback function local ar: EM_INT8_ARRAY len: INTEGER do create ar.make_shared (a_stream, a_length) if is_playing then len := buffer.read_to (ar, a_length) if len < a_length then ar.copy_from_to_count (audio_none, len, a_length - len) end else ar.copy_from_count (audio_none, len) end end buffer: EM_BINARY_RING_BUFFER audio_none: EM_INT8_ARRAY -- No audio invariant buffer_exist: buffer /= Void audio_none_exist: audio_none /= Void end