sourCEntral - mobile manpages

pdf

ost::AudioStream

NAME

ost::AudioStream − AudioStream accesses AudioFile base class content as fixed frames of streaming linear samples.

SYNOPSIS

#include <audio2.h>

Inherits ost::AudioFile.

Public Member Functions

AudioStream ()
Create a new audiostream object.

AudioStream
(const char *name, Mode mode=modeRead, timeout_t framing=0)
Create an audio stream object and open an existing audio file.

AudioStream
(const char *name, Info *info, bool exclusive=false, timeout_t framing=0)
Create an audio stream object and a new audio file.

virtual ~AudioStream ()
ssize_t getBuffer (Encoded data, size_t count)
Virtual for packet i/o intercept.

void open (const char *name, Mode mode=modeRead, timeout_t framing=0)
Open existing audio file for streaming.

void create (const char *name, Info *info, bool exclusive=false, timeout_t framing=0)
Create a new audio file for streaming.

void close (void)
Close the currently open audio file for streaming.

void flush (void)
flush any unsaved buffered data to disk.

bool isStreamable (void)
Check if the audio file may be streamed.

unsigned getCount (void)
Get the number of samples expected in a frame.

unsigned getEncoded (AudioCodec *codec, Encoded address, unsigned frames=1)
Stream audio data from the file and convert into an alternate encoding based on the codec supplied.

unsigned putEncoded (AudioCodec *codec, Encoded address, unsigned frames=1)
Stream audio data in an alternate codec into the currently opened file.

unsigned getEncoded (Encoded address, unsigned frames=1)
Get data from the streamed file in it’s native encoding.

unsigned putEncoded (Encoded address, unsigned frames=1)
Put data encoded in the native format of the stream file.

ssize_t getPacket (Encoded data)
Get a packet of data from the file.

unsigned getMono (Linear buffer, unsigned frames=1)
Get and automatically convert audio file data into mono linear audio samples.

unsigned getStereo (Linear buffer, unsigned frames=1)
Get and automatically convert audio file data into stereo (two channel) linear audio samples.

unsigned putMono (Linear buffer, unsigned frames=1)
Automatically convert and put mono linear audio data into the audio file.

unsigned putStereo (Linear buffer, unsigned frames=1)
Automatically convert and put stereo linear audio data into the audio file.

unsigned bufMono (Linear buffer, unsigned count)
Automatically convert and put arbitrary linear mono data into the audio file.

unsigned bufStereo (Linear buffer, unsigned count)
Automatically convert and put arbitrary linear stereo data into the audio file.

AudioCodec
* getCodec (void)
Return the codec being used if there is one.

Protected Member Functions

unsigned bufAudio (Linear samples, unsigned count, unsigned size)

Protected Attributes

AudioCodec * codec
Encoded framebuf

bool streamable
Linear bufferFrame

unsigned bufferPosition
unsigned bufferChannels
Linear encBuffer
Linear decBuffer

unsigned encSize
unsigned decSize

Detailed Description

AudioStream accesses AudioFile base class content as fixed frames of streaming linear samples.

If a codec must be assigned to perform conversion to/from linear data, AudioStream will handle conversion automatically. AudioStream will also convert between mono and stereo audio content. AudioStream uses linear samples in the native machine endian format and perform endian byte swapping as needed.

Author:

David Sugar <dyfet AT ostel DOT com> Audio Streaming with Linear Conversion

Constructor & Destructor Documentation

ost::AudioStream::AudioStream ()
Create a new audiostream object.

ost::AudioStream::AudioStream (const char * name, Mode mode = modeRead, timeout_t framing = 0)
Create an audio stream object and open an existing audio file.

Parameters:

name of file to open.
mode
of file access.
framing
time in milliseconds.

ost::AudioStream::AudioStream (const char * name, Info * info, bool exclusive = false, timeout_t framing = 0)
Create an audio stream object and a new audio file.

Parameters:

name of file to open.
info
source description for properties of new file.
exclusive
access if true.
framing
time in milliseconds.

virtual ost::AudioStream::~AudioStream () [virtual]

Member Function Documentation

unsigned ost::AudioStream::bufAudio (Linear samples, unsigned count, unsigned size) [protected]
ssize_t ost::AudioStream::getBuffer (Encoded data, size_t count)
[virtual]
Virtual for packet i/o intercept.

Returns:

bytes read.

Parameters:

data encoding buffer.
count
requested.

Reimplemented from ost::AudioFile.

void ost::AudioStream::open (const char * name, Mode mode = modeRead, timeout_t framing = 0)
Open existing audio file for streaming.

Parameters:

name of file to open.
mode
to use file.
framing
timer in milliseconds.

Reimplemented from ost::AudioFile.

