zynaddsubfx

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

commit db2c5b5a83839aa6837cf1dc0eb7b1fe8ae683cf
parent 1bfcfae86c38c0cf1c4da2eeba3fba8d93da3183
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Tue,  4 May 2010 12:49:58 -0400

Nio: Removing Obsolete Files

Diffstat:
Dsrc/Controls/Makefile | 14--------------
Dsrc/DSP/Makefile | 14--------------
Dsrc/Effects/Makefile | 16----------------
Dsrc/Input/ALSAMidiIn.cpp | 162-------------------------------------------------------------------------------
Dsrc/Input/ALSAMidiIn.h | 59-----------------------------------------------------------
Dsrc/Input/CMakeLists.txt | 20--------------------
Dsrc/Input/Makefile | 26--------------------------
Dsrc/Input/NULLMidiIn.cpp | 43-------------------------------------------
Dsrc/Input/NULLMidiIn.h | 50--------------------------------------------------
Dsrc/Input/OSSMidiIn.cpp | 123-------------------------------------------------------------------------------
Dsrc/Input/OSSMidiIn.h | 50--------------------------------------------------
Dsrc/Makefile | 134-------------------------------------------------------------------------------
Dsrc/Makefile.inc | 84-------------------------------------------------------------------------------
Dsrc/Misc/Makefile | 18------------------
Dsrc/Output/CMakeLists.txt | 33---------------------------------
Dsrc/Output/JACK_RTaudiooutput.cpp | 229-------------------------------------------------------------------------------
Dsrc/Output/JACKaudiooutput.cpp | 185-------------------------------------------------------------------------------
Dsrc/Output/JACKaudiooutput.h | 48------------------------------------------------
Dsrc/Output/Makefile | 42------------------------------------------
Dsrc/Output/OSSaudiooutput.cpp | 128-------------------------------------------------------------------------------
Dsrc/Output/OSSaudiooutput.h | 50--------------------------------------------------
Dsrc/Output/WAVaudiooutput.cpp | 101-------------------------------------------------------------------------------
Dsrc/Output/WAVaudiooutput.h | 43-------------------------------------------
Dsrc/Params/Makefile | 15---------------
Dsrc/Samples/Makefile | 14--------------
Dsrc/Seq/Makefile | 14--------------
Dsrc/Synth/Makefile | 14--------------
Dsrc/UI/Makefile | 41-----------------------------------------
28 files changed, 0 insertions(+), 1770 deletions(-)

