|
wavelength 1.0.0
|
Reader of the MIDI file of a song, which builds the data of every track it names. More...
#include <levelmidibuilder.h>
Classes | |
| class | BuilderReceiver |
| MidiReceiver that passes the events of the MIDI file to the builder. More... | |
Public Types | |
| enum | TrackKind { kTrackKindNone = 0 , kTrackKindConductor = 1 , kTrackKindAxeContour = 2 , kTrackKindAxeHarmony = 3 , kTrackKindPitch = 4 , kTrackKindVox = 5 , kTrackKindScratch = 6 , kTrackKindCatch = 7 , kTrackKindBackground = 8 , kTrackKindIntro = 9 , kTrackKindWorld = 10 , kTrackKindScript = 11 , kTrackKindBank = 12 , kTrackKindIgnore = 13 } |
| Kinds of a MIDI track, as its name identifies them. More... | |
Public Member Functions | |
| LevelMidiBuilder (const char *pszMidiFile, int nDifficulty, int nRuleSet, int nNumBars, int nIntroBars, int nFreestyleEffectsBus, int nRemixEffectsBus, SectionBoundaries *pSections, float *pMsPerTick, SlotGrid *pSlotGrid) | |
| Construct a builder for the MIDI file of a song. | |
| ~LevelMidiBuilder () | |
| Release the builder, the file, and the data of every track. | |
| void | StartLoad () |
| Start reading the MIDI file without checking it for authoring errors. | |
| void | StartLoad (TrackBuilder::ErrorHandler pfnError) |
| Start reading the MIDI file and check it for authoring errors. | |
| void | Poll () |
| Advance the read of the MIDI file, parsing it for up to 15 milliseconds once it is in memory, and release the file once it is parsed. | |
| int | IsDone () const |
| Report whether the MIDI file is parsed. | |
| void | OnNewTrack (unsigned char nTrack) |
| Start a track. | |
| void | OnEndTrack () |
| Finish the track, and make the lyrics after the conductor track. | |
| void | OnAllDone () |
| Report a song without a WORLD track or a BANK track. | |
| void | OnMidi (int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2) |
| Pass a channel message to the builder of the track. | |
| void | OnTempo (int nTick, int nMicrosecondsPerBeat) |
| Pass a tempo change to the builder of the track. | |
| void | OnTimeSignature (int nTick, int nNumerator, int nDenominator) |
| Pass a time signature to the builder of the track. | |
| void | OnText (int nTick, const char *pszText, unsigned char nType) |
| Take the name of a track that has none yet, and build its builder. | |
| void | LoadRemix () |
| Replace the data of the tracks with the saved remix of the game database. | |
| int | GetNumTracks () const |
| Report the number of instrument tracks. | |
| int | GetTrackType (int nTrack) const |
| Report the type of an instrument track. | |
| int | GetTrackInstrument (int nTrack) const |
| Report the instrument of a track. | |
| CatchTrackData * | GetCatchTrackData (int nTrack) const |
| Report the gems of a catch track. | |
| ScratchTrackData * | GetScratchData (int nTrack) const |
| Report the patterns of a turntable track. | |
| AxeTrackData * | GetAxeData (int nTrack) const |
| Report the notes of a guitar track. | |
| PitchTrackRiffData * | GetTrackRiffData (int nTrack) const |
| Report the riffs of a pitch track. | |
| CatchTrackData * | GetVoxData (int nTrack) const |
| Report the gems of a vocal track. | |
| int | GetTrackFlags (int nTrack) const |
| Report the flags of a track. | |
| int | GetNumBackMusic () const |
| Report the number of background music tracks. | |
| BackMusic * | GetBackMusic (int nIndex) const |
| Report one background music track. | |
| int | GetNumIntroMuses () const |
| Report the number of performances of the tracks named "INTRO". | |
| Muse * | GetIntroMuse (int nIndex) const |
| Report the performance of one track named "INTRO". | |
| ScriptTrackData * | FindScriptTrack (const char *pszName) const |
| Find the commands of a track named "SCRIPT" by their name. | |
| int | GetTicksPerBar () const |
| PlayMap * | GetPlayMap () const |
| BankLoader * | GetBankTrack () const |
| WorldTrack * | GetWorldTrack () |
| Lyric * | GetLyric () const |
| FXMgr * | GetFXMgr () const |
| float | GetSpeed () const |
Static Public Member Functions | |
| static String | FormatError (const String &prefix, int nTick, int nTrack, const String &message) |
| Format an error message with the MIDI track and the position it concerns. | |
Reader of the MIDI file of a song, which builds the data of every track it names.
The class is not polymorphic. The name comes from the RTTI of its nested classes BuilderReceiver and Tracks. The object is 0x10c bytes. Each MIDI track names its kind in its name event, and the builder hands its events to a TrackBuilder for the kind. Track 0 is the conductor track. A game track name looks like T1 CATCH:D:Drums, with the number of the instrument track, its type, the instrument letter, and a label.
Kinds of a MIDI track, as its name identifies them.
| Enumerator | |
|---|---|
| kTrackKindNone | The name was not recognised. |
| kTrackKindConductor | Track 0, with the tempo and the time signature. |
| kTrackKindAxeContour | AXE_CONTOUR, the notes of a guitar track. |
| kTrackKindAxeHarmony | AXE_HARMONY, the harmony of the guitar track before. |
| kTrackKindPitch | PITCH, the riffs of a pitch track. |
| kTrackKindVox | VOX, the gems of a vocal track. |
| kTrackKindScratch | SCRATCH1 to SCRATCH3, the patterns of a turntable. |
| kTrackKindCatch | CATCH, the gems of a catch track. |
| kTrackKindBackground | A name starting BG, background music. |
| kTrackKindIntro | A name starting INTRO, music before the song. |
| kTrackKindWorld | WORLD, the events of the world. |
| kTrackKindScript | A name starting SCRIPT, the commands of a tutorial. |
| kTrackKindBank | A name starting BANK, the sound banks of the song. |
| kTrackKindIgnore | A name starting IGNORE, not read. |
| LevelMidiBuilder::LevelMidiBuilder | ( | const char * | pszMidiFile, |
| int | nDifficulty, | ||
| int | nRuleSet, | ||
| int | nNumBars, | ||
| int | nIntroBars, | ||
| int | nFreestyleEffectsBus, | ||
| int | nRemixEffectsBus, | ||
| SectionBoundaries * | pSections, | ||
| float * | pMsPerTick, | ||
| SlotGrid * | pSlotGrid ) |
Construct a builder for the MIDI file of a song.
| pszMidiFile | The MIDI file, which the caller retains. |
| nDifficulty | The difficulty, which the catch tracks build their gems for. |
| nRuleSet | The rule set of the game, one of GameDb::RuleSet. |
| nNumBars | The length of the song in bars. |
| nIntroBars | The bars before bar 0. |
| nFreestyleEffectsBus | The effects bus of the guitar tracks. |
| nRemixEffectsBus | The effects bus of a remix. |
| pSections | The sections of the song. |
| pMsPerTick | The duration of one tick in milliseconds. |
| pSlotGrid | The patterns of the sections. |
| LevelMidiBuilder::~LevelMidiBuilder | ( | ) |
Release the builder, the file, and the data of every track.
| void LevelMidiBuilder::StartLoad | ( | ) |
Start reading the MIDI file without checking it for authoring errors.
The name is inferred.
| void LevelMidiBuilder::StartLoad | ( | TrackBuilder::ErrorHandler | pfnError | ) |
Start reading the MIDI file and check it for authoring errors.
The name is inferred.
| pfnError | The routine that reports an error. |
| void LevelMidiBuilder::Poll | ( | ) |
Advance the read of the MIDI file, parsing it for up to 15 milliseconds once it is in memory, and release the file once it is parsed.
The name is inferred.
| int LevelMidiBuilder::IsDone | ( | ) | const |
Report whether the MIDI file is parsed.
The name is inferred.
| void LevelMidiBuilder::OnNewTrack | ( | unsigned char | nTrack | ) |
Start a track.
Track 0 is the conductor track. Another track waits for its name.
| nTrack | The track. |
| void LevelMidiBuilder::OnEndTrack | ( | ) |
Finish the track, and make the lyrics after the conductor track.
| void LevelMidiBuilder::OnAllDone | ( | ) |
Report a song without a WORLD track or a BANK track.
| void LevelMidiBuilder::OnMidi | ( | int | nTick, |
| unsigned char | nStatus, | ||
| unsigned char | nData1, | ||
| unsigned char | nData2 ) |
Pass a channel message to the builder of the track.
| nTick | The tick of the message. |
| nStatus | The status byte. |
| nData1 | The first data byte. |
| nData2 | The second data byte. |
| void LevelMidiBuilder::OnTempo | ( | int | nTick, |
| int | nMicrosecondsPerBeat ) |
Pass a tempo change to the builder of the track.
| nTick | The tick. |
| nMicrosecondsPerBeat | The tempo. |
| void LevelMidiBuilder::OnTimeSignature | ( | int | nTick, |
| int | nNumerator, | ||
| int | nDenominator ) |
Pass a time signature to the builder of the track.
| nTick | The tick. |
| nNumerator | The beats in a bar. |
| nDenominator | The length of a beat. |
| void LevelMidiBuilder::OnText | ( | int | nTick, |
| const char * | pszText, | ||
| unsigned char | nType ) |
Take the name of a track that has none yet, and build its builder.
Pass every other text event to the builder of the track.
| nTick | The tick. |
| pszText | The text. |
| nType | The type of the event, 3 for a track name. |
| void LevelMidiBuilder::LoadRemix | ( | ) |
Replace the data of the tracks with the saved remix of the game database.
The name is inferred. The remix holds the speed, the effects, and the gems of each pitch and vocal track. A pitch track becomes a catch track of the riffs its gems pick.
| int LevelMidiBuilder::GetNumTracks | ( | ) | const |
Report the number of instrument tracks.
| int LevelMidiBuilder::GetTrackType | ( | int | nTrack | ) | const |
Report the type of an instrument track.
| nTrack | The track. |
| int LevelMidiBuilder::GetTrackInstrument | ( | int | nTrack | ) | const |
Report the instrument of a track.
| nTrack | The track. |
| CatchTrackData * LevelMidiBuilder::GetCatchTrackData | ( | int | nTrack | ) | const |
Report the gems of a catch track.
| nTrack | The track. |
| ScratchTrackData * LevelMidiBuilder::GetScratchData | ( | int | nTrack | ) | const |
Report the patterns of a turntable track.
| nTrack | The track. |
| AxeTrackData * LevelMidiBuilder::GetAxeData | ( | int | nTrack | ) | const |
Report the notes of a guitar track.
| nTrack | The track. |
| PitchTrackRiffData * LevelMidiBuilder::GetTrackRiffData | ( | int | nTrack | ) | const |
Report the riffs of a pitch track.
| nTrack | The track. |
| CatchTrackData * LevelMidiBuilder::GetVoxData | ( | int | nTrack | ) | const |
Report the gems of a vocal track.
| nTrack | The track. |
| int LevelMidiBuilder::GetTrackFlags | ( | int | nTrack | ) | const |
Report the flags of a track.
| nTrack | The track. |
| int LevelMidiBuilder::GetNumBackMusic | ( | ) | const |
Report the number of background music tracks.
| BackMusic * LevelMidiBuilder::GetBackMusic | ( | int | nIndex | ) | const |
Report one background music track.
| nIndex | The index. |
| int LevelMidiBuilder::GetNumIntroMuses | ( | ) | const |
Report the number of performances of the tracks named "INTRO".
| Muse * LevelMidiBuilder::GetIntroMuse | ( | int | nIndex | ) | const |
Report the performance of one track named "INTRO".
| nIndex | The index. |
| ScriptTrackData * LevelMidiBuilder::FindScriptTrack | ( | const char * | pszName | ) | const |
Find the commands of a track named "SCRIPT" by their name.
The name is inferred.
| pszName | The name. |
|
static |
Format an error message with the MIDI track and the position it concerns.
| prefix | The text the message starts with. |
| nTick | The tick of the error. |
| nTrack | The MIDI track. |
| message | The error. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |