namespace Util

TSE3 library utilities. More...

Full nameTSE3::Util
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods


Detailed Description

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.

See also: TSE3

DemidifyException (class)

DemidifyException

Exception type thrown by Demidify.

Demidify (class)

Demidify

A utility that de 'MIDI' fies a Song. If you use the MidiFileImport class to load a MIDI file, you will see that the MTrks are mapped into each Track and any repeated data that could exploit the TSE3 Phrase facility.

This class analyses each Track and reconstructs the Song in a more structured manner.

See also: MidiFileImport

StreamMidiScheduler (class)

StreamMidiScheduler

This is a very simple example TSE3::MidiScheduler implementation that merely produces diagnostic output to a given ostream.

See also: MidiScheduler, MidiSchedulerFactory

NullMidiScheduler (class)

NullMidiScheduler

If a MidiScheduler cannot be made for a given platform then this is a placeholder 'null' implementation that does absolutely nothing.

See also: MidiScheduler, MidiSchedulerFactory

extern int  muldiv (int val, int num, int div)

muldiv

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:
valValue to perform muldiv on
numNumerator
divDivisor

Returns: val * num / div (which coped with integer overflows)

std::string  numberToNote (int note)

numberToNote

Converts a MIDI note number to a name string.

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

Parameters:
noteMIDI note number

Returns: Note name string

See also: noteToNumber

int  noteToNumber (const std::string &src)

noteToNumber

Converts a MIDI name string to a note number

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

Parameters:
srcSource name string

Returns: Integer MIDI note value

See also: numberToNote

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

Phrase_Merge

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 TSE3::Tracks.

The resultant PhraseEdit output is tidy.

Parameters:
playA vector containing each TSE3::Playable to merge
peTSE3::PhraseEdit for result

void  Phrase_Add (TSE3::Phrase *p1, TSE3::Phrase *p2, TSE3::PhraseEdit *pe)

Phrase_Add

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

Parameters:
p1First TSE3::Phrase
p2Second TSE3::Phrase
peTSE3::PhraseEdit for result of Phrase addition

void  Phrase_Subtract (TSE3::Phrase *p1, TSE3::Phrase *p2, TSE3::PhraseEdit *pe)

Phrase_Subtract

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

Parameters:
p1First TSE3::Phrase
p2Second TSE3::Phrase
peTSE3::PhraseEdit for result of TSE3::Phrase subtraction: result is p1 - p2.

void  Phrase_Arpeggiate (TSE3::Phrase *p1, TSE3::Phrase *p2, TSE3::PhraseEdit *pe)

Phrase_Arpeggiate

Arpeggiate p1 with the note pattern in p2.

Parameters:
p1First TSE3::Phrase
p2Second TSE3::Phrase
peTSE3::PhraseEdit containg p1 arpeggiated with p2.

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

Phrase_Explode

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

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

Parameters:
pTSE3::Phrase to explode
baseNameBase string the new TSE3::Phrase objects' names are based on
channelsBitfield for which channels to explode
songIf 0, ignored; otherwise new TSE3::Part objects are placed into the Song's Tracks using each new TSE3::Phrase

PowerQuantise (class)

PowerQuantise

This utility class provides you with more quantising capabilities than you ever dreamt possible.

The class is used by specifying the set of parameters to run the PowerQuantise with, and then providing a (tidied) PhraseEdit object containing the source MidiData to quantise. Once the PowerQuantiser is run, the PhraseEdit will contain tidied, (powerfully) quantised MidiData.

Some of the facilities provided by PowerQuantise are:

To be completed This class isn't a Notifer yet, but it will be. I imagine that the PowerQuantise::Pattern class will also be Serializable so that you can save a library of named patterns. Watch this space.

See also: PhraseEdit, PowerQuantise::Pattern

Snap (class)

Snap

Time 'snapping' services: snapping a given time to the next lowest point at a given resolution.

This class uses the TimeSigTrack class to work out where bars start/stop.

See also: Clock, TimeSigTrack

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

Song_SearchForPhrase

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:
songTSE3::Song to work with
phraseTSE3::Phrase to search for
listVector to place Parts into

See also: Song_ReplacePhrase

void  Song_ReplacePhrase (TSE3::Song *song, TSE3::Phrase *oldphr, TSE3::Phrase *newphr)

Song_ReplacePhrase

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:
songTSE3::Song to work with
oldphrOld TSE3::Phrase that will be replaced.
newphrNew TSE3::Phrase to replace the old one.

See also: Song_SearchForPhrase

void  Track_RemoveParts (TSE3::Track *track, TSE3::Clock start, TSE3::Clock end)

Track_RemoveParts

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:
trackTSE3::Track to remove TSE3::Parts from
startStart of time zone to clear
endEnd 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)

Track_RemoveParts

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:
trackTSE3::Track to remove TSE3::Parts from
startStart of time zone to clear
endEnd of time zone to clear
removedEvery TSE3::Part that is removed is put in this vector
clippedStartIf 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.
clippedEndIf 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.
partSet 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)

Track_UnremoveParts

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:
trackSame as previously passed to Track_RemoveParts
startSame as previously passed to Track_RemoveParts
endSame as previously passed to Track_RemoveParts
removedSame as previously passed to Track_RemoveParts Same as previously passed to Track_RemoveParts
clippedStartSame as previously passed to Track_RemoveParts
clippedEndSame as previously passed to Track_RemoveParts

See also: Track_RemoveParts