diff --git a/src/Controls/Makefile b/src/Controls/Makefile @@ -1,14 +0,0 @@ -include ../Makefile.inc - -objects=Control.o DelayCtl.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/DSP/Makefile b/src/DSP/Makefile @@ -1,14 +0,0 @@ -include ../Makefile.inc - -objects=FFTwrapper.o AnalogFilter.o FormantFilter.o SVFilter.o Filter.o Unison.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Effects/Makefile b/src/Effects/Makefile @@ -1,16 +0,0 @@ -include ../Makefile.inc - -objects=Alienwah.o Chorus.o Echo.o Effect.o \ - EffectLFO.o EffectMgr.o Phaser.o Reverb.o \ - Distorsion.o EQ.o DynamicFilter.o APhaser.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Input/ALSAMidiIn.cpp b/src/Input/ALSAMidiIn.cpp @@ -1,162 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ALSAMidiIn.C - Midi input for ALSA (this creates an ALSA virtual port) - 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 "ALSAMidiIn.h" -#include "../Nio/MidiEvent.h" - -#include <iostream> -using namespace std; - - -ALSAMidiIn::ALSAMidiIn() -{ - int alsaport; - inputok = false; - - midi_handle = NULL; - - if(snd_seq_open(&midi_handle, "default", SND_SEQ_OPEN_INPUT, 0) != 0) - return; - - snd_seq_set_client_name(midi_handle, "ZynAddSubFX"); - - alsaport = snd_seq_create_simple_port( - midi_handle, - "ZynAddSubFX", - SND_SEQ_PORT_CAP_WRITE - | SND_SEQ_PORT_CAP_SUBS_WRITE, - SND_SEQ_PORT_TYPE_SYNTH); - if(alsaport < 0) - return; -} - -ALSAMidiIn::~ALSAMidiIn() -{ - if(midi_handle) - snd_seq_close(midi_handle); -} - -void ALSAMidiIn::run() -{ - cout << "starting midi#run" << endl; - pthread_attr_t attr; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_create(&thread, &attr, _inputThread, this); -} - -void *ALSAMidiIn::_inputThread(void *arg) -{ - return (static_cast<ALSAMidiIn *>(arg))->inputThread(); -} -void *ALSAMidiIn::inputThread() -{ - cout << "starting Midi" << endl; - while(1) { - snd_seq_event_t *midievent = NULL; - - snd_seq_event_input(midi_handle, &midievent); - - if(midievent == NULL) - continue; - switch(midievent->type) { - case SND_SEQ_EVENT_NOTEON: - sysIn->putEvent(MidiNote(midievent->data.note.note, - midievent->data.note.channel, - midievent->data.note.velocity)); - break; - case SND_SEQ_EVENT_NOTEOFF: - sysIn->putEvent(MidiNote(midievent->data.note.note, - midievent->data.note.channel)); - break; - case SND_SEQ_EVENT_PITCHBEND: - sysIn->putEvent(MidiCtl(C_pitchwheel, - midievent->data.control.channel, - midievent->data.control.value)); - break; - case SND_SEQ_EVENT_CONTROLLER: - sysIn->putEvent(MidiCtl(midievent->data.control.param, - midievent->data.control.channel, - midievent->data.control.value)); - break; - } - } - return NULL; -} - -/* - * Get the midi command,channel and parameters - */ -void ALSAMidiIn::getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams) -{ - snd_seq_event_t *midievent = NULL; - cmdtype = MidiNull; - - snd_seq_event_input(midi_handle, &midievent); - - if(midievent == NULL) - return; - switch(midievent->type) { - case SND_SEQ_EVENT_NOTEON: - cmdtype = MidiNoteON; - cmdchan = midievent->data.note.channel; - cmdparams[0] = midievent->data.note.note; - cmdparams[1] = midievent->data.note.velocity; - break; - case SND_SEQ_EVENT_NOTEOFF: - cmdtype = MidiNoteOFF; - cmdchan = midievent->data.note.channel; - cmdparams[0] = midievent->data.note.note; - break; - case SND_SEQ_EVENT_PITCHBEND: - cmdtype = MidiController; - cmdchan = midievent->data.control.channel; - cmdparams[0] = C_pitchwheel; //Pitch Bend - cmdparams[1] = midievent->data.control.value; - break; - case SND_SEQ_EVENT_CONTROLLER: - cmdtype = MidiController; - cmdchan = midievent->data.control.channel; - cmdparams[0] = getcontroller(midievent->data.control.param); - cmdparams[1] = midievent->data.control.value; - //fprintf(stderr,"t=%d val=%d\n",midievent->data.control.param,midievent->data.control.value); - break; - } -} - - -int ALSAMidiIn::getalsaid() -{ - if(midi_handle) { - snd_seq_client_info_t *seq_info; - snd_seq_client_info_malloc(&seq_info); - snd_seq_get_client_info(midi_handle, seq_info); - int id = snd_seq_client_info_get_client(seq_info); - snd_seq_client_info_free(seq_info); - return id; - } - return -1; -} - diff --git a/src/Input/ALSAMidiIn.h b/src/Input/ALSAMidiIn.h @@ -1,59 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - ALSAMidiIn.h - Midi input for ALSA (this creates an ALSA virtual port) - 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 ALSA_MIDI_IN_H -#define ALSA_MIDI_IN_H - -#include <alsa/asoundlib.h> -#include "MidiIn.h" -#include "../Nio/InMgr.h" - - -/**Midi input for ALSA (this creates an ALSA virtual port)*/ -class ALSAMidiIn:public MidiIn -{ - public: - /**Constructor*/ - ALSAMidiIn(); - /**Destructor*/ - ~ALSAMidiIn(); - - void run(); - - static void *_inputThread(void *arg); - void *inputThread(); - - - void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams); - /**Get the ALSA id - * @return ALSA id*/ - int getalsaid(); - - private: - snd_seq_t *midi_handle; - pthread_t thread; -}; - -#endif - diff --git a/src/Input/CMakeLists.txt b/src/Input/CMakeLists.txt @@ -1,20 +0,0 @@ -#set(AlsaMidiInput ${ALSA_FOUND} CACHE BOOL "Include ALSA Midi input") -set(zynaddsubfx_input_SRCS - MidiIn.cpp - NULLMidiIn.cpp - #OSSMidiIn.cpp #[TODO] get OSS midi detection and - #WINMidiIn.cpp # Win midi detection working -) - -if(AlsaMidiInput) - set(zynaddsubfx_input_SRCS - ${zynaddsubfx_input_SRCS} - ALSAMidiIn.cpp - ) - message(STATUS "Alsa midi input enabled") - set(MIDIINPUT_LIBRARIES ${ASOUND_LIBRARY} PARENT_SCOPE) -endif(AlsaMidiInput) - -add_library(zynaddsubfx_input STATIC - ${zynaddsubfx_input_SRCS} - ) diff --git a/src/Input/Makefile b/src/Input/Makefile @@ -1,26 +0,0 @@ -include ../Makefile.inc - -objects=NULLMidiIn.o MidiIn.o - -ifeq ($(MIDIIN),ALSA) -objects+=ALSAMidiIn.o -endif - -ifeq ($(MIDIIN),OSS) -objects+=OSSMidiIn.o -endif - -ifeq ($(MIDIIN),WIN) -objects+=WINMidiIn.o -endif - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Input/NULLMidiIn.cpp b/src/Input/NULLMidiIn.cpp @@ -1,43 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - NULLMidiIn.C - a dummy Midi port - 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 "NULLMidiIn.h" -#include "../Misc/Util.h" - -NULLMidiIn::NULLMidiIn() -{} - -NULLMidiIn::~NULLMidiIn() -{} - -/* - * Get the midi command,channel and parameters - * It returns MidiNull because it is a dummy driver - */ -void NULLMidiIn::getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams) -{ - cmdtype = MidiNull; - os_sleep(10000); -} - diff --git a/src/Input/NULLMidiIn.h b/src/Input/NULLMidiIn.h @@ -1,50 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - NULLMidiIn.h - a dummy Midi port - 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 NULL_MIDI_IN_H -#define NULL_MIDI_IN_H - -#include "MidiIn.h" - - -/**a dummy Midi port*/ -class NULLMidiIn:public MidiIn -{ - public: - /**Dummy Constructor - * \todo see if the default constructor would work here*/ - NULLMidiIn(); - /**Dummy Destructor - * \todo see if the default destructor would work here*/ - ~NULLMidiIn(); - /**Get the midi command,channel and parameters - * It returns MidiNull because it is a dummy driver - */ - void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams); - - private: -}; - -#endif - diff --git a/src/Input/OSSMidiIn.cpp b/src/Input/OSSMidiIn.cpp @@ -1,123 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSMidiIn.C - Midi input for Open Sound System - 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 <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/soundcard.h> - -#include "OSSMidiIn.h" -#include "../Misc/Util.h" - -OSSMidiIn::OSSMidiIn() -{ - inputok = false; - midi_handle = open(config.cfg.LinuxOSSSeqInDev, O_RDONLY, 0); - if(midi_handle != -1) - inputok = true; - - lastmidicmd = 0; - cmdtype = 0; - cmdchan = 0; -} - -OSSMidiIn::~OSSMidiIn() -{ - close(midi_handle); -} - -unsigned char OSSMidiIn::readbyte() -{ - unsigned char tmp[4]; - read(midi_handle, &tmp[0], 1); - while(tmp[0] != SEQ_MIDIPUTC) { - read(midi_handle, &tmp[0], 4); - } - return tmp[1]; -} - -unsigned char OSSMidiIn::getmidibyte() -{ - unsigned char b; - do { - b = readbyte(); - } while(b == 0xfe); //drops the Active Sense Messages - return b; -} - -/* - * Get the midi command,channel and parameters - */ -void OSSMidiIn::getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams) -{ - unsigned char tmp, i; - if(inputok == false) { - cmdtype = MidiNull; - return; - } - i = 0; - if(lastmidicmd == 0) { //asteapta prima data pana cand vine prima comanda midi - while(tmp < 0x80) - tmp = getmidibyte(); - lastmidicmd = tmp; - } - - tmp = getmidibyte(); - - if(tmp >= 0x80) { - lastmidicmd = tmp; - tmp = getmidibyte(); - } - - if((lastmidicmd >= 0x80) && (lastmidicmd <= 0x8f)) { //Note OFF - cmdtype = MidiNoteOFF; - cmdchan = lastmidicmd % 16; - cmdparams[0] = tmp; //note number - } - - if((lastmidicmd >= 0x90) && (lastmidicmd <= 0x9f)) { //Note ON - cmdtype = MidiNoteON; - cmdchan = lastmidicmd % 16; - cmdparams[0] = tmp; //note number - cmdparams[1] = getmidibyte(); //velocity - if(cmdparams[1] == 0) - cmdtype = MidiNoteOFF; //if velocity==0 then is note off - } - if((lastmidicmd >= 0xB0) && (lastmidicmd <= 0xBF)) { //Controllers - cmdtype = MidiController; - cmdchan = lastmidicmd % 16; - cmdparams[0] = getcontroller(tmp); - cmdparams[1] = getmidibyte(); - } - if((lastmidicmd >= 0xE0) && (lastmidicmd <= 0xEF)) { //Pitch Wheel - cmdtype = MidiController; - cmdchan = lastmidicmd % 16; - cmdparams[0] = C_pitchwheel; - cmdparams[1] = (tmp + getmidibyte() * (int) 128) - 8192; //hope this is correct - } -} - diff --git a/src/Input/OSSMidiIn.h b/src/Input/OSSMidiIn.h @@ -1,50 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSMidiIn.h - Midi input for Open Sound System - 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 OSS_MIDI_IN_H -#define OSS_MIDI_IN_H - -#include "MidiIn.h" - -class OSSMidiIn:public MidiIn -{ - public: - OSSMidiIn(); - ~OSSMidiIn(); - unsigned char getmidibyte(); - unsigned char readbyte(); - - //Midi parser - void getmidicmd(MidiCmdType &cmdtype, - unsigned char &cmdchan, - int *cmdparams); - unsigned char cmdtype; //the Message Type (noteon,noteof,sysex..) - unsigned char cmdchan; //the channel number - - private: - int midi_handle; - unsigned char lastmidicmd; //last byte (>=80) received from the Midi -}; - - -#endif - diff --git a/src/Makefile b/src/Makefile @@ -1,134 +0,0 @@ -include Makefile.inc - -ifneq ($(MAKECMDGOALS),debug) - CXXFLAGS= -O2 -Wall -g -fPIC -else - CXXFLAGS= -O2 -Wall -Wpointer-arith -fPIC -endif - -CXXFLAGS += -DOS_$(OS_PORT) -D$(MIDIIN)MIDIIN -DFFTW_VERSION_$(FFTW_VERSION) -DASM_F2I_$(ASM_F2I) -ggdb - -ifeq ($(DISABLE_GUI),YES) - CXXFLAGS += -DDISABLE_GUI -else - CXXFLAGS += -DFLTK_GUI `fltk-config --cflags` -endif - -ifeq ($(AUDIOOUT),OSS_AND_JACK) - CXXFLAGS += -DOSSAUDIOOUT -DJACKAUDIOOUT -else - CXXFLAGS += -D$(AUDIOOUT)AUDIOOUT -endif - -export CXXFLAGS - -LIBS= -lm -lmxml -lz -ifneq ($(DISABLE_GUI),YES) - LIBS+=`fltk-config --ldflags` -endif - -ifeq ($(FFTW_VERSION),2) -LIBS += -lrfftw -lfftw -else -LIBS += -lfftw3 -endif - -ifeq ($(OS_PORT),LINUX) -LIBS+= -lpthread -else -#dynamic linking -#LIBS+= -lpthreadGC -#static linking -LIBS+= /usr/lib/libpthreadGC1.a -endif - -ifeq ($(MIDIIN),ALSA) -LIBS+= -lasound -endif - -ifeq ($(AUDIOOUT),PA) -LIBS+= -lportaudio -endif - -ifeq ($(OS_PORT),WINDOWS) -LIBS+= -lwinmm -endif - - -ifeq ($(AUDIOOUT),OSS_AND_JACK) -CXXFLAGS += `pkg-config --cflags jack` -LIBS+= `pkg-config --libs jack` -endif - -ifeq ($(AUDIOOUT),JACK) -CXXFLAGS += `pkg-config --cflags jack` -LIBS+= `pkg-config --libs jack` -endif - -ifeq ($(AUDIOOUT),JACK_RT) -CXXFLAGS += `pkg-config --cflags jack` -LIBS+= `pkg-config --libs jack` -endif - -ifeq ($(LINUX_USE_LASH),YES) -CXXFLAGS += `pkg-config --cflags lash-1.0` -DUSE_LASH -LIBS+= `pkg-config --libs lash-1.0` -endif - - -objects=main.o -SUBDIRS=Controls DSP Effects Input Misc Output Params Samples Synth Seq - -.PHONY: subdirs $(SUBDIRS) - -all: -# yes " " | head - - $(MAKE) -C UI $@ -# @sh -c "cd UI ; $(CXX) -MM -MG -w *.cc >> ../Make.deps ; cd .." - @for name in $(SUBDIRS); do sh -c "cd $$name ; $(CXX) -MM -MG -w *.cpp >> ../Make.deps ; cd .."; done - $(MAKE) subdirs - $(MAKE) objs - rm -f zynaddsubfx zynaddsubfx.exe - rm -f Make.deps - - -ifeq ($(AUDIOOUT),DSSI) - $(CXX) -shared -o zynaddsubfx.so */*.o *.o $(LIBS) -else -ifeq ($(AUDIOOUT),VST) - $(CXX) -shared -o zynaddsubfx_vst.dll */*.o *.o ../../vstsdk2/source/common/AudioEffect.cpp ../../vstsdk2/source/common/audioeffectx.cpp $(LIBS) zynaddsubfx_gcc.def -else - - -ifeq ($(OS_PORT),LINUX) - $(CXX) -o zynaddsubfx */*.o *.o $(LIBS) -else - $(CXX) -o zynaddsubfx.exe */*.o *.o $(LIBS) -endif -endif -endif - -subdirs: $(SUBDIRS) - -$(SUBDIRS): - $(MAKE) -C $@ - - -objs:$(objects) - -debug: all - -main.o:Misc/Master.h Misc/Util.h Output/OSSaudiooutput.h\ - Input/OSSMidiIn.h Input/ALSAMidiIn.h - - -.PHONY : clean -clean: - rm -f $(objects) zynaddsubfx zynaddsubfx_vst.dll zynaddsubfx.exe zynaddsubfx.so - @for name in $(SUBDIRS); do sh -c "make -C $$name $@"; done - rm -f Make.deps - rm -f */*.o *.o - rm -f ./*/*~ ./*~ - $(MAKE) -C UI $@ - diff --git a/src/Makefile.inc b/src/Makefile.inc @@ -1,84 +0,0 @@ -CXX=g++ - -#You can set the on what OS is compiling (Linux/Windows) -OS_PORT=LINUX -#OS_PORT=WINDOWS - -#The version of the FFTW which is used (2 or 3) -#FFTW_VERSION=2 -FFTW_VERSION=3 - -#Assembler FLOAT to INT conversions -ASM_F2I=YES -#ASM_F2I=NO - -#Graphic user interface disable option (ZynAddSubFX will run only in text-mode) -#DISABLE_GUI=YES -DISABLE_GUI=NO - -# L I N U X C O N F I G U R A T I O N -#Next line sets the midi input. It can be "ALSA", "OSS" or "NONE". -LINUX_MIDIIN=ALSA -#LINUX_MIDIIN=OSS -#LINUX_MIDIIN=NONE - -#Next lines sets the audio output (OSS/JACK/PA) -#You may use only one at the time -#If you use "OSS_AND_JACK",,at runtime, zynaddsubfx will run by the default with jack support and -#it will try OSS if JACK fails. At runtime you can set the OSS by default by command-line -#parameters (run 'zynaddsubfx --help' for help) - -#LINUX_AUDIOOUT=OSS_AND_JACK -LINUX_AUDIOOUT=OSS -#LINUX_AUDIOOUT=NONE -#LINUX_AUDIOOUT=JACK -#LINUX_AUDIOOUT=JACK_RT JACK_RT support is broken -#for PortAudio (PA) -#LINUX_AUDIOOUT=PA - - -#Next line sets if the synth is compiled for DSSI plugin (as .so file) -#If this setting is "YES", MIDI in and AUDIOOUT are set automatically to DSSI -LINUX_DSSI=NO -#LINUX_DSSI=YES - -#Next line sets if the LASH session handler will be used -#LINUX_USE_LASH=YES -LINUX_USE_LASH=NO - -# W I N D O W S C O N F I G U R A T I O N - -#Next line sets the midi input -#WINDOWS_MIDIIN=NONE -WINDOWS_MIDIIN=WIN - -#Next line sets the audio output -#WINDOWS_AUDIOOUT=NONE -WINDOWS_AUDIOOUT=PA - -#Next line sets if the synth is compiled for VST (as .dll file) -#If this setting is "YES", MIDI in and AUDIOOUT are set automatically to VST -WINDOWS_VST=NO -#WINDOWS_VST=YES - -#configuration end - -ifeq ($(OS_PORT),LINUX) - MIDIIN=$(LINUX_MIDIIN) - AUDIOOUT=$(LINUX_AUDIOOUT) - WINDOWS_VST=NO - ifeq ($(LINUX_DSSI),YES) - DISABLE_GUI=YES - MIDIIN=DSSI - AUDIOOUT=DSSI - endif -else - MIDIIN=$(WINDOWS_MIDIIN) - AUDIOOUT=$(WINDOWS_AUDIOOUT) - LINUX_DSSI=NO - ifeq ($(WINDOWS_VST),YES) - MIDIIN=VST - AUDIOOUT=VST - endif -endif - diff --git a/src/Misc/Makefile b/src/Misc/Makefile @@ -1,18 +0,0 @@ -include ../Makefile.inc - -objects=Bank.o Master.o Microtonal.o Part.o Util.o Config.o Dump.o XMLwrapper.o - -ifeq ($(LINUX_USE_LASH),YES) -objects += LASHClient.o -endif - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Output/CMakeLists.txt b/src/Output/CMakeLists.txt @@ -1,33 +0,0 @@ -set(zynaddsubfx_output_SRCS -# Recorder.cpp - WAVaudiooutput.cpp -) -# -#if(AlsaMidiOutput) -# set(zynaddsubfx_output_SRCS -# ${zynaddsubfx_output_SRCS} -# OSSaudiooutput.cpp) -# set(zynaddsubfx_output_lib ${ASOUND_LIBRARY}) -#endif(AlsaMidiOutput) -# -#if(JackOutput) -# include_directories(${JACK_INCLUDE_DIR}) -# set(zynaddsubfx_output_SRCS -# ${zynaddsubfx_output_SRCS} -# JACKaudiooutput.cpp) -# set(zynaddsubfx_output_lib ${JACK_LIBRARIES}) -#endif(JackOutput) -# -#if(PortAudioOutput) -# include_directories(${PORTAUDIO_INCLUDE_DIR}) -# set(zynaddsubfx_output_SRCS -# ${zynaddsubfx_output_SRCS} -# PAaudiooutput.cpp) -# set(zynaddsubfx_output_lib ${PORTAUDIO_LIBRARIES}) -#endif(PortAudioOutput) -# -add_library(zynaddsubfx_output STATIC - ${zynaddsubfx_output_SRCS} - ) - -target_link_libraries(zynaddsubfx_output ${zynaddsubfx_output_lib}) diff --git a/src/Output/JACK_RTaudiooutput.cpp b/src/Output/JACK_RTaudiooutput.cpp @@ -1,229 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - JACKaudiooutput.C - Audio output for JACK - Copyright (C) 2002 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 <string.h> -#include <pthread.h> -#include <unistd.h> - - -extern "C" -{ -#include <jack/ringbuffer.h> -}; -#include "JACKaudiooutput.h" - -Master *jackmaster; -jack_client_t *jackclient; -jack_port_t *outport_left, *outport_right; -jack_ringbuffer_t *rb = NULL; - -REALTYPE *jackoutl, *jackoutr; -int jackfinish = 0; - -void *thread_blocked(void *arg); -int jackprocess(jack_nframes_t nframes, void *arg); -int jacksrate(jack_nframes_t nframes, void *arg); -void jackshutdown(void *arg); - -pthread_cond_t more_data = PTHREAD_COND_INITIALIZER; -pthread_mutex_t zyn_thread_lock = PTHREAD_MUTEX_INITIALIZER; - -pthread_t bthr; - - -bool JACKaudiooutputinit(Master *master_) -{ - jackmaster = master_; - jackclient = 0; - char tmpstr[100]; - - jackoutl = new REALTYPE [SOUND_BUFFER_SIZE]; - jackoutr = new REALTYPE [SOUND_BUFFER_SIZE]; - - int rbbufsize = SOUND_BUFFER_SIZE * sizeof(REALTYPE) * 2 * 2; - printf("%d\n", rbbufsize); - rb = jack_ringbuffer_create(rbbufsize); - for(int i = 0; i < rbbufsize; i++) - rb->buf[i] = 0.0; - - - for(int i = 0; i < 15; i++) { - if(i != 0) - snprintf(tmpstr, 100, "ZynAddSubFX_%d", i); - else - snprintf(tmpstr, 100, "ZynAddSubFX"); - jackclient = jack_client_new(tmpstr); - if(jackclient != 0) - break; - } - - if(jackclient == 0) { - fprintf( - stderr, - "\nERROR: Cannot make a jack client (possible reasons: JACK server is not running or jackd is launched by root and zynaddsubfx by another user.).\n\n\n"); - return false; - } - - fprintf(stderr, - "Internal SampleRate = %d\nJack Output SampleRate= %d\n", - SAMPLE_RATE, - jack_get_sample_rate(jackclient)); - if((unsigned int)jack_get_sample_rate(jackclient) != - (unsigned int) SAMPLE_RATE) - fprintf(stderr, - "It is recomanded that the both samplerates to be equal.\n"); - - jack_set_process_callback(jackclient, jackprocess, 0); - jack_set_sample_rate_callback(jackclient, jacksrate, 0); - jack_on_shutdown(jackclient, jackshutdown, 0); - - outport_left = jack_port_register(jackclient, - "out_1", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - outport_right = jack_port_register(jackclient, - "out_2", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - - if(jack_activate(jackclient)) { - fprintf(stderr, "Cannot activate jack client\n"); - return false; - } - - pthread_create(&bthr, NULL, thread_blocked, NULL); - - /* - jack_connect(jackclient,jack_port_name(outport_left),"alsa_pcm:out_1"); - jack_connect(jackclient,jack_port_name(outport_right),"alsa_pcm:out_2"); - */ - - return true; -} - -void *thread_blocked(void *arg) -{ - int datasize = SOUND_BUFFER_SIZE * sizeof(REALTYPE); - - //try to get realtime - sched_param sc; - sc.sched_priority = 50; - int err = sched_setscheduler(0, SCHED_FIFO, &sc); - - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - pthread_mutex_lock(&zyn_thread_lock); - - while(jackfinish == 0) { - while(jack_ringbuffer_write_space(rb) >= datasize) { - pthread_mutex_lock(&jackmaster->mutex); - jackmaster->GetAudioOutSamples(SOUND_BUFFER_SIZE, - jack_get_sample_rate(jackclient), - jackoutl, - jackoutr); - pthread_mutex_unlock(&jackmaster->mutex); - - jack_ringbuffer_write(rb, (char *) jackoutl, datasize); - jack_ringbuffer_write(rb, (char *) jackoutr, datasize); - } - pthread_cond_wait(&more_data, &zyn_thread_lock); - } - pthread_mutex_unlock(&zyn_thread_lock); - - return 0; -} - - -int jackprocess(jack_nframes_t nframes, void *arg) -{ - jack_default_audio_sample_t *outl = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_left, - nframes); - jack_default_audio_sample_t *outr = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_right, - nframes); - - int datasize = nframes * sizeof(REALTYPE); - int incoming_datasize = SOUND_BUFFER_SIZE * sizeof(REALTYPE); - int data_read = 0; - - - if(jack_ringbuffer_read_space(rb) >= (2 * incoming_datasize)) { - if(datasize > incoming_datasize) { - data_read = 0; - while(data_read < datasize) { - jack_ringbuffer_read(rb, (char *) outl + data_read, datasize); - jack_ringbuffer_read(rb, (char *) outr + data_read, datasize); - data_read += incoming_datasize; - } - } - else - if(datasize == incoming_datasize) { - jack_ringbuffer_read(rb, (char *) outl, datasize); - jack_ringbuffer_read(rb, (char *) outr, datasize); - } - else {} - } - else { //the ringbuffer is empty or there are too small amount of samples in it - for(int i = 0; i < nframes; i++) { - outl[i] = 0.0; - outr[i] = 0.0; - } - } - /* if (jack_ringbuffer_read_space(rb)>=datasize){ - jack_ringbuffer_read(rb, (char *) outl,datasize); - jack_ringbuffer_read(rb, (char *) outr,datasize); - } else {//the ringbuffer is empty or there are too small amount of samples in it - for (int i=0;i<nframes;i++){ - outl[i]=0.0;outr[i]=0.0; - }; - }; - */ - if(pthread_mutex_trylock(&zyn_thread_lock) == 0) { - pthread_cond_signal(&more_data); - pthread_mutex_unlock(&zyn_thread_lock); - } - - return 0; -} - -void JACKfinish() -{ - jackfinish = 1; - jack_ringbuffer_free(rb); - jack_client_close(jackclient); - - usleep(100000); - delete (jackoutl); - delete (jackoutr); -} - -int jacksrate(jack_nframes_t nframes, void *arg) -{ - return 0; -} - -void jackshutdown(void *arg) -{} - diff --git a/src/Output/JACKaudiooutput.cpp b/src/Output/JACKaudiooutput.cpp @@ -1,185 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - JACKaudiooutput.C - Audio output for JACK - Copyright (C) 2002 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 <jack/midiport.h> -#include "JACKaudiooutput.h" - -Master *jackmaster; -jack_client_t *jackclient; -char jackname[100]; -jack_port_t *outport_left, *outport_right, *midi_inport; - -int jackprocess(jack_nframes_t nframes, void *arg); -int jacksrate(jack_nframes_t nframes, void *arg); -void jackshutdown(void *arg); - -bool JACKaudiooutputinit(Master *master_) -{ - jackmaster = master_; - jackclient = 0; - - for(int i = 0; i < 15; i++) { - if(i != 0) - snprintf(jackname, 100, "ZynAddSubFX_%d", i); - else - snprintf(jackname, 100, "ZynAddSubFX"); - jackclient = jack_client_new(jackname); - if(jackclient != 0) - break; - } - - if(jackclient == 0) { - fprintf( - stderr, - "\nERROR: Cannot make a jack client (possible reasons: JACK server is not running or jackd is launched by root and zynaddsubfx by another user.).\n"); - return false; - } - - fprintf(stderr, - "Internal SampleRate = %d\nJack Output SampleRate= %d\n", - SAMPLE_RATE, - jack_get_sample_rate(jackclient)); - if((unsigned int)jack_get_sample_rate(jackclient) != - (unsigned int) SAMPLE_RATE) - fprintf(stderr, - "It is recomanded that the both samplerates to be equal.\n"); - - jack_set_process_callback(jackclient, jackprocess, 0); - jack_set_sample_rate_callback(jackclient, jacksrate, 0); - jack_on_shutdown(jackclient, jackshutdown, 0); - - outport_left = jack_port_register(jackclient, - "out_1", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - outport_right = jack_port_register(jackclient, - "out_2", - JACK_DEFAULT_AUDIO_TYPE, - JackPortIsOutput | JackPortIsTerminal, - 0); - midi_inport = jack_port_register(jackclient, - "midi_input", - JACK_DEFAULT_MIDI_TYPE, - JackPortIsInput | JackPortIsTerminal, - 0); - - if(jack_activate(jackclient)) { - fprintf(stderr, "Cannot activate jack client\n"); - return false; - } - - /* - jack_connect(jackclient,jack_port_name(outport_left),"alsa_pcm:out_1"); - jack_connect(jackclient,jack_port_name(outport_right),"alsa_pcm:out_2"); - */ - return true; -} - -int jackprocess(jack_nframes_t nframes, void *arg) -{ - jack_default_audio_sample_t *outl = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_left, - nframes); - jack_default_audio_sample_t *outr = - (jack_default_audio_sample_t *) jack_port_get_buffer(outport_right, - nframes); - - if(!pthread_mutex_trylock(&jackmaster->mutex)) { - JACKhandlemidi(nframes); - jackmaster->GetAudioOutSamples(nframes, jack_get_sample_rate( - jackclient), outl, outr); - pthread_mutex_unlock(&jackmaster->mutex); - } - else { - memset(outl, 0, sizeof(jack_default_audio_sample_t) * nframes); - memset(outr, 0, sizeof(jack_default_audio_sample_t) * nframes); - } - - return 0; -} - -void JACKfinish() -{ - jack_client_close(jackclient); -} - -int jacksrate(jack_nframes_t nframes, void *arg) -{ - return 0; -} - -void jackshutdown(void *arg) -{} - - -void JACKhandlemidi(unsigned long frames) -{ - // We must have the master mutex before we run this function - - // XXX This is really nasty, not only do we lose the sample accuracy of - // JACK MIDI, but any accuracy at all below the buffer size - - void *midi_buf = jack_port_get_buffer(midi_inport, frames); - jack_midi_event_t jack_midi_event; - jack_nframes_t event_index = 0; - unsigned char *midi_data; - unsigned char type, chan; - - while(jack_midi_event_get(&jack_midi_event, midi_buf, - event_index++) == 0) { - midi_data = jack_midi_event.buffer; - type = midi_data[0] & 0xF0; - chan = midi_data[0] & 0x0F; - - switch(type) { - case 0x80: /* note-off */ - jackmaster->NoteOff(chan, midi_data[1]); - break; - - case 0x90: /* note-on */ - jackmaster->NoteOn(chan, midi_data[1], midi_data[2]); - break; - - case 0xB0: /* controller */ - jackmaster->SetController(chan, midi_data[1], midi_data[2]); - break; - - case 0xE0: /* pitch bend */ - jackmaster->SetController(chan, C_pitchwheel, - ((midi_data[2] << 7) | midi_data[1])); - break; - - /* XXX TODO: handle MSB/LSB controllers and RPNs and NRPNs */ - } - } -} - - -const char *JACKgetname() -{ - if(jackclient != NULL) - return jackname; - return NULL; -} - diff --git a/src/Output/JACKaudiooutput.h b/src/Output/JACKaudiooutput.h @@ -1,48 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - JACKaudiooutput.h - Audio output for JACK - Copyright (C) 2002 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 JACK_AUDIO_OUTPUT_H -#define JACK_AUDIO_OUTPUT_H - -#include <jack/jack.h> - -#include "../globals.h" -#include "../Misc/Master.h" - - -#if (REALTYPE != jack_default_audio_sample_t) -#error \ - "The internal sample datatype of ZynAddSubFX and the datatype of jack differs. \ - In order to compile ZynAddSubFX the 'REALTYPE' and 'jack_default_audio_sample_t' must be equal. \ - Set the 'REALTYPE' data type (which is defined in 'globals.h') to what is defined \ - in the file types.h from jack include directory as 'jack_default_audio_sample_t' (as float or double)." -#endif - - - - -bool JACKaudiooutputinit(Master *master_); -void JACKfinish(); -void JACKhandlemidi(unsigned long frames); -const char *JACKgetname(); - -#endif - diff --git a/src/Output/Makefile b/src/Output/Makefile @@ -1,42 +0,0 @@ -include ../Makefile.inc - -objects=Recorder.o WAVaudiooutput.o - -ifeq ($(AUDIOOUT),OSS_AND_JACK) -objects+=OSSaudiooutput.o JACKaudiooutput.o -endif - -ifeq ($(AUDIOOUT),JACK) -objects+=JACKaudiooutput.o -endif - -ifeq ($(AUDIOOUT),DSSI) -objects+=DSSIaudiooutput.o -endif - -ifeq ($(AUDIOOUT),JACK_RT) -objects+=JACK_RTaudiooutput.o -endif - -ifeq ($(AUDIOOUT),PA) -objects+=PAaudiooutput.o -endif - -ifeq ($(AUDIOOUT),OSS) -objects+=OSSaudiooutput.o -endif - -ifeq ($(AUDIOOUT),VST) -objects+=VSTaudiooutput.o -endif - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Output/OSSaudiooutput.cpp b/src/Output/OSSaudiooutput.cpp @@ -1,128 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.C - Audio output for Open Sound System - 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 <stdio.h> -#include <fcntl.h> -#include <sys/soundcard.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <unistd.h> -#include <iostream> - -#include "OSSaudiooutput.h" -#include "../Misc/Util.h" -#include "../globals.h" -using namespace std; - -OSSaudiooutput::OSSaudiooutput() -{ - int i; - int snd_bitsize = 16; - snd_fragment = 0x00080009; //fragment size (?) - snd_stereo = 1; //stereo - snd_format = AFMT_S16_LE; - snd_samplerate = SAMPLE_RATE; - playing_until.tv_sec = 0; - playing_until.tv_usec = 0; - - smps = new short int[SOUND_BUFFER_SIZE * 2]; - for(i = 0; i < SOUND_BUFFER_SIZE * 2; i++) - smps[i] = 0; - - snd_handle = open(config.cfg.LinuxOSSWaveOutDev, O_WRONLY, 0); - if(snd_handle == -1) { - cerr << "ERROR - I can't open the "; - cerr << config.cfg.LinuxOSSWaveOutDev << '.' << endl; - return; - } - ioctl(snd_handle, SNDCTL_DSP_RESET, NULL); - - ioctl(snd_handle, SNDCTL_DSP_SETFMT, &snd_format); - ioctl(snd_handle, SNDCTL_DSP_STEREO, &snd_stereo); - ioctl(snd_handle, SNDCTL_DSP_SPEED, &snd_samplerate); - ioctl(snd_handle, SNDCTL_DSP_SAMPLESIZE, &snd_bitsize); - ioctl(snd_handle, SNDCTL_DSP_SETFRAGMENT, &snd_fragment); -} - - -/* - * Output the samples to the soundcard - * The samples are bigger than -1.0 and smaller 1.0 - */ -void OSSaudiooutput::OSSout(REALTYPE *smp_left, REALTYPE *smp_right) -{ - int i; - REALTYPE l, r; - if(snd_handle < 0) { //output could not be opened - struct timeval now; - int remaining; - gettimeofday(&now, NULL); - if((playing_until.tv_usec == 0) && (playing_until.tv_sec == 0)) { - playing_until.tv_usec = now.tv_usec; - playing_until.tv_sec = now.tv_sec; - } - else { - remaining = (playing_until.tv_usec - now.tv_usec) - + (playing_until.tv_sec - now.tv_sec) * 1000000; - if(remaining > 10000) //Don't sleep() less than 10ms. - //This will add latency... - usleep(remaining - 10000); - if(remaining < 0) - cerr << "WARNING - too late" << endl; - } - playing_until.tv_usec += SOUND_BUFFER_SIZE * 1000000 / SAMPLE_RATE; - if(remaining < 0) - playing_until.tv_usec -= remaining; - playing_until.tv_sec += playing_until.tv_usec / 1000000; - playing_until.tv_usec %= 1000000; - return; - } - - for(i = 0; i < SOUND_BUFFER_SIZE; i++) { - l = smp_left[i]; - r = smp_right[i]; - - if(l < -1.0) - l = -1.0; - else - if(l > 1.0) - l = 1.0; - if(r < -1.0) - r = -1.0; - else - if(r > 1.0) - r = 1.0; - - smps[i * 2] = (short int) (l * 32767.0); - smps[i * 2 + 1] = (short int) (r * 32767.0); - } - write(snd_handle, smps, SOUND_BUFFER_SIZE * 4); // *2 because is 16 bit, again * 2 because is stereo -} - - -OSSaudiooutput::~OSSaudiooutput() -{ - close(snd_handle); - delete [] smps; -} - diff --git a/src/Output/OSSaudiooutput.h b/src/Output/OSSaudiooutput.h @@ -1,50 +0,0 @@ -/* - ZynAddSubFX - a software synthesizer - - OSSaudiooutput.h - Audio output for Open Sound System - 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 OSS_AUDIO_OUTPUT_H -#define OSS_AUDIO_OUTPUT_H - -#include <sys/time.h> -#include "../globals.h" - -class OSSaudiooutput -{ - public: - OSSaudiooutput(); - ~OSSaudiooutput(); - - //the out is [-1.0 .. 1.0] - /* smp_left[] and smp_right[] has the size of SOUND_BUFFER_SIZE */ - void OSSout(REALTYPE *smp_left, REALTYPE *smp_right); - private: - int snd_handle; - int snd_fragment; - int snd_stereo; - int snd_format; - int snd_samplerate; - struct timeval playing_until; - - short int *smps; //Samples to be sent to soundcard -}; - -#endif - diff --git a/src/Output/WAVaudiooutput.cpp b/src/Output/WAVaudiooutput.cpp @@ -1,101 +0,0 @@ -/* - Copyright (C) 2006 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) 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 <stdio.h> -#include <stdlib.h> -#include "WAVaudiooutput.h" -using namespace std; - -WAVaudiooutput::WAVaudiooutput() -{ - file = NULL; - sampleswritten = 0; - samplerate = 44100; -} - -WAVaudiooutput::~WAVaudiooutput() -{ - close(); -} - -bool WAVaudiooutput::newfile(string filename, int samplerate, int channels) -{ - /**\todo Move this into the Constructor*/ - close(); //inchide un posibil fisier existent - file = fopen(filename.c_str(), "w"); - if(!file) - return false; - this->samplerate = samplerate; - this->channels = channels; - sampleswritten = 0; - char tmp[44]; - fwrite(tmp, 1, 44, file); - return true; -} - -void WAVaudiooutput::close() -{ - if(file) { - unsigned int chunksize; - rewind(file); - - fwrite("RIFF", 4, 1, file); - chunksize = sampleswritten * 4 + 36; - fwrite(&chunksize, 4, 1, file); - - fwrite("WAVEfmt ", 8, 1, file); - chunksize = 16; - fwrite(&chunksize, 4, 1, file); - unsigned short int formattag = 1; //uncompresed wave - fwrite(&formattag, 2, 1, file); - unsigned short int nchannels = channels; //stereo - fwrite(&nchannels, 2, 1, file); - unsigned int samplerate_ = samplerate; //samplerate - fwrite(&samplerate_, 4, 1, file); - unsigned int bytespersec = samplerate * 2 * channels; //bytes/sec - fwrite(&bytespersec, 4, 1, file); - unsigned short int blockalign = 2 * channels; //2 channels * 16 bits/8 - fwrite(&blockalign, 2, 1, file); - unsigned short int bitspersample = 16; - fwrite(&bitspersample, 2, 1, file); - - fwrite("data", 4, 1, file); - chunksize = sampleswritten * blockalign; - fwrite(&chunksize, 4, 1, file); - - fclose(file); - file = NULL; - } -} - -void WAVaudiooutput::write_stereo_samples(int nsmps, short int *smps) -{ - if(!file) - return; - fwrite(smps, nsmps, 4, file); - sampleswritten += nsmps; -} - -void WAVaudiooutput::write_mono_samples(int nsmps, short int *smps) -{ - if(!file) - return; - fwrite(smps, nsmps, 2, file); - sampleswritten += nsmps; -} - diff --git a/src/Output/WAVaudiooutput.h b/src/Output/WAVaudiooutput.h @@ -1,43 +0,0 @@ -/* - - Copyright (C) 2008 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) 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 WAVOUTPUT_H -#define WAVOUTPUT_H -#include <string> - -class WAVaudiooutput -{ - public: - WAVaudiooutput(); - ~WAVaudiooutput(); - - bool newfile(std::string filename, int samplerate, int channels); - void close(); - - void write_mono_samples(int nsmps, short int *smps); - void write_stereo_samples(int nsmps, short int *smps); - - private: - int sampleswritten; - int samplerate; - int channels; - FILE *file; -}; -#endif - diff --git a/src/Params/Makefile b/src/Params/Makefile @@ -1,15 +0,0 @@ -include ../Makefile.inc - -objects=ADnoteParameters.o EnvelopeParams.o FilterParams.o \ - LFOParams.o SUBnoteParameters.o PADnoteParameters.o Controller.o Presets.o PresetsArray.o PresetsStore.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Samples/Makefile b/src/Samples/Makefile @@ -1,14 +0,0 @@ -include ../Makefile.inc - -objects=Sample.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Seq/Makefile b/src/Seq/Makefile @@ -1,14 +0,0 @@ -include ../Makefile.inc - -objects=MIDIEvents.o MIDIFile.o Sequencer.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/Synth/Makefile b/src/Synth/Makefile @@ -1,14 +0,0 @@ -include ../Makefile.inc - -objects=ADnote.o Envelope.o LFO.o OscilGen.o SUBnote.o Resonance.o PADnote.o - - -all: $(objects) - --include ../Make.deps - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - diff --git a/src/UI/Makefile b/src/UI/Makefile @@ -1,41 +0,0 @@ -include ../Makefile.inc - -%.cc : %.fl - fluid -c $< - -objects=WidgetPDial.o PresetsUI.o EnvelopeUI.o LFOUI.o FilterUI.o VirKeyboard.o ConfigUI.o\ - SUBnoteUI.o ResonanceUI.o OscilGenUI.o ADnoteUI.o PADnoteUI.o EffUI.o BankUI.o \ - PartUI.o MicrotonalUI.o SeqUI.o MasterUI.o -ifeq ($(DISABLE_GUI),YES) - objects= -endif - -all: $(objects) - -WidgetPDial.o: WidgetPDial.fl WidgetPDial.cc WidgetPDial.h -PresetsUI.o: PresetsUI.fl PresetsUI.cc PresetsUI.h -EnvelopeUI.o: EnvelopeUI.fl EnvelopeUI.cc EnvelopeUI.h -LFOUI.o: LFOUI.fl LFOUI.cc LFOUI.h -FilterUI.o: FilterUI.fl FilterUI.cc FilterUI.h - -ResonanceUI.o:ResonanceUI.fl ResonanceUI.cc ResonanceUI.h -OscilGenUI.o:OscilGenUI.fl OscilGenUI.cc OscilGenUI.h -ADnoteUI.o:ADnoteUI.fl ADnoteUI.cc ADnoteUI.h -SUBnoteUI.o:SUBnoteUI.fl SUBnoteUI.cc SUBnoteUI.h -PADnoteUI.o:PADnoteUI.fl PADnoteUI.cc PADnoteUI.h - -EffUI.o: EffUI.fl EffUI.cc EffUI.h -BankUI.o: BankUI.fl BankUI.cc BankUI.h -PartUI.o: PartUI.fl PartUI.cc PartUI.h - -VirKeyboard.o: VirKeyboard.fl VirKeyboard.cc VirKeyboard.h -ConfigUI.o: ConfigUI.fl ConfigUI.cc ConfigUI.h -MicrotonalUI.o: MicrotonalUI.fl MicrotonalUI.cc MicrotonalUI.h -SeqUI.o: SeqUI.fl SeqUI.cc SeqUI.h -MasterUI.o: MasterUI.fl MasterUI.cc MasterUI.h - -.PHONY : clean -clean: - rm -f $(objects) - rm -f makeinclude.deps - rm -f *.h *.cc