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

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

Zero redundant declarations.

  • 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
34/*
35
36*/
37
38struct n_entry *fcnote(int16_t grp, int16_t tnote)
39{
40 register struct n_entry *bp, *ep;
41 register int16_t en, eg, et;
42 int32_t t_left;
43
44 /* setup initial search parameters */
45
46 bp = (struct n_entry *)ep_adj(p_cur, 0, ctime); /* cursor loc */
47 t_left = t_cur - TO_LFT; /* time at left edge of screen */
48 p_nbeg = (struct n_entry *)E_NULL; /* no begin yet */
49 p_nend = (struct n_entry *)E_NULL; /* no end yet */
50 t_note = 0L; /* no duration yet */
51
52 FOREVER { /* scan left from cursor */
53
54 et = 0x007F & bp->e_type;
55 en = bp->e_note;
56 eg = bp->e_group;
57
58 if ((bp->e_time LT t_left) OR (et EQ EV_SCORE)) {
59
60 /* done -- can't see begin, or note not there */
61
62 return(E_NULL);
63
64 } else if ((et EQ EV_NEND) AND (en EQ tnote) AND (eg EQ grp)) {
65
66 /* done -- hit note end first -- notes overlap */
67
68 return(E_NULL);
69/*
70
71*/
72 } else if ((et EQ EV_NBEG) AND (en EQ tnote) AND (eg EQ grp)) {
73
74 /* found note begin -- possible note starting at bp */
75
76 ep = bp->e_fwd; /* scan to right of begin */
77
78 FOREVER { /* scan right from note begin */
79
80 et = 0x007F & ep->e_type; /* event type */
81 en = ep->e_note; /* note */
82 eg = ep->e_group; /* group */
83
84 if ((et EQ EV_NBEG) AND (en EQ tnote) AND
85 (eg EQ grp)) {
86
87 /* hit note begin first -- done -- notes overlap */
88
89 return(E_NULL);
90/*
91
92*/
93 } else if ((et EQ EV_NEND) AND (en EQ tnote) AND
94 (eg EQ grp)) {
95
96 /* hit note end -- done -- found complete note */
97
98 p_nbeg = bp; /* note begin */
99 p_nend = ep; /* note end */
100 t_note = ep->e_time - bp->e_time;
101 return(bp);
102
103 } else if (et EQ EV_FINI) {
104
105 /* hit score end -- done -- can't find end */
106
107 return(E_NULL);
108 }
109
110 ep = ep->e_fwd; /* scan right */
111
112 } /* end FOREVER */
113
114 } /* end if */
115
116 bp = bp->e_bak; /* scan left */
117
118 } /* end FOREVER */
119}
120
Note: See TracBrowser for help on using the repository browser.