zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 3fe69a808c3c665f5747b32e3520a8fb55a7533c
parent 59079cae6988e3db0cea8e286931765da4061abd
Author: fundamental <[email protected]>
Date:   Tue, 28 Apr 2015 18:28:36 -0400

Remove Midi 'Dump' Functionality

If need be this commit can be reverted or a simple external tool
can be made to replicate the functionality of the 'Dump' class

Diffstat:
Msrc/Misc/CMakeLists.txt | 1-
Msrc/Misc/Config.cpp | 18------------------
Msrc/Misc/Config.h | 2--
Dsrc/Misc/Dump.cpp | 121-------------------------------------------------------------------------------
Dsrc/Misc/Dump.h | 63---------------------------------------------------------------
Msrc/Misc/Master.cpp | 2--
Msrc/Misc/Master.h | 2--
Msrc/Nio/InMgr.cpp | 3---
Msrc/UI/ConfigUI.fl | 29-----------------------------
Msrc/main.cpp | 10----------
10 files changed, 0 insertions(+), 251 deletions(-)

diff --git a/src/Misc/CMakeLists.txt b/src/Misc/CMakeLists.txt @@ -3,7 +3,6 @@ include_directories(${MXML_INCLUDE_DIR}) set(zynaddsubfx_misc_SRCS Misc/Bank.cpp Misc/Config.cpp - Misc/Dump.cpp Misc/Master.cpp Misc/Microtonal.cpp Misc/Part.cpp diff --git a/src/Misc/Config.cpp b/src/Misc/Config.cpp @@ -46,14 +46,10 @@ void Config::init() cfg.LinuxOSSSeqInDev = new char[MAX_STRING_SIZE]; snprintf(cfg.LinuxOSSSeqInDev, MAX_STRING_SIZE, "/dev/sequencer"); - cfg.DumpFile = "zynaddsubfx_dump.txt"; - cfg.WindowsWaveOutId = 0; cfg.WindowsMidiInId = 0; cfg.BankUIAutoClose = 0; - cfg.DumpNotesToFile = 0; - cfg.DumpAppend = 1; cfg.GzipCompression = 3; @@ -168,16 +164,6 @@ void Config::readConfig(const char *filename) 0, 1); - cfg.DumpNotesToFile = xmlcfg.getpar("dump_notes_to_file", - cfg.DumpNotesToFile, - 0, - 1); - cfg.DumpAppend = xmlcfg.getpar("dump_append", - cfg.DumpAppend, - 0, - 1); - cfg.DumpFile = xmlcfg.getparstr("dump_file", ""); - cfg.GzipCompression = xmlcfg.getpar("gzip_compression", cfg.GzipCompression, 0, @@ -259,10 +245,6 @@ void Config::saveConfig(const char *filename) xmlcfg->addpar("swap_stereo", cfg.SwapStereo); xmlcfg->addpar("bank_window_auto_close", cfg.BankUIAutoClose); - xmlcfg->addpar("dump_notes_to_file", cfg.DumpNotesToFile); - xmlcfg->addpar("dump_append", cfg.DumpAppend); - xmlcfg->addparstr("dump_file", cfg.DumpFile); - xmlcfg->addpar("gzip_compression", cfg.GzipCompression); xmlcfg->addpar("check_pad_synth", cfg.CheckPADsynth); diff --git a/src/Misc/Config.h b/src/Misc/Config.h @@ -40,10 +40,8 @@ class Config int SampleRate, SoundBufferSize, OscilSize, SwapStereo; int WindowsWaveOutId, WindowsMidiInId; int BankUIAutoClose; - int DumpNotesToFile, DumpAppend; int GzipCompression; int Interpolation; - std::string DumpFile; std::string bankRootDirList[MAX_BANK_ROOT_DIRS], currentBankDir; std::string presetsDirList[MAX_BANK_ROOT_DIRS]; int CheckPADsynth; diff --git a/src/Misc/Dump.cpp b/src/Misc/Dump.cpp @@ -1,121 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.cpp - It dumps the notes to a text file - - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include <stdlib.h> -#include <time.h> -#include "Util.h" -#include "Dump.h" - -Dump dump; - -Dump::Dump() -{ - file = NULL; - tick = 0; - k = 0; - keyspressed = 0; -} - -Dump::~Dump() -{ - if(file != NULL) { - int duration = tick * synth->buffersize_f / synth->samplerate_f; - fprintf( - file, - "\n# statistics: duration = %d seconds; keyspressed = %d\n\n\n\n", - duration, - keyspressed); - fclose(file); - } -} - -void Dump::startnow() -{ - if(file != NULL) - return; //the file is already open - - if(config.cfg.DumpNotesToFile != 0) { - if(config.cfg.DumpAppend != 0) - file = fopen(config.cfg.DumpFile.c_str(), "a"); - else - file = fopen(config.cfg.DumpFile.c_str(), "w"); - if(file == NULL) - return; - if(config.cfg.DumpAppend != 0) - fprintf(file, "%s", "#************************************\n"); - - time_t tm = time(NULL); - - fprintf(file, "#date/time = %s\n", ctime(&tm)); - fprintf(file, "#1 tick = %g milliseconds\n", - synth->buffersize_f * 1000.0f / synth->samplerate_f); - fprintf(file, "SAMPLERATE = %d\n", synth->samplerate); - fprintf(file, "TICKSIZE = %d #samples\n", synth->buffersize); - fprintf(file, "\n\nSTART\n"); - } -} - -void Dump::inctick() -{ - tick++; -} - - -void Dump::dumpnote(char chan, char note, char vel) -{ - if(file == NULL) - return; - if(note == 0) - return; - if(vel == 0) - fprintf(file, "n %d -> %d %d \n", tick, chan, note); //note off - else - fprintf(file, "N %d -> %d %d %d \n", tick, chan, note, vel); //note on - - if(vel != 0) - keyspressed++; -#ifndef JACKAUDIOOUT - if(k++ > 25) { - fflush(file); - k = 0; - } -#endif -} - -void Dump::dumpcontroller(char chan, unsigned int type, int par) -{ - if(file == NULL) - return; - switch(type) { - case C_pitchwheel: - fprintf(file, "P %d -> %d %d\n", tick, chan, par); - break; - default: - fprintf(file, "C %d -> %d %d %d\n", tick, chan, type, par); - break; - } -#ifndef JACKAUDIOOUT - if(k++ > 25) { - fflush(file); - k = 0; - } -#endif -} diff --git a/src/Misc/Dump.h b/src/Misc/Dump.h @@ -1,63 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - Dump.h - It dumps the notes to a text file - - Copyright (C) 2002-2005 Nasca Octavian Paul - Author: Nasca Octavian Paul - - This program is free software; you can redistribute it and/or modify - it under the terms of version 2 of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License (version 2 or later) for more details. - - You should have received a copy of the GNU General Public License (version 2) - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#ifndef DUMP_H -#define DUMP_H - -#include <stdio.h> - -/**Object used to dump the notes into a text file - * \todo see if this object should have knowledge about the file - * that it will write to - * \todo upgrade from stdio to iostream*/ -class Dump -{ - public: - /**Constructor*/ - Dump(); - /**Destructor - * Closes the dumpfile*/ - ~Dump(); - /**Open dumpfile and prepare it for dumps - * \todo see if this fits better in the constructor*/ - void startnow(); - /**Tick the timestamp*/ - void inctick(); - /**Dump Note to dumpfile - * @param chan The channel of the note - * @param note The note - * @param vel The velocity of the note*/ - void dumpnote(char chan, char note, char vel); - /** Dump the Controller - * @param chan The channel of the Controller - * @param type The type - * @param par The value of the controller - * \todo figure out what type is exactly meaning*/ - void dumpcontroller(char chan, unsigned int type, int par); - - private: - FILE *file; - int tick; - int k; //This appears to be a constant used to flush the file - //periodically when JACK is used - int keyspressed; -}; -#endif diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp @@ -781,8 +781,6 @@ void Master::AudioOut(float *outl, float *outr) //update the LFO's time LFOParams::time++; - - dump.inctick(); } //TODO review the respective code from yoshimi for this diff --git a/src/Misc/Master.h b/src/Misc/Master.h @@ -30,12 +30,10 @@ #include "Bank.h" #include "Recorder.h" -#include "Dump.h" #include "../Params/Controller.h" class Allocator; -extern Dump dump; struct vuData { vuData(void); diff --git a/src/Nio/InMgr.cpp b/src/Nio/InMgr.cpp @@ -81,8 +81,6 @@ void InMgr::flush(unsigned frameStart, unsigned frameStop) switch(ev.type) { case M_NOTE: - dump.dumpnote(ev.channel, ev.num, ev.value); - if(ev.value) master->noteOn(ev.channel, ev.num, ev.value); else @@ -90,7 +88,6 @@ void InMgr::flush(unsigned frameStart, unsigned frameStop) break; case M_CONTROLLER: - dump.dumpcontroller(ev.channel, ev.num, ev.value); master->setController(ev.channel, ev.num, ev.value); break; diff --git a/src/UI/ConfigUI.fl b/src/UI/ConfigUI.fl @@ -26,12 +26,6 @@ decl {\#include "../globals.h"} {public local decl {\#include "../Misc/Util.h"} {public local } -decl {\#include "../Misc/Dump.h"} {public local -} - -decl {extern Dump dump;} {public local -} - class ConfigUI {} { Function {make_window()} {} { Fl_Window configwindow { @@ -165,29 +159,6 @@ config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10);} label {Read the Readme.txt for other settings} xywh {10 280 240 15} labelfont 1 labelsize 11 align 128 } - Fl_Group {} { - xywh {15 125 230 85} box ENGRAVED_BOX - } { - Fl_File_Input {} { - label {Dump File} - callback {config.cfg.DumpFile = o->value();} - xywh {20 170 220 35} align 5 - code0 {o->insert(config.cfg.DumpFile.c_str());} - } - Fl_Check_Button {} { - label {Dump notes} - callback {config.cfg.DumpNotesToFile=(int) o->value(); -dump.startnow();//this has effect only if this option was disabled} - xywh {20 130 110 20} down_box DOWN_BOX - code0 {o->value(config.cfg.DumpNotesToFile);} - } - Fl_Check_Button {} { - label Append - callback {config.cfg.DumpAppend=(int) o->value();} - xywh {160 130 80 20} down_box DOWN_BOX - code0 {o->value(config.cfg.DumpAppend);} - } - } Fl_Counter {} { label {XML compression level} callback {config.cfg.GzipCompression=(int) o->value();} diff --git a/src/main.cpp b/src/main.cpp @@ -44,8 +44,6 @@ #include "Misc/Master.h" #include "Misc/Part.h" #include "Misc/Util.h" -#include "Misc/Dump.h" -extern Dump dump; //Nio System #include "Nio/Nio.h" @@ -134,7 +132,6 @@ int main(int argc, char *argv[]) main_thread = pthread_self(); synth = new SYNTH_T; config.init(); - dump.startnow(); int noui = 0; cerr << "\nZynAddSubFX - Copyright (c) 2002-2013 Nasca Octavian Paul and others" @@ -178,9 +175,6 @@ int main(int argc, char *argv[]) "oscil-size", 2, NULL, 'o' }, { - "dump", 2, NULL, 'D' - }, - { "swap", 2, NULL, 'S' }, { @@ -301,9 +295,6 @@ int main(int argc, char *argv[]) case 'S': swaplr = 1; break; - case 'D': - dump.startnow(); - break; case 'N': Nio::setPostfix(optarguments); break; @@ -362,7 +353,6 @@ int main(int argc, char *argv[]) " -b BS, --buffer-size=SR\t\t Set the buffer size (granularity)\n" << " -o OS, --oscil-size=OS\t\t Set the ADsynth oscil. size\n" << " -S , --swap\t\t\t\t Swap Left <--> Right\n" - << " -D , --dump\t\t\t\t Dumps midi note ON/OFF commands\n" << " -U , --no-gui\t\t\t\t Run ZynAddSubFX without user interface\n" << " -N , --named\t\t\t\t Postfix IO Name when possible\n"