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

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

Use standard integer types.

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