Beatmup
|
Fragmented signal in time domain. More...
#include <sequence.h>
Classes | |
class | AccessException |
class | Pointer |
Points to a position within a sequence. More... | |
Public Member Functions | |
const dtime | getDuration () const |
Returns sequence duration in number of samples. More... | |
bool | isEmpty () const |
Returns true if sequence contains no samples. More... | |
void | clear () |
Removes the content of the sequence making it empty (of zero duration). More... | |
void | shrink (dtime timeLeft, dtime timeRight) |
Shrinks the sequence to given time bounds. More... | |
Sequence * | copy (dtime fromTime, dtime toTime) const |
Copies a given piece of the current sequence into new Sequence. More... | |
void | insert (const Sequence &sequence, dtime time) |
Inserts a Sequence at a given position in time. More... | |
void | remove (dtime fromTime, dtime toTime) |
Erases a part of the sequence between two given time moments. More... | |
void | split (dtime time, Sequence *left, Sequence *right) const |
Splits the sequence in two at a specific time. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Protected Member Functions | |
Sequence () | |
virtual | ~Sequence () |
virtual Sequence * | createEmpty () const =0 |
Initializes an empty sequence, used to bootstrap copying operations. More... | |
void | concatenate (Fragment &fragment, dtime offset, dtime length) |
Adds a new fragment at the end of the sequence. More... | |
void | syncPointers () |
Resets pointers once the sequence changes to keep them consistent. More... | |
Private Member Functions | |
int | findFragment (dtime time) const |
Log search for a fragment containing given time moment. More... | |
void | splitFragment (int index, dtime delta) |
Splits a given fragment in two. More... | |
Private Attributes | |
std::vector< FragmentPtr > | fragments |
the content More... | |
std::vector< dtime > | cumTimes |
cumulative sum of fragment lengths, starts from 0, of N+1 entries (N = num. of fragments) More... | |
std::vector< Pointer * > | pointers |
pointers currently accessing the sequence More... | |
Static Private Attributes | |
static const int | VOID_LEFT = -123 |
returned by getFragment() when the entire sequence is on the right of the given time moment More... | |
static const int | VOID_RIGHT = -456 |
returned by getFragment() when the entire sequence is on the left of the given time moment More... | |
Fragmented signal in time domain.
Implements basic editing operations (copy, paste, cut in two, shrink, etc.). Operations are performed on the set of fragments, but not directly to the signal content in memory.
Definition at line 33 of file sequence.h.
|
protected |
|
protectedvirtual |
|
private |
Log search for a fragment containing given time moment.
|
private |
Splits a given fragment in two.
Does not recompute the cumulative time index.
index | the fragment index |
delta | additional offset w.r.t. fragment internal offset specifying where to split |
|
protectedpure virtual |
Initializes an empty sequence, used to bootstrap copying operations.
Implemented in Beatmup::Audio::Signal.
|
protected |
Adds a new fragment at the end of the sequence.
|
protected |
Resets pointers once the sequence changes to keep them consistent.
|
inline |
Returns sequence duration in number of samples.
Definition at line 123 of file sequence.h.
|
inline |
Returns true
if sequence contains no samples.
Definition at line 128 of file sequence.h.
void Beatmup::Fragments::Sequence::clear | ( | ) |
Removes the content of the sequence making it empty (of zero duration).
Shrinks the sequence to given time bounds.
timeLeft | Left limit to shrink to (included), i.e., the earliest time moment from which the new (shrinked) sequence will begin |
timeRight | Right limit to shrink to (excluded) |
Copies a given piece of the current sequence into new Sequence.
fromTime | The beginning of the piece to copy (included in the resulting sequence) |
toTime | The end of the piece (excluded from the resulting sequence) |
Inserts a Sequence at a given position in time.
sequence | The sequence to insert |
time | The time to insert from |
Erases a part of the sequence between two given time moments.
fromTime | The beginning of the part to remove |
toTime | The end of the part to remove |
Splits the sequence in two at a specific time.
Creates two new Sequence instances. The content of the current sequence remains unchanged.
time | The time moment to cut at |
left | The left part of the split |
right | The right part of the split |
|
private |
the content
Definition at line 79 of file sequence.h.
|
private |
cumulative sum of fragment lengths, starts from 0, of N+1 entries (N = num. of fragments)
Definition at line 80 of file sequence.h.
|
private |
pointers currently accessing the sequence
Definition at line 81 of file sequence.h.
|
staticprivate |
returned by getFragment() when the entire sequence is on the right of the given time moment
Definition at line 97 of file sequence.h.
|
staticprivate |
returned by getFragment() when the entire sequence is on the left of the given time moment
Definition at line 98 of file sequence.h.