#include "wavtool.h"
+static struct {
+ int x;
+ int y;
+} typedef env_point;
-int modifyWave(int16_t w[], int w_B, int argc, char *argv[])
+int get_points(int p[], int v[], int argc, char *argv[], int w_B);
+int actually_apply_envelope(int x[], int y[]); /* ints start at x[1] */
+
+int modifyWave(int16_t w[], int w_B, int argc, char *argv[]) /* w[w_B/2] */
{
/* DESCRIPTION OF ARGUMENTS
* as to the arguments --
* OH also p sure the envelope defines like volume LMAO
*/
//so the best way to do this is math probably??
+ int x[5]; int y[5];
+ get_points(x, y, argc, argv, w_B);
+
return 1;
};
+
+int get_points(int p[], int v[], int argc, char *argv[], int w_B)
+{
+ /* grab the points and put them into the array */
+ /* array names are so p1, etc make sense */
+ /* also p0/v0 are 0 unless error ig */
+ /* envelope stuff starts at argv[5] */
+ p[0] = 0;
+ v[0] = 0;
+ int i = 5;
+ for (i = 5; i < argc; i++) {
+ switch (i - 5) {
+ case 0: p[1] = arg_to_float(argv[i]); break;
+ case 1: p[2] = arg_to_float(argv[i]); break;
+ case 2: p[3] = arg_to_float(argv[i]); break;
+ case 3: v[1] = arg_to_float(argv[i]); break;
+ case 4: v[2] = arg_to_float(argv[i]); break;
+ case 5: v[3] = arg_to_float(argv[i]); break;
+ case 6: v[4] = arg_to_float(argv[i]); break;
+ case 7: break;
+ case 8: p[4] = arg_to_float(argv[i]); break;
+ case 9: p[5] = arg_to_float(argv[i]); break;
+ case 10: v[5] = arg_to_float(argv[i]); break;
+ };
+ };
+ if ((i-5) < 5) { /* need p3 v1 v2 v3 */
+ p[3] = w_B * 2;
+ v[1] = 0;
+ v[2] = 100;
+ v[3] = 100;
+ };
+ if ((i-5) < 8) {
+ v[4] = 0;
+ p[4] = w_B * 2;
+ };
+ if ((i-5) < 8) {
+ v[5] = 0;
+ p[5] = 0;
+ };
+ /* Fix the like weird thing. that i hate. */
+ p[3] = w_B*2 - p[3];
+ p[4] = w_B*2 - p[4];
+ return 0;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+