note
	description: "Class that holds information for a sound and fills a buffer to play it."
	author: "Émilio G!"
	adaptation: "Louis Marchand"
	date: "Tue, 21 Feb 2017 00:15:23 +0000"
	revision: "1.0"
	legal: "See notice at end of class."

class interface
	AUDIO_SOUND_CUSTOM

create 
	make,
	make_from_other

feature 

	buffer_index: INTEGER_32
			--usefull in fill_buffer

	sound_data: MANAGED_POINTER
			--data that is readable by the library

	sound_length: INTEGER_32
			--length in samples

	Channel_count: INTEGER_32 = 1
			-- Get the channel number of Current (1=mono, 2=stereo, etc.).

	Frequency: INTEGER_32 = 44100
			-- in samples per second

	Bits_per_sample: INTEGER_32 = 16
			-- Get the bit resolution of one frame of Current.

	Is_signed: BOOLEAN = True
			-- is sound_data signed

	byte_per_buffer_sample: INTEGER_32
			-- equals to number_of_channels * (bits_per_sample // 8)

	Is_seekable: BOOLEAN = False
			-- Useless in this class, but needed to inherit from AUDIO_SOUND

	restart
			--sets buffer_index to 0 so the sound plays normally when prompted again

	Is_openable: BOOLEAN = True
			-- Can Current be open

	open
			--nothing. This is actually useless but necessary to inherit from AUDIO_SOUND.

	close
			-- Stop the management of the stream

	sample_seek (a_frame_number: INTEGER_64)
			-- Seek at the frame a_frame_number from the beginning of Current
			-- Seek at the frame a_frame_number from the beginning of Current

	sample_position: INTEGER_64
			-- The number of frames since the beginning of Current
		require else
			can_position: True

	sample_count: INTEGER_64
			-- The total number of frames in Current
		require else
			can_position: True
	
invariant
	buffer_index_not_retarded: 0 <= buffer_index and buffer_index <= sound_length * byte_per_buffer_sample
	buffer_index_even: buffer_index \\ 2 = 0

note
	license: "GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 | Copyright (c) 2016 Émilio Gonzalez and Guillaume Jean"
	source: "[url: https://www.gnu.org/licenses/gpl-3.0.html]"

end -- class AUDIO_SOUND_CUSTOM

Generated by ISE EiffelStudio