commit 5fc65fa54283cee6b1fc844c14cd22cedb23c2c3
parent 132132406204d8b1521ae4d65a5b9175724e7e6e
Author: rpa <rpa@laika>
Date: Sun, 5 Feb 2023 19:05:59 +0000
wave/track: start sequence editor
Diffstat:
1 file changed, 53 insertions(+), 1 deletion(-)
diff --git a/src/wave/track.c b/src/wave/track.c
@@ -21,6 +21,7 @@ enum {
NoteErr = 0xff,
};
+typedef struct Sequence Sequence;
typedef struct Pattern Pattern;
typedef struct Step Step;
typedef struct Synthctl Synthctl;
@@ -36,6 +37,12 @@ struct Pattern {
Step *chan[ChanMax];
};
+struct Sequence {
+ int chn;
+ int len;
+ int *p;
+};
+
struct Synthctl {
int play;
int pattern;
@@ -56,6 +63,7 @@ int n;
char cbuf[BufSize], *args[64];
s16int *wt;
Synthctl sctl;
+Sequence seq;
void usage(void);
void trackedit(void);
@@ -66,6 +74,7 @@ char * note2str(int);
void patternset(Step *, int, char **);
int str2note(char *);
void threadsynth(void *);
+void seqedit(void);
void
threadmain(int argc, char **argv)
@@ -99,6 +108,10 @@ trackedit(void)
while (read(0, cbuf, BufSize) > 0) {
n = tokenize(cbuf, args, 64);
if (n != 0) switch (args[0][0]) {
+ case 's':
+ if (n != 1) goto err;
+ seqedit();
+ break;
case 'p':
if (n != 2) goto err;
patternedit(args[1]);
@@ -108,10 +121,18 @@ trackedit(void)
else loadwt(args[1]);
break;
case 'h':
- print("(h)elp, (q)uit, wave(t)able, (p)attern\n");
+ print("(h)elp, (q)uit, wave(t)able, (p)attern, (s)equence\n");
break;
case 'q':
return;
+ case 'P':
+ sctl.PC = 0;
+ sctl.play = 1;
+ break;
+ case 'S':
+ sctl.play = 0;
+ sctl.PC = 0;
+ break;
default:
err:
print("?\n");
@@ -327,3 +348,34 @@ threadsynth(void *v)
} else buf[i] = 0;
}
}
+
+void
+seqedit(void)
+{
+ char *ps = "s% ";
+ memset(cbuf, 0, BufSize);
+ print("%s", ps);
+ while (read(0, cbuf, BufSize) > 0) {
+ n = tokenize(cbuf, args, 64);
+ if (n != 0) switch (args[0][0]) {
+ case 'h':
+ print("(h)elp, (q)uit\n");
+ break;
+ case 'q':
+ return;
+ case 'P':
+ sctl.PC = 0;
+ sctl.play = 1;
+ break;
+ case 'S':
+ sctl.play = 0;
+ sctl.PC = 0;
+ break;
+ default:
+ err:
+ print("?\n");
+ }
+ print("%s", ps);
+ memset(cbuf, 0, BufSize);
+ }
+}