From b2d0c97e0ca7b7eb0a7195ddbf263b9953171e66 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Fri, 14 Jan 2011 13:38:54 +0100 Subject: Moved lfos and sample-and-hold in own source file --- synth/Makefile | 2 +- synth/in_synth_cli.cpp | 40 ++++++++++++++++++++++++++ synth/jack.cpp | 37 ++---------------------- synth/lfos.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ synth/lfos.h | 9 ++++++ synth/main.cpp | 22 ++------------- 6 files changed, 132 insertions(+), 55 deletions(-) create mode 100644 synth/lfos.cpp create mode 100644 synth/lfos.h (limited to 'synth') diff --git a/synth/Makefile b/synth/Makefile index 8109bc8..0db09da 100644 --- a/synth/Makefile +++ b/synth/Makefile @@ -3,7 +3,7 @@ CFLAGS=-Wall -g CXXFLAGS=$(CFLAGS) LDFLAGS=-lm `pkg-config --cflags --libs jack` -OBJ=channel.o cli.o defines.o envelope.o filter.o globals.o jack.o load.o main.o note.o note_skel.o parser.o programs.o readwave.o util.o note_loader.o in_synth_cli.o communication.o shared_object_manager.o +OBJ=channel.o cli.o defines.o envelope.o filter.o globals.o jack.o load.o main.o note.o note_skel.o parser.o programs.o readwave.o util.o note_loader.o in_synth_cli.o communication.o shared_object_manager.o lfos.o BIN=synth DEPENDFILE = .depend diff --git a/synth/in_synth_cli.cpp b/synth/in_synth_cli.cpp index dd9260f..ece806b 100644 --- a/synth/in_synth_cli.cpp +++ b/synth/in_synth_cli.cpp @@ -9,6 +9,7 @@ #include "communication.h" #include "globals.h" #include "load.h" +#include "lfos.h" using namespace std; @@ -64,6 +65,18 @@ void lock_and_load_program(int prg_no, string file) do_request(prg_no, false); } +void lock_and_change_lfo(int lfo_no, float freq) +{ + do_request(-1, true); + + uninit_lfo(lfo_no); + lfo_freq_hz[lfo_no]=freq; + init_lfo(lfo_no); + + do_request(-1, false); +} + + void do_in_synth_cli() { string input; @@ -470,6 +483,33 @@ void do_in_synth_cli() cout << "error: channel-number must be one of 0.."<=0) && (num0) + lock_and_change_lfo(num,freq); + else + cout << "error: frequency must be a positive number"< +#include + +#include "lfos.h" +#include "globals.h" +#include "fixed.h" +#include "defines.h" + +void uninit_lfo(int i) +{ + if (lfo[i]) + { + for (int j=0;j