#include <SoundFrame.h>
Public Member Functions | |
jack_time_t | FrameTime () |
jack_default_audio_sample_t * | GetSamples () const |
SoundFrame & | operator*= (float scalar) |
SoundFrame & | operator*= (const SoundFrame &f) |
SoundFrame & | operator+= (const SoundFrame &f) |
SoundFrame & | operator= (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 |
Definition at line 14 of file SoundFrame.h.
SoundFrame::SoundFrame | ( | ) |
SoundFrame::SoundFrame | ( | jack_nframes_t | count | ) |
SoundFrame::SoundFrame | ( | jack_default_audio_sample_t * | data, | |
jack_nframes_t | count | |||
) |
SoundFrame::~SoundFrame | ( | ) |
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 | |||
) |
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 }
bool SoundFrame::m_mallocd [private] |
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().