source: buchla-68k/ram/fcnote.c@ b2691c2

Last change on this file since b2691c2 was fa38804, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Removed form-feed comments.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 =============================================================================
3 fcnote.c -- MIDAS-VII note edit -- find complete note
4 Version 1 -- 1988-05-17 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10#define TO_LFT (TO_BAK + 1)
11
12/*
13 =============================================================================
14 fcnote() -- find complete note
15
16 Arguments:
17
18 grp group number
19 tnote note number
20
21 ctime cursor time to search from
22
23 Returns:
24
25 E_NULL couldn't find the note
26 ptr pointer to the begin event for the note
27
28 p_nbeg pointer to note begin event
29 p_nend pointer to note end event
30 t_note duration of the note
31 =============================================================================
32*/
33
34struct n_entry *fcnote(int16_t grp, int16_t tnote)
35{
36 register struct n_entry *bp, *ep;
37 register int16_t en, eg, et;
38 int32_t t_left;
39
40 /* setup initial search parameters */
41
42 bp = (struct n_entry *)ep_adj(p_cur, 0, ctime); /* cursor loc */
43 t_left = t_cur - TO_LFT; /* time at left edge of screen */
44 p_nbeg = (struct n_entry *)E_NULL; /* no begin yet */
45 p_nend = (struct n_entry *)E_NULL; /* no end yet */
46 t_note = 0L; /* no duration yet */
47
48 FOREVER { /* scan left from cursor */
49
50 et = 0x007F & bp->e_type;
51 en = bp->e_note;
52 eg = bp->e_group;
53
54 if ((bp->e_time LT t_left) OR (et EQ EV_SCORE)) {
55
56 /* done -- can't see begin, or note not there */
57
58 return(E_NULL);
59
60 } else if ((et EQ EV_NEND) AND (en EQ tnote) AND (eg EQ grp)) {
61
62 /* done -- hit note end first -- notes overlap */
63
64 return(E_NULL);
65
66 } else if ((et EQ EV_NBEG) AND (en EQ tnote) AND (eg EQ grp)) {
67
68 /* found note begin -- possible note starting at bp */
69
70 ep = bp->e_fwd; /* scan to right of begin */
71
72 FOREVER { /* scan right from note begin */
73
74 et = 0x007F & ep->e_type; /* event type */
75 en = ep->e_note; /* note */
76 eg = ep->e_group; /* group */
77
78 if ((et EQ EV_NBEG) AND (en EQ tnote) AND
79 (eg EQ grp)) {
80
81 /* hit note begin first -- done -- notes overlap */
82
83 return(E_NULL);
84
85 } else if ((et EQ EV_NEND) AND (en EQ tnote) AND
86 (eg EQ grp)) {
87
88 /* hit note end -- done -- found complete note */
89
90 p_nbeg = bp; /* note begin */
91 p_nend = ep; /* note end */
92 t_note = ep->e_time - bp->e_time;
93 return(bp);
94
95 } else if (et EQ EV_FINI) {
96
97 /* hit score end -- done -- can't find end */
98
99 return(E_NULL);
100 }
101
102 ep = ep->e_fwd; /* scan right */
103
104 } /* end FOREVER */
105
106 } /* end if */
107
108 bp = bp->e_bak; /* scan left */
109
110 } /* end FOREVER */
111}
112
Note: See TracBrowser for help on using the repository browser.