source: buchla-68k/orig/RAM/FCNOTE.C@ 73dd55f

Last change on this file since 73dd55f was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

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