void ost::AudioStream::create (const char * name, Info * info, bool exclusive = false, timeout_t framing = 0)
Create a new audio file for streaming.

Parameters:

name of file to create.
info
source description for file properties.
exclusive
true for exclusive access.
framing
timing in milliseconds.

Reimplemented from ost::AudioFile.

void ost::AudioStream::close (void)
Close the currently open audio file for streaming.

Reimplemented from ost::AudioFile.

void ost::AudioStream::flush (void)
flush any unsaved buffered data to disk.

bool ost::AudioStream::isStreamable (void)
Check if the audio file may be streamed.

Files can be streamed if a codec is available or if they are linear.

Returns:

true if streamable.

unsigned ost::AudioStream::getCount (void)
Get the number of samples expected in a frame.

unsigned ost::AudioStream::getEncoded (AudioCodec * codec, Encoded address, unsigned frames = 1)
Stream audio data from the file and convert into an alternate encoding based on the codec supplied.

Parameters:

codec to apply before saving.
address
of data to save.
frames
to stream by the codec.

Returns:

number of frames processed.

unsigned ost::AudioStream::putEncoded (AudioCodec * codec, Encoded address, unsigned frames = 1)
Stream audio data in an alternate codec into the currently opened file.

Parameters:

codec to convert incoming data from.
address
of data to convert and stream.
frames
of audio to stream.

Returns:

number of frames processed.

unsigned ost::AudioStream::getEncoded (Encoded address, unsigned frames = 1)
Get data from the streamed file in it’s native encoding.

Parameters:

address to save encoded audio.
frames
of audio to load.

Returns:

number of frames read.

unsigned ost::AudioStream::putEncoded (Encoded address, unsigned frames = 1)
Put data encoded in the native format of the stream file.

Parameters:

address to load encoded audio.
frames
of audio to save.

Returns:

number of frames written.

ssize_t ost::AudioStream::getPacket (Encoded data)
Get a packet of data from the file.

This uses the codec to determine what a true packet boundry is.

Parameters:

buffer to save encoded data.

Returns:

number of bytes read as packet.

Reimplemented from ost::AudioBase.

unsigned ost::AudioStream::getMono (Linear buffer, unsigned frames = 1)
Get and automatically convert audio file data into mono linear audio samples.

Parameters:

buffer to save linear audio into.
frames
of audio to read.

Returns:

number of frames read from file.

unsigned ost::AudioStream::getStereo (Linear buffer, unsigned frames = 1)
Get and automatically convert audio file data into stereo (two channel) linear audio samples.

Parameters:

buffer to save linear audio into.
frames
of audio to read.

Returns:

number of frames read from file.

unsigned ost::AudioStream::putMono (Linear buffer, unsigned frames = 1)
Automatically convert and put mono linear audio data into the audio file.

Convert to stereo as needed by file format.

Parameters:

buffer to save linear audio from.
frames
of audio to write.

Returns:

number of frames written to file.

unsigned ost::AudioStream::putStereo (Linear buffer, unsigned frames = 1)
Automatically convert and put stereo linear audio data into the audio file.

Convert to mono as needed by file format.

Parameters:

buffer to save linear audio from.
frames
of audio to write.

Returns:

number of frames written to file.

unsigned ost::AudioStream::bufMono (Linear buffer, unsigned count)
Automatically convert and put arbitrary linear mono data into the audio file.

Convert to stereo and buffer incomplete frames as needed by the streaming file.

Parameters:

buffer to save linear audio from.
count
of linear audio to write.

Returns:

number of linear audio samples written to file.

unsigned ost::AudioStream::bufStereo (Linear buffer, unsigned count)
Automatically convert and put arbitrary linear stereo data into the audio file.

Convert to mono and buffer incomplete frames as needed by the streaming file.

Parameters:

buffer to save linear audio from.
count
of linear audio to write.

Returns:

number of linear audio samples written to file.

AudioCodec* ost::AudioStream::getCodec (void) [inline]
Return the codec being used if there is one.

Returns:

codec used.

Reimplemented from ost::AudioFile.

Member Data Documentation

AudioCodec* ost::AudioStream::codec [protected]
Encoded ost::AudioStream::framebuf
[protected]
bool ost::AudioStream::streamable
[protected]
Linear ost::AudioStream::bufferFrame
[protected]
unsigned ost::AudioStream::bufferPosition
[protected]
unsigned ost::AudioStream::bufferChannels
[protected]
Linear ost::AudioStream::encBuffer
[protected]
Linear ost::AudioStream::decBuffer
[protected]
unsigned ost::AudioStream::encSize
[protected]
unsigned ost::AudioStream::decSize
[protected]

Author

Generated automatically by Doxygen for ccAudio from the source code.

pdf