Async 1.8.0
Async::AudioContainer Class Referenceabstract

#include <AsyncAudioContainer.h>

Inheritance diagram for Async::AudioContainer:
Async::AudioSink Async::AudioContainerOpus Async::AudioContainerPcm Async::AudioContainerWav

Public Member Functions

 AudioContainer (void)
 Default constructor.
 
 AudioContainer (const AudioContainer &)=delete
 Disable copy constructor.
 
AudioContaineroperator= (const AudioContainer &)=delete
 Disable assignment operator.
 
virtual ~AudioContainer (void)
 Destructor.
 
virtual const char * mediaType (void) const =0
 Retrieve the media type for the audio container.
 
virtual const char * filenameExtension (void) const =0
 Get the standard filename extension for the audio container.
 
virtual void setRealtime (void)
 Indicate to the container that realtime operation is desired.
 
virtual void endStream (void)
 Indicate to the container that the stream has ended.
 
virtual size_t headerSize (void) const
 Get the size of the header for this container.
 
virtual const char * header (void)
 Get the header data.
 
- Public Member Functions inherited from Async::AudioSink
 AudioSink (void)
 Default constuctor.
 
virtual ~AudioSink (void)
 Destructor.
 
bool registerSource (AudioSource *source)
 Register an audio source to provide samples to this sink.
 
void unregisterSource (void)
 Unregister the previously registered audio source.
 
bool isRegistered (void) const
 Check if an audio source has been registered.
 
AudioSourcesource (void) const
 Get the registered audio source.
 
virtual int writeSamples (const float *samples, int count)
 Write samples into this audio sink.
 
virtual void flushSamples (void)
 Tell the sink to flush the previously written samples.
 

Public Attributes

sigc::signal< void, const char *, size_t > writeBlock
 A signal that is emitted when a block is ready to be written.
 

Additional Inherited Members

- Protected Member Functions inherited from Async::AudioSink
void sourceResumeOutput (void)
 Tell the source that we are ready to accept more samples.
 
void sourceAllSamplesFlushed (void)
 Tell the source that all samples have been flushed.
 
bool setHandler (AudioSink *handler)
 Setup another sink to handle the incoming audio.
 
void clearHandler (void)
 Clear a handler that was previously setup with setHandler.
 
AudioSinkhandler (void) const
 

Detailed Description

Examples
AsyncAudioContainer_demo.cpp.

Definition at line 135 of file AsyncAudioContainer.h.

Constructor & Destructor Documentation

◆ AudioContainer() [1/2]

Async::AudioContainer::AudioContainer ( void )
inline

Default constructor.

Definition at line 141 of file AsyncAudioContainer.h.

◆ AudioContainer() [2/2]

Async::AudioContainer::AudioContainer ( const AudioContainer & )
delete

Disable copy constructor.

◆ ~AudioContainer()

virtual Async::AudioContainer::~AudioContainer ( void )
inlinevirtual

Destructor.

Definition at line 156 of file AsyncAudioContainer.h.

Member Function Documentation

◆ endStream()

virtual void Async::AudioContainer::endStream ( void )
inlinevirtual

Indicate to the container that the stream has ended.

This function should be called when the stream has ended. The container can then flush the last samples in any buffers and maybe write an end record if applicable. All this will happen through the writeBlock signal.

Reimplemented in Async::AudioContainerOpus.

Definition at line 188 of file AsyncAudioContainer.h.

References Async::AudioSink::flushSamples().

◆ filenameExtension()

virtual const char * Async::AudioContainer::filenameExtension ( void ) const
pure virtual

Get the standard filename extension for the audio container.

Returns
Returns a string containing the filename extention, e.g. wav

Implemented in Async::AudioContainerOpus, Async::AudioContainerPcm, and Async::AudioContainerWav.

Examples
AsyncAudioContainer_demo.cpp.

◆ header()

virtual const char * Async::AudioContainer::header ( void )
inlinevirtual

Get the header data.

Returns
Return a pointer to the header data

This function is normally called as the last thing before closing a file in order to write the header to the beginning of the file. This of course requires that space have been reserved as described in the documentation for the headerSize function.

Reimplemented in Async::AudioContainerOpus, and Async::AudioContainerWav.

Definition at line 209 of file AsyncAudioContainer.h.

◆ headerSize()

virtual size_t Async::AudioContainer::headerSize ( void ) const
inlinevirtual

Get the size of the header for this container.

Returns
Returns the size of the header

This function is normally called directly after opening a file to reserve space for writing the header later, usually as the last thing before closing the file.

Reimplemented in Async::AudioContainerOpus, and Async::AudioContainerWav.

Definition at line 198 of file AsyncAudioContainer.h.

◆ mediaType()

virtual const char * Async::AudioContainer::mediaType ( void ) const
pure virtual

Retrieve the media type for the audio container.

Returns
Returns a string representing the media type, e.g. audio/wav

Implemented in Async::AudioContainerOpus, Async::AudioContainerPcm, and Async::AudioContainerWav.

◆ operator=()

AudioContainer & Async::AudioContainer::operator= ( const AudioContainer & )
delete

Disable assignment operator.

◆ setRealtime()

virtual void Async::AudioContainer::setRealtime ( void )
inlinevirtual

Indicate to the container that realtime operation is desired.

This function can be called to inidicate to the container that we are writing the audio to a realtime stream rather than to a file. The container can then choose to indicate this in the audio stream if it have that capability.

Reimplemented in Async::AudioContainerWav.

Definition at line 178 of file AsyncAudioContainer.h.

Member Data Documentation

◆ writeBlock

sigc::signal<void, const char*, size_t> Async::AudioContainer::writeBlock

A signal that is emitted when a block is ready to be written.

Parameters
bufPointer to a buffer containing the data block
lenThe size of the data block

This signal is emitted each time that the container want to write data. The application should connect to this signal i order to write the data to file or whatever the destination is.

Definition at line 220 of file AsyncAudioContainer.h.


The documentation for this class was generated from the following file: