Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TSE3::Util Namespace Reference

TSE3 library utilities More...


Compounds

class  DemidifyException
class  Demidify
 Reconstruct Song structure utility. More...

class  StreamMidiScheduler
 Diagnostic ostream MidiScheduler implementation. More...

class  NullMidiScheduler
 Null MidiScheduler implementation (does nothing!). More...

class  PowerQuantise
 Staggeringly impressive Phrase quantisation. More...

class  PowerQuantise::Pattern
class  Snap
 Time 'snapping'. More...


Functions

int muldiv (int val, int num, int div)
std::string numberToNote (int note)
int noteToNumber (const std::string &src)
void Phrase_Merge (std::vector< TSE3::Playable * > &play, TSE3::PhraseEdit *pe)
void Phrase_Add (TSE3::Phrase *p1, TSE3::Phrase *p2, TSE3::PhraseEdit *pe)
void Phrase_Subtract (TSE3::Phrase *p1, TSE3::Phrase *p2, TSE3::PhraseEdit *pe)
void Phrase_Arpeggiate (TSE3::Phrase *p1, TSE3::Phrase *p2, TSE3::PhraseEdit *pe)
void Phrase_Explode (TSE3::Phrase *p, std::string baseName, int channels, bool insertParts, TSE3::Song *song)
void Song_SearchForPhrase (TSE3::Song *song, TSE3::Phrase *phrase, std::vector< TSE3::Part * > &list)
void Song_ReplacePhrase (TSE3::Song *song, TSE3::Phrase *oldphr, TSE3::Phrase *newphr)
void Track_RemoveParts (TSE3::Track *track, TSE3::Clock start, TSE3::Clock end)
void Track_RemoveParts (TSE3::Track *track, TSE3::Clock start, TSE3::Clock end, std::vector< TSE3::Part * > &removed, TSE3::Clock &clippedStart, TSE3::Clock &clippedEnd, TSE3::Part *&newPart)
void Track_UnremoveParts (TSE3::Track *track, TSE3::Clock start, TSE3::Clock end, std::vector< TSE3::Part * > &removed, TSE3::Clock clippedStart, TSE3::Clock clippedEnd)


Detailed Description

TSE3 library utilities

The Util namespace contains classes and functions that build upon the TSE3 class API to provide more sophisitacted functionality.

These utilities are contained in the separate Util namespace to prevent the basic TSE3 API becoming large and complex to understand.

Author:
Pete Goodliffe
Version:
3.00
See also:
TSE3


Function Documentation

int muldiv int  val,
int  num,
int  div
 

A utility function for doing muldiv calculations very quickly on platforms with no floating point support. It performs a multiplication and a divison. It used because most systems have 32 bit integers and we want multiplication/division that can cope with overflows.

Parameters:
val Value to perform muldiv on
num Numerator
div Divisor
Returns:
val * num / div (which coped with integer overflows)

std::string numberToNote int  note  ) 
 

Converts a MIDI note number to a name string.

Note name 'C5' is middle C (note number 60).

Parameters:
note MIDI note number
Returns:
Note name string
See also:
noteToNumber

int noteToNumber const std::string &  src  ) 
 

Converts a MIDI name string to a note number

Note name 'C5' is middle C (note number 60).

Parameters:
src Source name string
Returns:
Integer MIDI note value
See also:
numberToNote

void Phrase_Merge std::vector< TSE3::Playable * > &  play,
TSE3::PhraseEdit pe
 

Merge together the contents of the specified TSE3::Playable objects and put the result in the given PhraseEdit object.

You can use this, for example, to add together two TSE3::Phrase objects, or to merge together several .

The resultant PhraseEdit output is tidy.

Parameters:
play A vector containing each TSE3::Playable to merge
pe TSE3::PhraseEdit for result

void Phrase_Add TSE3::Phrase p1,
TSE3::Phrase p2,
TSE3::PhraseEdit pe
 

Add two together and put the result in the given TSE3::PhraseEdit object.

Parameters:
p1 First TSE3::Phrase
p2 Second TSE3::Phrase
pe TSE3::PhraseEdit for result of Phrase addition

void Phrase_Subtract TSE3::Phrase p1,
TSE3::Phrase p2,
TSE3::PhraseEdit pe
 

Subtract two and put the result in the given TSE3::PhraseEdit object.

Parameters:
p1 First TSE3::Phrase
p2 Second TSE3::Phrase
pe TSE3::PhraseEdit for result of TSE3::Phrase subtraction: result is p1 - p2.

void Phrase_Arpeggiate TSE3::Phrase p1,
TSE3::Phrase p2,
TSE3::PhraseEdit pe
 

Arpeggiate p1 with the note pattern in p2.

Parameters:
p1 First TSE3::Phrase
p2 Second TSE3::Phrase
pe TSE3::PhraseEdit containg p1 arpeggiated with p2.

void Phrase_Explode TSE3::Phrase p,
std::string  baseName,
int  channels,
bool  insertParts,
TSE3::Song song
 

Explode the given TSE3::Phrase into one TSE3::Phrase per MIDI channel.

The new TSE3::Phrase objects are named _1 .. _16.

Parameters:
p TSE3::Phrase to explode
baseName Base string the new TSE3::Phrase objects' names are based on
channels Bitfield for which channels to explode
song If 0, ignored; otherwise new TSE3::Part objects are placed into the Song's Tracks using each new TSE3::Phrase

void Song_SearchForPhrase TSE3::Song song,
TSE3::Phrase phrase,
std::vector< TSE3::Part * > &  list
 

Search for the given TSE3::Phrase in all of the TSE3::Part objects in this TSE3::Song. A pointer to each Part is placed into the vector list.

This is a useful way to discover which TSE3::Part objects Song_ReplacePhrase is going to alter.

Parameters:
song TSE3::Song to work with
phrase TSE3::Phrase to search for
list Vector to place into
See also:
Song_ReplacePhrase

void Song_ReplacePhrase TSE3::Song song,
TSE3::Phrase oldphr,
TSE3::Phrase newphr
 

Replace the given TSE3::Phrase with a new TSE3::Phrase in the TSE3::Song.

Often the new TSE3::Phrase will have the same 'unique' reference name as the old one, and the old Phrase will be deleted directly after this call, after which the new TSE3::Phrase will be placed in the TSE3::PhraseList.

Parameters:
song TSE3::Song to work with
oldphr Old TSE3::Phrase that will be replaced.
newphr New TSE3::Phrase to replace the old one.
See also:
Song_SearchForPhrase

void Track_RemoveParts TSE3::Track track,
TSE3::Clock  start,
TSE3::Clock  end
 

Removes any TSE3::Part objects that are between the given times. The TSE3::Part objects will be 'intelligently' clipped, i.e. if a TSE3::Part starts in the time zone, but ends after it, it's start will be moved, and an offset calculated for the TSE3::Part's TSE3::MidiFilter.

The Part objects will be deleted.

If there are no TSE3::Part objects deleted, no error will be raised and the method wil silently return.

Parameters:
track TSE3::Track to remove from
start Start of time zone to clear
end End of time zone to clear

void Track_RemoveParts TSE3::Track track,
TSE3::Clock  start,
TSE3::Clock  end,
std::vector< TSE3::Part * > &  removed,
TSE3::Clock clippedStart,
TSE3::Clock clippedEnd,
TSE3::Part *&  newPart
 

This method acts like the remove above, but has more bells and whistles.

The reason for using this method over the simpler remove above is that with the information returned from this call you can reconstruct the TSE3::Track again afterwards, for example to provide an undo facility. The Track_UnremoveParts function exists to do this. You can also safely 'redo' the operation again.

Unless you need this ability don't read the following description since it will give you a headache ;-)

Rather than delete any TSE3::Part objects in the TSE3::Track, they are removed, and placed into the removed vector supplied by the user.

Additionally as a TSE3::Part at the start of the zone may be clipped, and a TSE3::Part at the end of the zone may be clipped, the funtion provides a way of reporting this.

If cliping does take place, the old TSE3::Part end/start values (respectively) are placed in the clippedStart and clippedEnd parameters. If no TSE3::Part is clipped at either end, the parameter is set to -1.

A second type of clipping may occur - there could be a single big TSE3::Part that starts before start and ends after end. Track_RemoveParts will 'cut a hole' into it. clippedEnd is set to -2 and clippedStart is set to the original end time of this 'big Part'. A new Part is created to fit after the end time. The new Part is returned in newPart.

If you do an 'undo' (calling Track_UnremoveParts) on this operation, and need to redo it, it can be important that the same TSE3::Part is added at the end - so if you were given a newPart value on return of the first call, pass this parameter back in the subsequent call.

Parameters:
track TSE3::Track to remove from
start Start of time zone to clear
end End of time zone to clear
removed Every TSE3::Part that is removed is put in this vector
clippedStart If there is a TSE3::Part that overlaps with start and has been clipped, this parameter is set to it's old end time. If there is no overlap, this parameter is set to -1.
clippedEnd If there is a TSE3::Part that overlaps with end and has been clipped, this parameter is set to it's old start time. If there is no overlap, this parameter is set to -1.
part Set initially to zero, this may return a pointer to a created TSE3::Part. If it does you should pass this value back in a subsequent 'redo'.
See also:
Track_UnremoveParts

void Track_UnremoveParts TSE3::Track track,
TSE3::Clock  start,
TSE3::Clock  end,
std::vector< TSE3::Part * > &  removed,
TSE3::Clock  clippedStart,
TSE3::Clock  clippedEnd
 

Undoes the removal of any TSE3::Part from the second Track_RemoveParts function above. Pass the same start and stop times and the removed, clippedStart and clippedEnd parameters you originally passed. As TSE3::Part objects are put back into the TSE3::Track they will be removed from the vector.

If newPart was not zero on return from Track_RemoveParts then it is now your responsibility to delete it.

Parameters:
track Same as previously passed to Track_RemoveParts
start Same as previously passed to Track_RemoveParts
end Same as previously passed to Track_RemoveParts
removed Same as previously passed to Track_RemoveParts Same as previously passed to Track_RemoveParts
clippedStart Same as previously passed to Track_RemoveParts
clippedEnd Same as previously passed to Track_RemoveParts
See also:
Track_RemoveParts


Generated on Wed May 25 14:48:12 2005 for TSE3 by doxygen 1.3.2