Monday, September 20, 2010

Bxx : jump to order xx (dec).

A MODule (or .S3M, .XM or .IT) is made of individual patterns, short musical sentences (or loops) composed by the author. These are latter arranged into a song through the order table that indicates in which sequence patterns must be played.
A musician can decide to break the current pattern (Cxx) to skip to the next order (that is the pattern that comes next in the order table) but also to branch (Bxx) to any order (including a previous one). For apple assault (and most likely a lot of game music), this is especially interesting because it allows my brother to pack several musical themes into one file and have them self-looping until my program decide to switch (externally) to another theme. Well, just have an ear to his mp3 preview ... you'll know what I mean.

Un petit répit de quelques heures (tardives) entre un déliverable qui se prolonge et des répétitions à donner 1 ou 2 semaines plus tôt que je ne le pensais ... Je reprends mes petites notes sur la gestion de l'effet "pattern break" (Cxx) dans NTXM et je tente l'ajout de l'effet Bxx (order jump) qui permet à mon frangin CyborgJeff de me mettre plusieurs thèmes musicaux dans un seul fichier (menu, jeu, shuriken-rush, game over, etc. ... ah. Je sens que ça vous intéresse ;) J'ai un peu tâtonner (forcément, à écrire 4 lignes de code par semaine :P) mais dans un flash, j'ai trouvé juste avant de me mettre au lit ce qui manquait pour que ça marche. Permettez que je laisse la documentation dans la seule lange de Shakespeare (prononcez "Chakèspéare") et que je rattaque le boulot.

Now, programmatically speaking, both are global commands, that is they are not affecting a single channel (although they are present on a specific channel) but the song as a whole. Plus, they have deferred effect: they are read with other effects when the new row is parsed with parsing at Player::handleEffects, but only executed at Player::calcNextPos. There could be alternatives, such as pushing fake values in State::potpos and State::row and just have State::nextpos and State::nextrow altered by handleEffects ... I'm not sure that would be a good idea.

It will still need a few more lunchtime before it works properly, I'm afraid.
BonSangMaisCestBienSur if I never reset the newly introduced pattern_jump_requested state variable, I will end up doing weird things such as repeatedly playing the 1st row of the new pattern rather than letting the song flow. >_< * >_<* >_< *

done, and I also fixed the "zombie samples" problems that occured when switching to one tune to the other ^_^

1 comment:

cyborgjeff said...

bravo pype !