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

em.audio

Class EM_PLAYLIST



Creation

Features

Invariants

indexing

description

Implements a playlist for loading filenames.

Use this class to store multiple filenames in a list, as files
can be searched on creation.

This class was designed for having file loading support in a hurry.
We recommend to use it whenever you need to find multiple files.

Note: If you use {EM_MUSIC_PLAYER} and/or {EM_SOUND_PLAYER}, you
don't need such a playlist as both players already have their own.

date

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

revision

$Revision: 1.10 $

class

EM_PLAYLIST

create

make_with_path (a_path: STRING; an_extension_list: DS_LINKED_LIST [STRING]; do_recursive_search: BOOLEAN)

-- Make playlist from a_path with files having an extension
-- like one element in an_extension_list.
-- If you also want to search file in subfolders, please use
-- do_recursive_search.

require
a_path_not_void: a_path /= Void
make_with_list (a_list: DS_LINKED_LIST [STRING])

-- Make playlist from a_list.

make_with_file (a_filename: STRING)

-- Make with a_filename.

require
a_filename_not_void: a_filename /= Void
ensure
count_is_one: count = 1
make_empty

-- Create empty playlist.

feature -- Initialization

make_empty

-- Create empty playlist.

make_with_file (a_filename: STRING)

-- Make with a_filename.

require
a_filename_not_void: a_filename /= Void
ensure
count_is_one: count = 1
make_with_list (a_list: DS_LINKED_LIST [STRING])

-- Make playlist from a_list.

make_with_path (a_path: STRING; an_extension_list: DS_LINKED_LIST [STRING]; do_recursive_search: BOOLEAN)

-- Make playlist from a_path with files having an extension
-- like one element in an_extension_list.
-- If you also want to search file in subfolders, please use
-- do_recursive_search.

require
a_path_not_void: a_path /= Void

feature -- Access

count: INTEGER

-- Number of playlist entries

has (an_element: like item): BOOLEAN

-- Is an_element already in the list?

index: INTEGER

-- Current index

item: STRING

-- Current selected playlist entry

position (an_element: like item): INTEGER

-- Position of an_element if found or 0 if not found.

feature -- Operations

back: STRING

-- Previous element in playlist

extend (a_filename: STRING)

-- Extend playlist with a_filename.
-- New entries are inserted at the end.

require
filename_not_void: a_filename /= Void
ensure
inserted: internal_list.has (a_filename)
count_increased: count = old count + 1
get_i_th (an_index: INTEGER): STRING

-- Element at an_index from playlist

require
an_index_is_valid: an_index <= count and an_index > 0
insert (a_filename: STRING; an_index: INTEGER)

-- Insert a_filename at position an_index.

require
filename_not_void: a_filename /= Void
index_valid: 1 <= an_index and then an_index <= count
ensure
inserted: internal_list.item (an_index).is_equal (a_filename)
: STRING

-- Next element in playlist

remove (a_filename: STRING)

-- Removes a_filename from playlist.

require
filename_not_void: a_filename /= Void
ensure
removed: not internal_list.has (a_filename)
wipe_out

-- Remove all playlist entries.

ensure
wiped_out: count = 0

feature -- File search

search_directory (a_path: STRING; an_extension_list: DS_LINKED_LIST [STRING]; do_recursive_search: BOOLEAN): DS_LINKED_LIST [STRING]

-- Search a_path in a do_recursive_search way for audio files
-- with an extension in an_extension_list.
--
-- Note: Recursive search may take long time, if there are many subfolders.
-- Links are not followed by recursive search.

require
a_path_not_void: a_path /= Void

invariant

internal_list_created: internal_list /= Void
cursor_created: cursor /= Void

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

end