Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.audio

Class EM_MIXER


Direct ancestors

EM_SHARED_ERROR_HANDLER, EM_AUDIO_CONSTANTS, SDL_MIXER_FUNCTIONS_EXTERNAL, MEMORY

Creation

Features

Invariants

indexing

description

Implements a mixer for playing audio files.

This is like a base for all audio stuff and should be
accessed by {EM_AUDIO_SUBSYSTEM}.

This class opens a audio device with output settings.
If you don't know what settings are best, use default
ones from {EM_AUDIO_CONSTANTS}.

date

$Date: 2005/10/22 13:22:42 $

revision

$Revision: 1.22 $

class

EM_MIXER

create

make

-- Create new mixer instance.

ensure
is_closed: not is_open

feature {EM_AUDIO_SUBSYSTEM} -- Initialization

make

-- Create new mixer instance.

ensure
is_closed: not is_open

feature -- Access

channels: EM_CHANNELS

-- Mixing channels

require
open: is_open
chunk_size: INTEGER

-- Mixer chunk size.

require
mixer_open: is_open
format: INTEGER

-- Mixer output format

require
mixer_open: is_open
frequency: INTEGER

-- Mixer output frequency

require
mixer_open: is_open
output_channel: INTEGER

-- Mixer output channel

require
mixer_open: is_open

feature -- Removal

dispose

-- Free up resources.

-- (From DISPOSABLE)

feature -- Basic mixer operations

close

-- Close mixer instance.

require
is_open: is_open
ensure
is_closed: not is_open
open (a_frequency: INTEGER; a_format: INTEGER; a_channel: INTEGER; a_chunk_size: INTEGER)

-- Open mixer instance with
-- a_frequency = Output sampling frequency.
-- a_format = Output sample format.
-- a_channel = Number of sound channels in output.
-- Note: This has nothing to do with mixing channels!
-- a_chunk_size = Bytes used per output sample.
--
-- If unsure, use the following settings for good performance.
-- a_frequency = Em_default_frequency (22050 Hz).
-- a_format = Em_audio_format_s16sys.
-- a_channel = Em_stereo.
-- a_chunk_size = Em_default_chunk_size (4096 Bytes).

require
is_closed: not is_open
ensure
is_open: is_open
open_default

-- Open mixer instance with default values.

ensure
is_open: is_open

feature -- Event

on_before_close: EM_EVENT_TYPE [TUPLE []]

-- Event fired when mixer is going to be closed.

feature -- Informations

is_open: BOOLEAN

-- Is mixer open?

feature -- Default constants

em_max_volume: INTEGER

-- Maximum value for any volume setting.

-- (From EM_AUDIO_CONSTANTS)

invariant

internal_channels_created: internal_channels /= Void

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end