Klang C++
Language Reference (draft)
Loading...
Searching...
No Matches
klang::Stereo::buffer

Stereo audio buffer. More...

#include <klang.h>

Public Types

typedef Stereo::signal signal
 

Public Member Functions

 buffer (const buffer &buffer)
 
 buffer (mono::buffer &left, mono::buffer &right)
 
 operator const signal () const
 
 operator frame ()
 
bool finished () const
 
frame operator++ (int)
 
frame operator= (const signal &in)
 
bufferoperator= (const buffer &in)
 
bufferoperator+= (const signal &in)
 
bufferoperator= (const frame &in)
 
bufferoperator+= (const frame &in)
 
bufferoperator*= (const frame &in)
 
bufferoperator= (const mono::signal in)
 
bufferoperator+= (const mono::signal in)
 
bufferoperator*= (const mono::signal in)
 
frame operator[] (int index)
 
signal operator[] (int index) const
 
mono::bufferchannel (int index)
 
void clear ()
 
void clear (int size)
 
void rewind ()
 

Public Attributes

mono::bufferleft
 
mono::buffer right
 

Detailed Description

Definition at line 3402 of file klang.h.

Member Typedef Documentation

◆ signal

Constructor & Destructor Documentation

◆ buffer() [1/2]

klang::Stereo::buffer::buffer ( const buffer & buffer)
inline

Definition at line 3406 of file klang.h.

3406: left(buffer.left), right(buffer.right) { rewind(); }
mono::buffer right
Definition klang.h:3404
buffer(const buffer &buffer)
Definition klang.h:3406
mono::buffer & left
Definition klang.h:3404

References left, rewind(), and right.

◆ buffer() [2/2]

klang::Stereo::buffer::buffer ( mono::buffer & left,
mono::buffer & right )
inline

Definition at line 3407 of file klang.h.

3407: left(left), right(right) { rewind(); }

References left, rewind(), and right.

Referenced by klang::Stereo::Note::process().

Member Function Documentation

◆ channel()

mono::buffer & klang::Stereo::buffer::channel ( int index)
inline

Definition at line 3446 of file klang.h.

3446 {
3447 return index == 1 ? right : left;
3448 }

References left, and right.

◆ clear() [1/2]

void klang::Stereo::buffer::clear ( )
inline

Definition at line 3450 of file klang.h.

3450 {
3451 left.clear();
3452 right.clear();
3453 }
void clear()
Definition klang.h:1241

References klang::buffer::clear(), left, and right.

◆ clear() [2/2]

void klang::Stereo::buffer::clear ( int size)
inline

Definition at line 3455 of file klang.h.

3455 {
3456 left.clear(size);
3457 right.clear(size);
3458 }

References klang::buffer::clear(), left, and right.

◆ finished()

bool klang::Stereo::buffer::finished ( ) const
inline

Definition at line 3411 of file klang.h.

3411{ return left.finished() && right.finished(); }
bool finished() const
Definition klang.h:1294

References klang::buffer::finished(), left, and right.

Referenced by klang::Stereo::Effect::process(), and klang::Stereo::Note::process().

◆ operator const signal()

klang::Stereo::buffer::operator const signal ( ) const
inline

Definition at line 3409 of file klang.h.

3409{ return { left, right }; }

References left, and right.

◆ operator frame()

klang::Stereo::buffer::operator frame ( )
inline

Definition at line 3410 of file klang.h.

3410{ return { left, right }; }

References klang::Stereo::frame::frame(), left, and right.

◆ operator*=() [1/2]

buffer & klang::Stereo::buffer::operator*= ( const frame & in)
inline

Definition at line 3432 of file klang.h.

3432{ left *= in.l; right *= in.r; return *this; }

References klang::Stereo::frame::l, left, klang::buffer::operator*=(), klang::Stereo::frame::r, and right.

◆ operator*=() [2/2]

buffer & klang::Stereo::buffer::operator*= ( const mono::signal in)
inline

Definition at line 3436 of file klang.h.

3436{ left *= in; right *= in;return *this; }

References left, klang::buffer::operator*=(), and right.

◆ operator++()

frame klang::Stereo::buffer::operator++ ( int )
inline

Definition at line 3412 of file klang.h.

3412{ return { left++, right++ }; }

References klang::Stereo::frame::frame(), left, klang::buffer::operator++(), and right.

Referenced by klang::Stereo::Effect::process(), and klang::Stereo::Note::process().

◆ operator+=() [1/3]

buffer & klang::Stereo::buffer::operator+= ( const frame & in)
inline

Definition at line 3431 of file klang.h.

3431{ left += in.l; right += in.r; return *this; }

References klang::Stereo::frame::l, left, klang::buffer::operator+=(), klang::Stereo::frame::r, and right.

◆ operator+=() [2/3]

buffer & klang::Stereo::buffer::operator+= ( const mono::signal in)
inline

Definition at line 3435 of file klang.h.

3435{ left += in; right += in;return *this; }

References left, klang::buffer::operator+=(), and right.

◆ operator+=() [3/3]

buffer & klang::Stereo::buffer::operator+= ( const signal & in)
inline

Definition at line 3424 of file klang.h.

3424 {
3425 left += in.l;
3426 right += in.r;
3427 return *this;
3428 }

References left, klang::buffer::operator+=(), and right.

◆ operator=() [1/4]

buffer & klang::Stereo::buffer::operator= ( const buffer & in)
inline

Definition at line 3418 of file klang.h.

3418 {
3419 left = in.left;
3420 right = in.right;
3421 return *this;
3422 }

References left, klang::buffer::operator=(), and right.

◆ operator=() [2/4]

buffer & klang::Stereo::buffer::operator= ( const frame & in)
inline

Definition at line 3430 of file klang.h.

3430{ left = in.l; right = in.r; return *this; }

References klang::Stereo::frame::l, left, klang::buffer::operator=(), klang::Stereo::frame::r, and right.

◆ operator=() [3/4]

buffer & klang::Stereo::buffer::operator= ( const mono::signal in)
inline

Definition at line 3434 of file klang.h.

3434{ left = in; right = in; return *this; }

References left, klang::buffer::operator=(), and right.

◆ operator=() [4/4]

frame klang::Stereo::buffer::operator= ( const signal & in)
inline

Definition at line 3414 of file klang.h.

3414 {
3415 return { left = in.l, right = in.r };
3416 }

References klang::Stereo::frame::frame(), left, klang::buffer::operator=(), and right.

◆ operator[]() [1/2]

frame klang::Stereo::buffer::operator[] ( int index)
inline

Definition at line 3438 of file klang.h.

3438 {
3439 return { left[index], right[index] };
3440 }

References klang::Stereo::frame::frame(), left, klang::buffer::operator[](), and right.

◆ operator[]() [2/2]

signal klang::Stereo::buffer::operator[] ( int index) const
inline

Definition at line 3442 of file klang.h.

3442 {
3443 return { left[index], right[index] };
3444 }

References left, klang::buffer::operator[](), klang::buffer::operator[](), and right.

◆ rewind()

void klang::Stereo::buffer::rewind ( )
inline

Definition at line 3460 of file klang.h.

3460 {
3461 left.rewind();
3462 right.rewind();
3463 }
void rewind(int offset=0)
Definition klang.h:1233

References left, klang::buffer::rewind(), and right.

Referenced by buffer(), and buffer().

Member Data Documentation

◆ left

◆ right