void split_notes(Track, pq)
int Track;
short int pq;
{
int notend, h;
unsigned long barrtime;
/* splnmark1: initiation */
dynhelp3 = begin[Track];
dynhelp2 = dynhelp3;
notend = 1;
while (notend) {
/* splnmark2: loop now */
while ((dynhelp3 != NULL) && ((dynhelp3->marker) != 'b')) dynhelp3 = dynhelp3->next;
if (dynhelp3 == NULL) {
notend = 0;
}
else {
barrtime = dynhelp3->time;
dynhelp3 = dynhelp3->next;
}
while (dynhelp2 && ((!dynhelp3) || (barrtime > (dynhelp2->time)))) {
if (dynhelp2->marker == 'n') {
not = (struct Note *) dynhelp2->data;
h = (dynhelp2->time) + (not->duration);
/* note should be splited because of long time */
if (((not->duration) > (4 * pq)) && ((!dynhelp3) || (((dynhelp2->time) + (4 * pq)) < barrtime))) {
ins_dyn_event(Track, 'n', 0, 0, 0, not->octave, not->pitch,
not->loud, (dynhelp2->time) + (4 * pq), (not->duration) - (4 * pq));
(not->duration) = 4 * pq;
}
else {
/* note sounds about next barre */
if ((dynhelp3) && (h > barrtime)) {
(not->duration) = barrtime - (dynhelp2->time);
ins_dyn_event(Track, 'n', 0, 0, 0, not->octave, not->pitch,
not->loud, barrtime, h - barrtime);
}
}
}
dynhelp2 = dynhelp2->next;
}
}
}
/* the following funktion returns one in case of existing a note that begins */
/* on time timepoint, zero else */
/* right region was found -> okflag returns 1 else 0 */
short barre_between(bploc, reftime)
struct bind *bploc;
unsigned long reftime;
{
short rem = 0;
while ((bploc) && ((bploc->time) < reftime)) {
if ((bploc->marker) == 'b') rem = 1;
bploc = bploc->next;
}
return(rem);
}
void detect_note_value(reg, tr, notedurat, flagptr, endptr, begint, bindptr, slurnrpt, pq)
int notedurat, *slurnrpt;
short int pq, *flagptr, tr;
unsigned long *endptr, begint;
struct bind *bindptr;
char reg;
{
int i;
char ok; /* allow slur only to be in one region */
char newslur; /* for setting the slur-begin flag */
short desicion;
/* dnvmark1 */
*flagptr = *flagptr | 0x80;
i = 0;
while ((i<21) && ((NORMFAKTOR * notedurat) > (faktors[i] * pq))) i++;
if (i==21) {
fprintf(stderr,"warning: cut very long note\n");
*flagptr = *flagptr | note_codes[20];
*endptr = begint + (7 * pq);
}
else {
if ((NORMFAKTOR * notedurat) == (faktors[i] * pq)) {
/* dnvmark2: input ok forces a special region */
if (!reg && ((*flagptr) & 0x0100)) ok = 1;
else if (!reg && ((*flagptr) & 0x0200)) ok = 2;
else ok = 0;
desicion = note_with_time(bindptr, notedurat + begint, &dynhelp, &ok);
/* dnvmark3 */
if ((i<15) && (!desicion)) {
if (barre_between(bindptr, begint + (notedurat * 4))) {
/* call it a normal note */
*flagptr = *flagptr | (note_codes[i]);
*endptr = begint + notedurat;
}
else {
/* staccato detected */
*flagptr = *flagptr | ((note_codes[i+6]) + 4);
*endptr = begint + (notedurat * 4);
}
}
else {
/* dnvmark4 */
if (dynhelp) not = (struct Note *) dynhelp->data;
if (((i>=15) && (!desicion)) ||
((desicion) && (!ok)) || (not->slur_nr)) {
/* call it a normal note */
*flagptr = *flagptr | (note_codes[i]);
*endptr = begint + notedurat;
}
else {
/* legato detected */
*flagptr = *flagptr | (note_codes[i]);
*flagptr = *flagptr & 0xff7f;
*endptr = begint + notedurat;
newslur = 0;
if (!(*slurnrpt)) {
newslur = 1;
*slurnrpt = global++;
}
*flagptr = *flagptr | ((not->flags) & 0x0300);
not->flags = not->flags | ((*flagptr) & 0x0300);
not->slur_nr = *slurnrpt;
if (newslur) not->slur_pos |= 0x40;
}
}
}
else {
/* normal note detected */
*flagptr = *flagptr | (note_codes[i]);
*endptr = begint + ((faktors[i] * pq) / NORMFAKTOR);
}
}
if (!(*slurnrpt)) *flagptr = *flagptr & 0xff7f;
}
void insert_notetimes_and_slurs(reg, Track, pq)
int Track;
short int pq;
char reg;
{
akt[Track] = begin[Track];
while (akt[Track]) {
if ((akt[Track]->marker) == 'n') {
not = (struct Note *) akt[Track]->data;
detect_note_value(reg, Track, not->duration, &(not->flags), &(not->end), akt[Track]->time, akt[Track], &(not->slur_nr), pq);
}
akt[Track] = akt[Track]->next;
}
}
void detect_accords(reg, Track)
int Track;
char reg;
{
char attention; /* remembers the region */
/* fourth part deletes the helprest-list */
hr1 = ank;
while (hr1) {
hr2 = hr1->next;
free(hr1);
hr1 = hr2;
}
ank = NULL;
}
void detect_rests(t, regio, pq)
int t; /* number of track */
int pq; /* per quarter */
char regio;
{
unsigned long barrtime;
int taktpart; /* logical part of takt, depends on nom */
short factor;
/* drmark1 */
akt[t] = begin[t];
dynhelp = akt[t];
ank = NULL;
factor = 4; /* default is 4/4 */
taktpart = pq; /* default is 4/4 */
barrtime = 0; /* time of last barre */
while (akt[t]) {
/* jump to next bar */
dynhelp2 = dynhelp;
while ((dynhelp2) && ((dynhelp2->marker) != 'b')) {
if ((dynhelp2->marker) == 't') {
ts = (struct TimeSig *) dynhelp2->data;
taktpart = pq * 4 /(ts->denom);
factor = ts->nom;
}
dynhelp2 = dynhelp2->next;
}
if (dynhelp) {
/* drmark2 */
d = dynhelp;
deal_with_takt(taktpart, barrtime, (regio == 0), factor, regio);
if (regio == 1)
process_helprest(pq, t, barrtime, taktpart, 0x40);
else
process_helprest(pq, t, barrtime, taktpart, 0x80);
if (!regio) {
deal_with_takt(taktpart, barrtime, 0, factor, 1);
process_helprest(pq, t, barrtime, taktpart, 0x40);
}
}
akt[t] = dynhelp2;
if (akt[t]) {
dynhelp = akt[t]->next;
barrtime = akt[t]->time;
}
}
}
void beam_geometry(tr)
int tr; /* number of track */
{
char crit, usedpos[42], helpbpos;
char maxone, helpmaxone, pos, maxb, minb, bestpos, besthigh, bestupperflag;
int upp, low;
short slope;
short measurecounter; /* for debugging with gdb */
char orientflag, valid;
char lowcut, uppcut, realpos, upperflag;
short sl;
long sbpos[42]; /* for storing beam and slur numbers */
unsigned long remtime;
short i, middle;
unsigned short counter;
int loop;
double arg, helparg;
struct bind *lastdealt, *last;
struct Note *notehelp, *prev_note, *helpn, *nohe;
/* bgmark1 */
akt[tr] = begin[tr];
measurecounter = 1;
dynhelp3 = begin[tr]; /* first event in takt */
while (akt[tr]) {
if ((akt[tr]->marker) == 'b') {
/* bgmark2 */
dynhelp3 = akt[tr]->next;
measurecounter++;
}
if ((akt[tr]->marker) == 'n') {
/* bgmark3 */
not = (struct Note *) akt[tr]->data;
if ((!(not->treated)) && (not->beam_nr)) {
/* bgmark4: found begin of beam */
maxb = (not->note_pos) & 0x3f;
minb = maxb;
not->treated = 1;
not->beam_pos = 0x40;
/* reset sbpos-array */
for (i=0; i<42; i++) sbpos[i] = 0;
/* read until first beam note and set slur and beam positions */
dynhelp2 = dynhelp3;
dynhelp = akt[tr];
while (dynhelp2 != dynhelp) {
if ((dynhelp2->marker) == 'n') {
not3 = (struct Note *) dynhelp2->data;
if ((not3->slur_nr) && (!((not3->flags) & 0x80))) {
for (loop= ((not3->slur_pos) & 0x3f) - 2;loop < ((not3->slur_pos) & 0x3f) + 3; loop++)
if ((loop >= 0) && (loop <=41)) sbpos[loop] = (not3->slur_nr);
}
else {
if (not3->slur_nr) {
for (loop= ((not3->slur_pos) & 0x3f) - 5;loop < ((not3->slur_pos) & 0x3f) + 5; loop++)
if ((loop >= 0) && (loop <=41) && (sbpos[loop] == (not3->slur_nr))) sbpos[loop] = 0;
}
}
if ((not3->beam_nr) && (not3->treated) && (!((not3->flags) & 0x40))) {
helpbpos = (not3->beam_pos) & 0x3f;
if ((not3->beam_pos) & 0x80) helpbpos += UPPLOWSHIFT;
else {
if (helpbpos > UPPLOWSHIFT) helpbpos -= UPPLOWSHIFT;
else helpbpos = 0;
}
if (helpbpos > 41) helpbpos = 41;
for (loop = helpbpos -2; loop < helpbpos + 3; loop++)
if ((loop >= 0) && (loop <=41)) sbpos[loop] = (not3->beam_nr);
}
else if ((not3->beam_nr) && (not3->treated)) {
helpbpos = (not3->beam_pos) & 0x3f;
if ((not3->beam_pos) & 0x80) helpbpos += UPPLOWSHIFT;
else {
if (helpbpos > UPPLOWSHIFT) helpbpos -= UPPLOWSHIFT;
else helpbpos = 0;
}
if (helpbpos > 41) helpbpos = 41;
for (loop = helpbpos -5; loop < helpbpos + 6; loop++)
if ((loop >= 0) && (loop <=41) && (sbpos[loop] == (not3->beam_nr))) sbpos[loop] = 0;
}
}
dynhelp2 = dynhelp2->next;
}
/* bgmark5 */
/* now start with processing the beam */
lastdealt = akt[tr];
/* reset the valid area array */
for (i=0; i<42; i++) usedpos [i] = 0;
/* specify the first valid region */
upp = not->note_pos & 0x3f;
while ((upp < 41) && (!(sbpos[upp]))) upp++;
low = not->note_pos & 0x3f;
while ((low > 0) && (!(sbpos[low]))) low--;
for (i=low; i<=upp; i++) usedpos [i] = 1;
usedpos [not->note_pos & 0x3f] = 2;
remtime = dynhelp->time;
counter = 0;
/* bgmark6 */
/* jump to last possible note of current beam */
crit = 1;
last = dynhelp2;
nohe = (struct Note *) dynhelp2->data;
if ((nohe->flags) & 0x40) crit = 0;
while (crit) {
dynhelp = dynhelp->next;
if ((dynhelp) && ((dynhelp->time) > remtime) && ((dynhelp->marker == 'n') || (dynhelp->marker == 'r'))) {
counter += 2;
remtime = dynhelp->time;
}
if ((dynhelp) && ((dynhelp->marker) == 'n')) {
not2 = (struct Note *) dynhelp->data;
if ((not->beam_nr) == (not2->beam_nr)) {
if (!usedpos[(not2->note_pos) & 0x3f]) {
/* have to split beam */
dynhelp = lastdealt;
crit = 0;
if (akt[tr] == lastdealt) {
not->beam_nr = 0;
not->beam_pos = 0;
not2 = not;
}
else {
not3 = (struct Note *) lastdealt->data;
not3->flags |= 0x40;
if (!((not2->flags) & 0x40)) {
not2->beam_pos |= 0x40;
global++;
not2->beam_nr = global;
lastdealt = lastdealt->next;
while (lastdealt) {
if ((lastdealt->marker) == 'n') {
notehelp = (struct Note *) lastdealt->data;
if ((notehelp->beam_nr) == (not->beam_nr)) {
notehelp->beam_nr = global;
if ((notehelp->flags) & 0x40) lastdealt = NULL;
}
}
if (lastdealt) lastdealt = lastdealt->next;
}
}
else {
not2->flags &= 0xffbf;
not2->beam_nr = 0;
}
not2 = not3;
}
}
else {
/* deal with printable beam note */
last = dynhelp;
lastdealt = dynhelp;
helpn = not2;
while (helpn->accord_next) helpn = helpn->accord_next;
if (((helpn->note_pos) & 0x3f) > maxb) maxb = (helpn->note_pos) & 0x3f;
if (((not2->note_pos) & 0x3f) < minb) minb = (not2->note_pos) & 0x3f;
if ((not2->flags) & 0x40) crit = 0;
not2->treated = 1;
usedpos[(not2->note_pos) & 0x3f] = 2;
if (not2->slur_nr) {
if ((not2->slur_pos) & 0x80)
for (i=((not2->slur_pos) & 0x3f) - 2; i<42; i++) usedpos[i] = 0;
else
for (i=((not2->slur_pos) & 0x3f) + 2; i>=0; i--) usedpos[i] = 0;
}
}
}
else {
if (not2->slur_nr) {
upp = 0;
for (i=(not2->slur_pos & 0x3f); i<42; i++) if (usedpos[i]) upp++;
low = 0;
for (i=(not2->slur_pos & 0x3f); i>=0; i--) if (usedpos[i]) low++;
if (upp > low)
for (i=(not2->slur_pos & 0x3f); i>=0; i--) usedpos[i] = 0;
else
for (i=(not2->slur_pos & 0x3f); i<42; i++) usedpos[i] = 0;
}
if (not2->treated) {
helpbpos = (not2->beam_pos) & 0x3f;
if ((not2->beam_pos) & 0x80) helpbpos += UPPLOWSHIFT;
else if (helpbpos > UPPLOWSHIFT)
helpbpos -= UPPLOWSHIFT;
else helpbpos = 0;
for (loop=helpbpos-2; loop < (helpbpos + 3); loop++)
if ((loop >= 0) && (loop <= 41)) usedpos[loop] = 0;
}
usedpos[(not2->note_pos) & 0x3f] = 2;
}
}
if (dynhelp == NULL) crit = 0;
}
/* check middle region for setting the beam position */
/* (only if not already found one) */
valid = 1;
if (pos == 0x70) {
/* search a nice beam position between minb and maxb */
/* only when MINBEAMBROAD is valid */
if ((maxb - minb) < MINBEAMBROAD) valid = 0;
void calculate_rest_positions(tr)
int tr;
{
char full[42]; /* used positions */
char bestpos; /* for storing the best position */
char highcount; /* counts free positions */
char to, mid, from1, to1, from2, to2; /* variables for looping */
int i; /* for looping and indexing */
long cur_slur[42], cur_beam[42]; /* positions used for slurs and beams */
unsigned long rtime; /* store time information */
char goodpos, goodhigh; /* temporal best */
char minbeam, maxbeam; /* to specify the region from beamed note to the beam itself */
short restcount; /* counts the rests of time rtime */
char topos; /* store the slope */
char upperto; /* setting a loopto value */
short slope; /* setting topos */
short measurecounter; /* is useful for gdb to stop at a given measure */
/* crpmark1 */
measurecounter = 1;
akt[tr] = begin[tr];
for (i=0; i<42; i++) {
cur_slur[i] = 0;
cur_beam[i] = 0;
}
while (akt[tr]) {
if ((akt[tr]->marker) == 'b') measurecounter++;
if ((akt[tr]->marker) == 'r') {
/* crpmark2 */
restcount = 1;
rtime = akt[tr]->time;
for (i=0; i<42; i++) {
if (cur_slur[i] || cur_beam[i]) full[i] = 1;
else full[i] = 0;
}
dynhelp = akt[tr]; /* store the begin of rest pointer */
dynhelp3 = akt[tr]; /* indicates later the last rest of rtime */
akt[tr] = akt[tr]->next;
while ((akt[tr]) && (rtime == (akt[tr]->time))) {
/* deal with rests and notes of time rtime */
if ((akt[tr]->marker) == 'n') {
not = (struct Note *) akt[tr]->data;
not2 = not;
while (not2->accord_next) not2 = not2->accord_next;
if (!(not->beam_nr)) {
if (((not->flags) & 0x30) == 0x30) {
/* whole note without any stem */
full[(not->note_pos) & 0x3f] = 1;
}
else {
if ((not->flags) & 0x400) {
/* lower stem */
if (((not->note_pos) & 0x3f) > LAMBDA)
to = ((not->note_pos) & 0x3f) - LAMBDA;
else to = 0;
for (i=((not2->note_pos) & 0x3f); i>=to; i-- ) full[i] = 1;
}
else {
/* upper stem */
to = ((not2->note_pos) & 0x3f) + LAMBDA;
if (to > 41) to = 41;
for (i=((not->note_pos) & 0x3f); i<=to; i++ ) full[i] = 1;
}
}
}
else {
/* deal with beamed note */
to = not->beam_pos & 0x3f;
if ((not->beam_pos) & 0x80) to += UPPLOWSHIFT;
else if (to > UPPLOWSHIFT) to -= UPPLOWSHIFT;
else to = 0;
if (to > 41) to = 41;
slope = (not->flags) & 0x7800;
topos = (slope >> 11) & 0xf;
if ((not->flags) & 0x8000) {
/* falling beam */
if (to > topos) minbeam = to - topos;
else minbeam = 0;
maxbeam = to;
}
else {
/* raising beam */
minbeam = to;
maxbeam = to + topos;
if (maxbeam > 41) maxbeam = 41;
}
if (((not2->note_pos) & 0x3f) > maxbeam) maxbeam = ((not2->note_pos) & 0x3f);
if (((not->note_pos) & 0x3f) < minbeam) minbeam = ((not->note_pos) & 0x3f);
for (i=minbeam; i<=maxbeam; i++) full[i] = 1;
}
if ((not->slur_nr) && ((not->slur_pos) & 0x40)) {
/* slur begins here */
if (not->slur_pos & 0x80) {
/* upper slur */
to = SLURWIDE + ((not->slur_pos) & 0x3f);
if (to > 41) to = 41;
for (i=((not->slur_pos) & 0x3f); i<=to; i++) full[i] = 1;
}
else {
/* lower slur */
if (((not->slur_pos) & 0x3f) > SLURWIDE)
to = ((not->slur_pos) & 0x3f) - SLURWIDE;
else to = 0;
for (i=to; i<=((not->slur_pos) & 0x3f); i++) full[i] = 1;
}
}
}
else {
if ((akt[tr]->marker) == 'r') {
restcount++;
dynhelp3 = akt[tr];
}
else {
/* after rests can only be notes of the same time */
fprintf(stderr, "unknown element found\n");
exit(10);
}
}
akt[tr] = akt[tr]->next;
}
/* crpmark4 */
highcount = 0;
goodhigh = 0;
bestpos = 60;
i = from1;
while (i<to1) {
if (!full[i]) {
highcount++;
if (highcount >= (resthigh[re->kind] + RESTTOLERANCE)) {
bestpos = i - resthigh[re->kind] - HALFRESTTOLERANCE;
i = 40;
}
}
else {
if (highcount > goodhigh) {
goodhigh = highcount;
goodpos = i - highcount;
}
highcount = 0;
}
i++;
}
/* rests (except of pause and hpause) can use */
/* an small upper area because there is enough space */
highcount = 0;
if ((bestpos == 60) && ((re->kind) < 5)) {
while (!full[i]) {
i--;
highcount++;
}
if (highcount > 2) bestpos = i + 2;
}
/* crpmark5 */
highcount = 0;
i = from2;
while (i>to2) {
if (!full[i]) {
highcount++;
if ((highcount > (resthigh[re->kind] + RESTTOLERANCE)) &&
((abs(bestpos + (halfresthigh[re->kind]) - mid)) >
(abs((i + HALFRESTTOLERANCE) + (halfresthigh[re->kind]) - mid)))) {
bestpos = i + HALFRESTTOLERANCE;
i = 1;
}
}
else {
if (highcount > goodhigh) {
goodhigh = highcount;
goodpos = i;
}
highcount = 0;
}
i--;
}
/* crpmark7 */
/* half and whole rests needs an odd position */
if ((re->kind) > 4) bestpos |= 0x1;
re->position |= bestpos;
upperto = bestpos + 2 + (resthigh[re->kind]);
if (upperto > 41) upperto = 41;
for (i=bestpos; i<=upperto; i++) full[i] = 1;
restcount--;
if (restcount) {
dynhelp = dynhelp->next;
if ((dynhelp->marker) != 'r') {
fprintf(stderr, "error: deal non rest like rest\n");
exit(10);
}
}
} while (restcount);
akt[tr] = dynhelp3;
}
if ((akt[tr]->marker) == 'n') {
/* crpmark8 */
not3 = (struct Note *) akt[tr]->data;
if ((not3->beam_nr) && (((not3->beam_pos) & 0x40) || ((not3->flags) & 0x40))) {
/* begin or end of beam */
to = not3->beam_pos & 0x3f;
if ((not3->beam_pos) & 0x80) to += UPPLOWSHIFT;
else if (to > UPPLOWSHIFT) to -= UPPLOWSHIFT;
else to = 0;
if (to > 41) to = 41;
slope = (not3->flags) & 0x7800;
topos = (slope >> 11) & 0xf;
if ((not3->flags) & 0x8000) {
/* falling beam */
if (to > topos) topos = to - topos;
else topos = 0;
if (topos > 2) topos -= 2;
else topos = 0;
to += 2;
if (to > 41) to = 41;
if ((not3->beam_pos) & 0x40)
for (i=topos; i<=to; i++) cur_beam[i] = not3->beam_nr;
else {
for (i=topos; i<=to; i++)
if (cur_beam[i] == not3->beam_nr) cur_beam[i] = 0;
}
}
else {
/* raising beam */
topos += to;
if (topos > 41) topos = 41;
if (to > 2) to -= 2;
else to = 0;
topos += 2;
if (topos > 41) topos = 41;
if ((not3->beam_pos) & 0x40)
for (i=to; i<=topos; i++) cur_beam[i] = not3->beam_nr;
else {
for (i=to; i<=topos; i++)
if (cur_beam[i] == not3->beam_nr) cur_beam[i] = 0;
}
}
}
if ((not3->slur_nr) && (((not3->slur_pos) & 0x40) || ((not3->flags) & 0x80))) {
/* begin or end of slur */
if (not3->slur_pos & 0x80) {
/* upper slur */
to = SLURWIDE + (not3->slur_pos & 0x3f);
if (to > 41) to = 41;
if ((not3->slur_pos) & 0x40)
for (i=((not3->slur_pos) & 0x3f); i!=to; i++)
cur_slur[i] = not3->slur_nr;
else {
for (i=((not3->slur_pos) & 0x3f); i!=to; i++)
if (cur_slur[i] == not3->slur_nr) cur_slur[i] = 0;
}
}
else {
/* lower slur */
if (((not3->slur_pos) & 0x3f) > SLURWIDE)
to = (not3->slur_pos & 0x3f) - SLURWIDE;
else to = 0;
if ((not3->slur_pos) & 0x40)
for (i=to; i!=((not3->slur_pos) & 0x3f); i++)
cur_slur[i] = not3->slur_nr;
else {
for (i=to; i!=((not3->slur_pos) & 0x3f); i++)
if (cur_slur[i] == not3->slur_nr) cur_slur[i] = 0;
}
}
}
}
akt[tr] = akt[tr]->next;
}
}
void ins_levent(tn, type, ltime, value)
int tn;
char type;
unsigned long ltime;
char value;
{
/* this function requires the correct setting of dy to the begin of track */
/* and of dy2 to NULL */
void set_loudness_infos(tnr)
int tnr;
{
int i, j, k, l, m, n, sum, count, criterium, loop, loopto;
unsigned long time, stime;
char staticflag, dynamicflag, dval, sval;
/* slimark1 */
akt[tnr] = begin[tnr];
dy = begin[tnr];
dy2 = NULL;
staticflag = 1;
dynamicflag = 0;
j = 0;
for (i=0; i<6; i++) {
if ((loudrecarr[i] = (struct loudrec *) malloc (sizeof(struct loudrec))) == NULL) {
fprintf(stderr, "malloc error\n");
exit(10);
}
loudrecarr[i]->time = 0;
}
/* slimark2 */
while (akt[tnr]) {
if ((akt[tnr]->marker) == 'n') {
time = akt[tnr]->time;
dynhelp = akt[tnr];
sum = 0;
count = 0;
while (dynhelp && (time == (dynhelp->time))) {
not = (struct Note *) dynhelp->data;
sum += not->loud;
count++;
dynhelp = dynhelp->next;
}
criterium = sum / count;
i = 0;
while ((i < 7) && (loudarray[i] < criterium)) i++;
if (staticflag) {
ins_levent(tnr, 1, time, i + 1);
staticflag = 0;
}
/* fill the record */
loudrecarr[j]->time = time;
loudrecarr[j]->criterium = criterium;
loudrecarr[j]->range = i;
/* slimark3 */
j = modulo4pp[j];
if (loudrecarr[j]->time) {
k = modulo4pp[j];
l = modulo4pp[k];
m = modulo4pp[l];
n = modulo4pp[m];
i = modulo4pp[n];