SoundFrame Class Reference

Please document me. More...

#include <SoundFrame.h>

List of all members.

Public Member Functions

jack_time_t FrameTime ()
jack_default_audio_sample_t * GetSamples () const
SoundFrameoperator*= (float scalar)
SoundFrameoperator*= (const SoundFrame &f)
SoundFrameoperator+= (const SoundFrame &f)
SoundFrameoperator= (const SoundFrame &f)
jack_nframes_t SampleCount () const
jack_time_t SampleTime (jack_nframes_t offset)
void Set (jack_default_audio_sample_t *data, jack_nframes_t count)
void Set (jack_nframes_t count)
void Set (const SoundFrame &f)
void Set ()
 SoundFrame (jack_default_audio_sample_t *data, jack_nframes_t count)
 SoundFrame (jack_nframes_t count)
 SoundFrame ()
void Zero ()
 ~SoundFrame ()

Private Attributes

bool m_mallocd
jack_nframes_t m_samplecount
jack_default_audio_sample_t * m_samples


Detailed Description

Please document me.

Definition at line 14 of file SoundFrame.h.


Constructor & Destructor Documentation

SoundFrame::SoundFrame (  ) 

Definition at line 19 of file SoundFrame.cpp.

References Set().

00019                        : m_mallocd(false)
00020 {
00021     Set();
00022 }

SoundFrame::SoundFrame ( jack_nframes_t  count  ) 

Definition at line 13 of file SoundFrame.cpp.

References Set(), and Zero().

00013                                            : m_mallocd(false)
00014 {
00015     Set(count);
00016     Zero();
00017 }

SoundFrame::SoundFrame ( jack_default_audio_sample_t *  data,
jack_nframes_t  count 
)

Definition at line 8 of file SoundFrame.cpp.

References Set().

00008                                                                               : m_mallocd(false)
00009 {
00010     Set(data, count);
00011 }

SoundFrame::~SoundFrame (  ) 

Definition at line 66 of file SoundFrame.cpp.

References Set().

00067 {
00068     Set();
00069 }


Member Function Documentation

jack_time_t SoundFrame::FrameTime (  ) 

Definition at line 71 of file SoundFrame.cpp.

References JackClient::GetSingleton(), and m_samplecount.

00072 {
00073     return jack_frames_to_time(JackClient::GetSingleton()->GetClient(), m_samplecount);
00074 }

jack_default_audio_sample_t* SoundFrame::GetSamples (  )  const [inline]

Definition at line 38 of file SoundFrame.h.

References m_samples.

Referenced by operator*(), operator*=(), operator+(), operator+=(), operator<<(), Waveform::Process(), JackAudioPort::PutFrame(), and Set().

00038 { return m_samples; }

SoundFrame & SoundFrame::operator*= ( float  scalar  ) 

Definition at line 107 of file SoundFrame.cpp.

References m_samplecount, and m_samples.

00108 {
00109     for (unsigned int x = 0; x < m_samplecount; ++x) {
00110         m_samples[x] *= scalar;
00111     }
00112 
00113     return *this;
00114 }

SoundFrame & SoundFrame::operator*= ( const SoundFrame f  ) 

Definition at line 94 of file SoundFrame.cpp.

References GetSamples(), m_samplecount, m_samples, SampleCount(), and Set().

00095 {
00096     if (m_samplecount < f.SampleCount()) {
00097         Set(f.SampleCount());
00098     }
00099 
00100     for (unsigned int x = 0; x < m_samplecount; ++x) {
00101         m_samples[x] *= f.GetSamples()[x];
00102     }
00103 
00104     return *this;
00105 }

SoundFrame & SoundFrame::operator+= ( const SoundFrame f  ) 

Definition at line 81 of file SoundFrame.cpp.

References GetSamples(), m_samplecount, m_samples, SampleCount(), and Set().

00082 {
00083     if (m_samplecount < f.SampleCount()) {
00084         Set(f.SampleCount());
00085     }
00086 
00087     for (unsigned int x = 0; x < m_samplecount; ++x) {
00088         m_samples[x] += f.GetSamples()[x];
00089     }
00090 
00091     return *this;
00092 }

SoundFrame & SoundFrame::operator= ( const SoundFrame f  ) 

Definition at line 116 of file SoundFrame.cpp.

References Set().

00117 {
00118     Set(f);
00119     return *this;
00120 }

jack_nframes_t SoundFrame::SampleCount (  )  const [inline]

Definition at line 37 of file SoundFrame.h.

References m_samplecount.

Referenced by operator*(), operator*=(), operator+(), operator+=(), operator<<(), JackAudioPort::PutFrame(), and Set().

00037 { return m_samplecount; }

jack_time_t SoundFrame::SampleTime ( jack_nframes_t  offset  ) 

Definition at line 76 of file SoundFrame.cpp.

References JackClient::GetSingleton().

00077 {
00078     return jack_frames_to_time(JackClient::GetSingleton()->GetClient(), offset);
00079 }

void SoundFrame::Set ( jack_default_audio_sample_t *  data,
jack_nframes_t  count 
)

Definition at line 60 of file SoundFrame.cpp.

References m_samples, and Set().

00061 {
00062     Set(count);
00063     memcpy(m_samples, data, sizeof(jack_default_audio_sample_t) * count);
00064 }

void SoundFrame::Set ( jack_nframes_t  count  ) 

Definition at line 45 of file SoundFrame.cpp.

References m_mallocd, m_samplecount, m_samples, Set(), and Zero().

00046 {
00047     if (m_mallocd) {
00048         m_samples = (jack_default_audio_sample_t*)realloc(m_samples, count * sizeof(jack_default_audio_sample_t));
00049     }
00050     else {
00051         Set();
00052 
00053         m_samples = (jack_default_audio_sample_t*)malloc(sizeof(jack_default_audio_sample_t) * count);
00054         m_samplecount = count;
00055         Zero();
00056         m_mallocd = true;
00057     }
00058 }

void SoundFrame::Set ( const SoundFrame f  ) 

Definition at line 39 of file SoundFrame.cpp.

References GetSamples(), m_samplecount, m_samples, SampleCount(), and Set().

00040 {
00041     Set(f.SampleCount());
00042     memcpy(m_samples, f.GetSamples(), sizeof(jack_default_audio_sample_t) * m_samplecount);
00043 }

void SoundFrame::Set (  ) 

Definition at line 29 of file SoundFrame.cpp.

References m_mallocd, m_samplecount, and m_samples.

Referenced by JackAudioPort::GetFrame(), operator*(), operator*=(), operator+(), operator+=(), operator=(), Recorder::Process(), ISoundSource::Process(), Set(), SoundFrame(), and ~SoundFrame().

00030 {
00031     if (m_mallocd) {
00032         free(m_samples);
00033     }
00034     m_samplecount = 0;
00035     m_samples = NULL;
00036     m_mallocd = false;
00037 }

void SoundFrame::Zero (  ) 

Definition at line 24 of file SoundFrame.cpp.

References m_samplecount, and m_samples.

Referenced by JackOutput::Process(), ISoundSource::Process(), ISoundElement::Process(), Set(), and SoundFrame().

00025 {
00026     memset(m_samples, 0, sizeof(jack_default_audio_sample_t) * m_samplecount);
00027 }


Member Data Documentation

bool SoundFrame::m_mallocd [private]

Definition at line 51 of file SoundFrame.h.

Referenced by Set().

jack_nframes_t SoundFrame::m_samplecount [private]

Definition at line 49 of file SoundFrame.h.

Referenced by FrameTime(), operator*=(), operator+=(), SampleCount(), Set(), and Zero().

jack_default_audio_sample_t* SoundFrame::m_samples [private]

Definition at line 48 of file SoundFrame.h.

Referenced by GetSamples(), operator*=(), operator+=(), Set(), and Zero().


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

Get JackFX at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated for JackFX by  doxygen