Main Page | Namespace List | Class Hierarchy | Class List | Directories | Namespace Members | Class Members

EWFFILE Class Reference

Ecasound Wave File - a simple wrapper class for handling other audio objects. More...

Inheritance diagram for EWFFILE:

AUDIO_IO_PROXY AUDIO_IO DYNAMIC_OBJECT< string > ECA_AUDIO_FORMAT ECA_AUDIO_POSITION DYNAMIC_PARAMETERS< string > ECA_OBJECT ECA_SAMPLERATE_AWARE ECA_SAMPLERATE_AWARE List of all members.

Public Member Functions

Public functions
 EWFFILE (const std::string &name="")
Reimplemented functions from ECA_OBJECT
virtual std::string name (void) const
 Object name used to identify the object type.
virtual std::string description (void) const
 Object description.
Reimplemented functions from DYNAMIC_OBJECT<string>
virtual EWFFILEclone (void) const
 Virtual method that clones the current object and returns a pointer to it.
virtual EWFFILEnew_expr (void) const
 Virtual method that creates a new object of current type.
Reimplemented functions from ECA_AUDIO_POSITION
virtual void seek_position (void)
Reimplemented functions from AUDIO_IO
virtual bool locked_audio_format (void) const
 Whether audio format is locked.
virtual bool supports_seeking (void) const
 Whether device supports non-blocking I/O mode.
virtual bool finite_length_stream (void) const
 Whether audio stream has a distinct length.
virtual bool finished (void) const
 Whether all data has been processed? If opened in mode 'io_read', this means that end of stream has been reached.
virtual void read_buffer (SAMPLE_BUFFER *sbuf)
virtual void write_buffer (SAMPLE_BUFFER *sbuf)
 Writes all data from sample buffer pointed by 'sbuf' to this object.
virtual void open (void) throw (AUDIO_IO::SETUP_ERROR&)
 Opens the audio object (possibly in exclusive mode).
virtual void close (void)
 Closes audio object.
New functions
void child_offset (const ECA_AUDIO_TIME &v)
 Set start offset for child object.
void child_start_position (const ECA_AUDIO_TIME &v)
 Set start position inside child object.
void child_length (const ECA_AUDIO_TIME &v)
 Set child length.
void toggle_looping (bool v)
 Toggle whether child object data is looped.

Detailed Description

Ecasound Wave File - a simple wrapper class for handling other audio objects.

When writing .ewf files, it's possible to seek beyond end position. When first write_buffer() call is issued, current sample offset is stored into the .ewf file and corresponding child object is opened for writing. Read_buffer() calls return silent buffers until sample_offset is reached. After that, audio object is processed normally. Similarly .ewf supports audio relocation, looping, etc...

Related design patterns:

Author:
Kai Vehmanen


Member Function Documentation

void EWFFILE::child_length const ECA_AUDIO_TIME v  ) 
 

Set child length.

If not set, defaults to the total length.

EWFFILE * EWFFILE::clone void   )  const [virtual]
 

Virtual method that clones the current object and returns a pointer to it.

This must be implemented by all subclasses!

Reimplemented from AUDIO_IO_PROXY.

void EWFFILE::close void   )  [virtual]
 

Closes audio object.

After calling this routine, all resources (for instance files and devices) must be freed so that they can be used by other processes.

Precondition:
is_open() == true
Postcondition:
readable() != true

writable() != true

Reimplemented from AUDIO_IO.

virtual std::string EWFFILE::description void   )  const [inline, virtual]
 

Object description.

Description should be short, informative and unformatted.

Reimplemented from AUDIO_IO_PROXY.

bool EWFFILE::finished void   )  const [virtual]
 

Whether all data has been processed? If opened in mode 'io_read', this means that end of stream has been reached.

If opened in 'io_write' or 'io_readwrite' modes, finished status usually means that an error has occured (no space left, etc). After finished() has returned 'true', further calls to read_buffer() and/or write_buffer() won't process any data.

For output for which 'finite_length_stream()' is true, when 'finished()' returns true, that means an error has occured. Otherwise 'finished()' just tells that further attempts to do i/o will fail.

Reimplemented from AUDIO_IO_PROXY.

virtual bool EWFFILE::finite_length_stream void   )  const [inline, virtual]
 

Whether audio stream has a distinct length.

It's important to note the difference between this attribute and 'supports_seeking()'. For example, a file read through a pipe mechanism is not seekable and its length is not known until 'finished()´ becomes true, but still, it is of finite length. A sine oscillator on the other hand can go on producing a signal forever, and is thus infinite.

This attributes directly affects how 'finished()' should to be interpreted.

See also:
finished().
By default, audio streams are finite length.

Reimplemented from AUDIO_IO_PROXY.

virtual bool EWFFILE::locked_audio_format void   )  const [inline, virtual]
 

Whether audio format is locked.

If this is true, audio object has a known audio format, and doesn't allow overriding it.

By default, audio format is not locked.

Reimplemented from AUDIO_IO_PROXY.

virtual std::string EWFFILE::name void   )  const [inline, virtual]
 

Object name used to identify the object type.

In most cases, object name is same for all class instances. Must be implemented in all subclasses.

Reimplemented from AUDIO_IO_PROXY.

virtual EWFFILE* EWFFILE::new_expr void   )  const [inline, virtual]
 

Virtual method that creates a new object of current type.

This must be implemented by all subclasses!

Reimplemented from AUDIO_IO_PROXY.

void EWFFILE::open void   )  throw (AUDIO_IO::SETUP_ERROR&) [virtual]
 

Opens the audio object (possibly in exclusive mode).

This routine is used for initializing external connections (opening files or devices, loading shared libraries, opening IPC connections). As it's impossible to know in advance what might happen, open() may throw an exception. This way it becomes possible to provide more verbose information about the problem that caused open() to fail.

At this point the various audio parameters are used for the first time. Unless locked_audio_format() is 'true', object tries to use the audio format parameters set prior to this call. If object doesn't support the given parameter combination, it can either try adjust them to closest matching, or in the worst case, throw an SETUP_ERROR exception (see above).

Precondition:
is_open() != true
Postcondition:
readable() == true || writable() == true || is_open() != true

Reimplemented from AUDIO_IO.

void EWFFILE::read_buffer SAMPLE_BUFFER sbuf  )  [virtual]
 

implementation notes:

position: the current global position child offset: global position when child is activated child start position: position inside the child-object where input is started (data between child beginning and child_start_pos is not used) child length: amount child data that is used beginning from child's start position child looping: when child end is reaches, whether to jump back to start position?

note! all cases (if-else blocks) end to setting a new position_in_samples value

Reimplemented from AUDIO_IO_PROXY.

virtual bool EWFFILE::supports_seeking void   )  const [inline, virtual]
 

Whether device supports non-blocking I/O mode.

By default, seeking is supported.

Reimplemented from AUDIO_IO_PROXY.

void EWFFILE::write_buffer SAMPLE_BUFFER sbuf  )  [virtual]
 

Writes all data from sample buffer pointed by 'sbuf' to this object.

Notes concerning read_buffer() also apply to this routine.

Note! The implementations should call set_position_in_samples() or change_position_in_samples() in ECA_AUDIO_POSITION.

Precondition:
io_mode() == io_write || io_mode() == io_readwrite

writable() == true

sbuf != 0

Reimplemented from AUDIO_IO_PROXY.


The documentation for this class was generated from the following files:
Generated on Fri Apr 8 01:38:01 2005 for libecasound by  doxygen 1.4.1