diff --git a/Makefile.in b/Makefile.in index a4f93b8..d9e1e49 100644 --- a/Makefile.in +++ b/Makefile.in @@ -136,15 +136,6 @@ $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) moc: $(SRCMOC) -tmake: Makefile - -Makefile: SpiralSynthModular.pro - tmake SpiralSynthModular.pro -o Makefile - -dist: - $(TAR) SpiralSynthModular.tar SpiralSynthModular.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) - $(GZIP) SpiralSynthModular.tar - clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) -rm -f *~ core diff --git a/SpiralSound/Plugins/LADSPAPlugin/Makefile.in b/SpiralSound/Plugins/LADSPAPlugin/Makefile.in index 1ad95fa..5d1a5bb 100644 --- a/SpiralSound/Plugins/LADSPAPlugin/Makefile.in +++ b/SpiralSound/Plugins/LADSPAPlugin/Makefile.in @@ -105,15 +105,6 @@ $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) moc: $(SRCMOC) -tmake: Makefile - -Makefile: LADSPAPlugin.pro - tmake LADSPAPlugin.pro -o Makefile - -dist: - $(TAR) LADSPAPlugin.tar LADSPAPlugin.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) - $(GZIP) LADSPAPlugin.tar - clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) -rm -f *~ core diff --git a/SpiralSound/Plugins/LFOPlugin/LFOPlugin.C b/SpiralSound/Plugins/LFOPlugin/LFOPlugin.C index 4ec7646..f28fff3 100644 --- a/SpiralSound/Plugins/LFOPlugin/LFOPlugin.C +++ b/SpiralSound/Plugins/LFOPlugin/LFOPlugin.C @@ -129,20 +129,12 @@ void LFOPlugin::Execute() { } void LFOPlugin::StreamOut(ostream &s) { - s << m_Version << " " << *this; + s << m_Version << " " << (int)m_Type << " " << m_Freq << " "; } void LFOPlugin::StreamIn(istream &s) { int version; - s >> version >> *this; + s >> version; + s >> (int&)m_Type >> m_Freq; } -istream &operator>> (istream &s, LFOPlugin &o) { - s >> (int&)o.m_Type >> o.m_Freq; - return s; -} - -ostream &operator<< (ostream &s, LFOPlugin &o) { - s << (int)o.m_Type << " " << o.m_Freq << " "; - return s; -} diff --git a/SpiralSound/Plugins/LFOPlugin/LFOPlugin.h b/SpiralSound/Plugins/LFOPlugin/LFOPlugin.h index a6f7703..e1f21f5 100644 --- a/SpiralSound/Plugins/LFOPlugin/LFOPlugin.h +++ b/SpiralSound/Plugins/LFOPlugin/LFOPlugin.h @@ -52,11 +52,6 @@ class LFOPlugin : public SpiralPlugin { float m_Freq; Sample m_Table[NUM_TABLES]; int m_TableLength; - friend std::istream &operator>> (std::istream &s, LFOPlugin &o); - friend std::ostream &operator<< (std::ostream &s, LFOPlugin &o); }; -std::istream &operator>> (std::istream &s, LFOPlugin &o); -std::ostream &operator<< (std::ostream &s, LFOPlugin &o); - #endif diff --git a/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C b/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C index 3d3a06d..72b25eb 100644 --- a/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C +++ b/SpiralSound/Plugins/MeterPlugin/MeterPluginGUI.C @@ -102,7 +102,7 @@ void MeterPluginGUI::draw() { m_BufSize = m_GUICH->GetInt("DataSize"); delete[] m_Data; m_Data = new float[m_BufSize]; - } + } if (m_GUICH->GetBool ("DataReady")) m_GUICH->GetData ("AudioData", m_Data); else memset (m_Data, 0, m_BufSize * sizeof (float)); @@ -118,7 +118,7 @@ void MeterPluginGUI::draw() { Meter->value (datum); Meter->redraw(); // Yeuck - have I REALLY used stdio for that - this is supposed to be C++ - //snprintf (label_buf, 64, "%1.5f", *m_Data); + snprintf (label_buf, 64, "%1.5f", datum); char* c = label_buf; for (int display=0; display<8; display++) { Digits[display] -> dp (off); diff --git a/SpiralSound/Plugins/NoteSnapPlugin/Makefile.in b/SpiralSound/Plugins/NoteSnapPlugin/Makefile.in index d21a70d..2cccb3e 100644 --- a/SpiralSound/Plugins/NoteSnapPlugin/Makefile.in +++ b/SpiralSound/Plugins/NoteSnapPlugin/Makefile.in @@ -96,15 +96,6 @@ $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) moc: $(SRCMOC) -tmake: Makefile - -Makefile: NoteSnapPlugin.pro - tmake NoteSnapPlugin.pro -o Makefile - -dist: - $(TAR) NoteSnapPlugin.tar NoteSnapPlugin.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) - $(GZIP) NoteSnapPlugin.tar - clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) -rm -f *~ core diff --git a/SpiralSound/Plugins/StereoMixerPlugin/Makefile.in b/SpiralSound/Plugins/StereoMixerPlugin/Makefile.in index 7871308..3858cc8 100644 --- a/SpiralSound/Plugins/StereoMixerPlugin/Makefile.in +++ b/SpiralSound/Plugins/StereoMixerPlugin/Makefile.in @@ -99,15 +99,6 @@ $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) moc: $(SRCMOC) -tmake: Makefile - -Makefile: StereoMixerPlugin.pro - tmake StereoMixerPlugin.pro -o Makefile - -dist: - $(TAR) StereoMixerPlugin.tar StereoMixerPlugin.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) - $(GZIP) StereoMixerPlugin.tar - clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) -rm -f *~ core diff --git a/SpiralSound/Plugins/TranslatePlugin/Makefile.in b/SpiralSound/Plugins/TranslatePlugin/Makefile.in new file mode 100644 index 0000000..a06ccc9 --- /dev/null +++ b/SpiralSound/Plugins/TranslatePlugin/Makefile.in @@ -0,0 +1,147 @@ +####### Compiler, tools and options + +CC = gcc +CXX = g++ +CFLAGS = @CFLAGS@ @FLTK_CFLAGS@ +CXXFLAGS= @CXXFLAGS@ @FLTK_CXXFLAGS@ +INCPATH = -I/usr/X11R6/include +LINK = g++ -shared +LFLAGS = +LIBS = @FLTK_LIBS@ +MOC = moc +UIC = + +TAR = tar -cf +GZIP = gzip -9f + +INSTALL = @INSTALL@ + +###### Autoconf variables + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ + +####### Files + +HEADERS = TranslatePlugin.h \ + TranslatePluginGUI.h \ + ../SpiralPlugin.h \ + ../SpiralPluginGUI.h \ + ../../ChannelHandler.h \ + ../../Sample.h \ + ../../../GUI/Widgets/SpiralGUI.H +SOURCES = TranslatePlugin.C \ + TranslatePluginGUI.C \ + ../SpiralPlugin.C \ + ../SpiralPluginGUI.C \ + ../../ChannelHandler.C \ + ../../Sample.C \ + ../../../GUI/Widgets/SpiralGUI.C +OBJECTS = TranslatePlugin.o \ + TranslatePluginGUI.o \ + ../SpiralPlugin.o \ + ../SpiralPluginGUI.o \ + ../../ChannelHandler.o \ + ../../Sample.o \ + ../../../GUI/Widgets/SpiralGUI.o +INTERFACES = +UICDECLS = +UICIMPLS = +SRCMOC = +OBJMOC = +DIST = +TARGET = TranslatePlugin.so + +####### Implicit rules + +.SUFFIXES: .cpp .cxx .cc .C .c + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< + +####### Build rules + + +all: $(TARGET) + +$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) + +moc: $(SRCMOC) + +dist: + $(TAR) TranslatePlugin.tar TranslatePlugin.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST) + $(GZIP) TranslatePlugin.tar + +clean: + -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET) + -rm -f *~ core + +install: + $(INSTALL) $(TARGET) $(libdir)/SpiralPlugins + +####### Sub-libraries + + +###### Combined headers + + +####### Compile + +../SpiralPlugin.o: ../SpiralPlugin.C \ + ../SpiralPlugin.h \ + ../../ChannelHandler.h \ + ../../Sample.h + +../SpiralPluginGUI.o: ../SpiralPluginGUI.C \ + ../SpiralPluginGUI.h \ + ../SpiralPlugin.h \ + ../../ChannelHandler.h \ + ../../../GUI/Widgets/SpiralGUI.H + +../../../GUI/Widgets/SpiralGUI.o: ../../../GUI/Widgets/SpiralGUI.C \ + ../../../GUI/Widgets/SpiralGUI.H + +../../Sample.o: ../../Sample.C \ + ../../Sample.h + +TranslatePlugin.o: TranslatePlugin.C \ + TranslatePlugin.h \ + TranslatePluginGUI.h \ + ../../NoteTable.h \ + ../SpiralPlugin.h \ + ../SpiralPluginGUI.h \ + SpiralIcon.xpm + +TranslatePluginGUI.o: TranslatePluginGUI.C \ + TranslatePlugin.h \ + TranslatePluginGUI.h \ + ../SpiralPlugin.h \ + ../SpiralPluginGUI.h \ + ../../../GUI/Widgets/SpiralGUI.H + +../../ChannelHandler.o: ../../ChannelHandler.C \ + ../../ChannelHandler.h diff --git a/SpiralSound/Plugins/TranslatePlugin/SpiralIcon.xpm b/SpiralSound/Plugins/TranslatePlugin/SpiralIcon.xpm new file mode 100644 index 0000000..575d3d5 --- /dev/null +++ b/SpiralSound/Plugins/TranslatePlugin/SpiralIcon.xpm @@ -0,0 +1,321 @@ +/* XPM */ +static char * SpiralIcon_xpm[] = { +"36 36 282 2", +" c None", +". c #8B889B", +"+ c #9C99AA", +"@ c #ADAAB9", +"# c #837F94", +"$ c #7D7990", +"% c #9995A7", +"& c #67627C", +"* c #CDCBD4", +"= c #FCFCFC", +"- c #D1D0D8", +"; c #FFFFFF", +"> c #F1F1F3", +", c #848095", +"' c #2A2248", +") c #CFCED6", +"! c #68637D", +"~ c #ABA8B6", +"{ c #D5D3DB", +"] c #9490A2", +"^ c #C4C4C4", +"/ c #1D1C1D", +"( c #313134", +"_ c #EEEFEE", +": c #FBFBFB", +"< c #EFEFEF", +"[ c #7B768D", +"} c #464060", +"| c #DEDEE1", +"1 c #CBCACC", +"2 c #EEEEF1", +"3 c #79758C", +"4 c #FBFBFC", +"5 c #A2A2A2", +"6 c #000000", +"7 c #F5F6F5", +"8 c #747474", +"9 c #2A2A2B", +"0 c #403958", +"a c #7D788F", +"b c #C0BEC8", +"c c #BCBAC6", +"d c #BCBAC5", +"e c #625C79", +"f c #2B2932", +"g c #191919", +"h c #CCCCCC", +"i c #807B91", +"j c #3B3556", +"k c #F2F2F4", +"l c #929292", +"m c #0E0E0E", +"n c #BFBFBF", +"o c #111111", +"p c #100E15", +"q c #868689", +"r c #FEFDFE", +"s c #D9D7DE", +"t c #9C98AA", +"u c #FDFCFD", +"v c #DDDDDD", +"w c #575755", +"x c #5E5E5E", +"y c #C4C2CD", +"z c #423C5C", +"A c #F0F0F2", +"B c #939393", +"C c #555555", +"D c #4A4A4A", +"E c #010101", +"F c #282828", +"G c #C2C2C2", +"H c #DBDAE0", +"I c #615C78", +"J c #F6F6F7", +"K c #DADADA", +"L c #545454", +"M c #0F0F0F", +"N c #B8B8B8", +"O c #48445C", +"P c #2B2B2C", +"Q c #181900", +"R c #D3D3D3", +"S c #C1BEC9", +"T c #474060", +"U c #31294D", +"V c #716C85", +"W c #65607A", +"X c #625D78", +"Y c #D5D4DB", +"Z c #F7F7F7", +"` c #8B8B8B", +" . c #161616", +".. c #0C0C0C", +"+. c #111300", +"@. c #151600", +"#. c #050500", +"$. c #191A00", +"%. c #393643", +"&. c #47415F", +"*. c #9692A4", +"=. c #D9D8DE", +"-. c #F7F7F8", +";. c #918DA0", +">. c #B8B5C1", +",. c #D1D1D1", +"'. c #252525", +"). c #0A0B00", +"!. c #101000", +"~. c #070800", +"{. c #727175", +"]. c #FEFEFF", +"^. c #9D99AA", +"/. c #DBD9E0", +"(. c #E9E9E9", +"_. c #CBCBCB", +":. c #E0E0E0", +"<. c #6C6C6C", +"[. c #0B0B00", +"}. c #515151", +"|. c #A6A6A7", +"1. c #827E93", +"2. c #615C77", +"3. c #EAEAED", +"4. c #DFDFE1", +"5. c #060700", +"6. c #060600", +"7. c #FFFF00", +"8. c #1E1D24", +"9. c #9894A7", +"0. c #B1AEBB", +"a. c #69686F", +"b. c #000001", +"c. c #101100", +"d. c #615C76", +"e. c #5F5A75", +"f. c #413E4D", +"g. c #020203", +"h. c #050600", +"i. c #1A1A1C", +"j. c #C3C1CB", +"k. c #9D9D9D", +"l. c #202020", +"m. c #383838", +"n. c #4C4C4C", +"o. c #C9C7D0", +"p. c #F1F1F1", +"q. c #F8F8F8", +"r. c #232323", +"s. c #050408", +"t. c #AEACB9", +"u. c #FEFEFE", +"v. c #1D1D1D", +"w. c #B7B5C1", +"x. c #9390A2", +"y. c #BBBBBB", +"z. c #414141", +"A. c #030303", +"B. c #28272A", +"C. c #F4F4F6", +"D. c #605B76", +"E. c #736E86", +"F. c #D8D8D8", +"G. c #727272", +"H. c #101010", +"I. c #848486", +"J. c #CCCBD3", +"K. c #747087", +"L. c #6D6881", +"M. c #1C1C1C", +"N. c #242424", +"O. c #656566", +"P. c #F6F6F6", +"Q. c #E8E6EA", +"R. c #706B84", +"S. c #E3E1E6", +"T. c #474746", +"U. c #151515", +"V. c #C8C8C8", +"W. c #AEAEAE", +"X. c #080808", +"Y. c #373639", +"Z. c #FDFCFE", +"`. c #ABA8B7", +" + c #F1F0F3", +".+ c #6D6980", +"++ c #0A090E", +"@+ c #95929E", +"#+ c #0A0810", +"$+ c #0D0D0D", +"%+ c #050505", +"&+ c #5B5A5C", +"*+ c #F7F6F7", +"=+ c #F4F3F5", +"-+ c #908C9F", +";+ c #C8C6D0", +">+ c #837E96", +",+ c #86868A", +"'+ c #070608", +")+ c #ECEBEE", +"!+ c #5B5571", +"~+ c #646078", +"{+ c #AFAFB0", +"]+ c #454545", +"^+ c #363636", +"/+ c #7A7A7A", +"(+ c #C8C8C9", +"_+ c #212025", +":+ c #060607", +"<+ c #969699", +"[+ c #FAFAFA", +"}+ c #F8F8F9", +"|+ c #A29EAF", +"1+ c #F7F6F8", +"2+ c #F0F0F1", +"3+ c #B8B7B9", +"4+ c #E4E4E4", +"5+ c #FDFDFD", +"6+ c #A5A2B2", +"7+ c #3B3456", +"8+ c #A8A5B4", +"9+ c #525252", +"0+ c #848387", +"a+ c #CDCDCD", +"b+ c #8D899C", +"c+ c #494262", +"d+ c #68627C", +"e+ c #40395A", +"f+ c #ECECEC", +"g+ c #020202", +"h+ c #B4B5B5", +"i+ c #0B0B0B", +"j+ c #313232", +"k+ c #E3E3E3", +"l+ c #B1AEBC", +"m+ c #BDBBC6", +"n+ c #3C3556", +"o+ c #898599", +"p+ c #EDEDED", +"q+ c #39393A", +"r+ c #040404", +"s+ c #333333", +"t+ c #F5F5F5", +"u+ c #2B2B2B", +"v+ c #2D2A3D", +"w+ c #B6B4C1", +"x+ c #F5F5F6", +"y+ c #605A76", +"z+ c #DAD8DF", +"A+ c #F5F4F6", +"B+ c #615B76", +"C+ c #524D6A", +"D+ c #E4E3E8", +"E+ c #D5D5D5", +"F+ c #1B1B1B", +"G+ c #303030", +"H+ c #AAABAB", +"I+ c #585464", +"J+ c #B0AEBB", +"K+ c #A29FAF", +"L+ c #E9E8E9", +"M+ c #787779", +"N+ c #0F0E15", +"O+ c #2D2D2E", +"P+ c #595959", +"Q+ c #FAFAFB", +"R+ c #807B92", +"S+ c #B0ADBB", +"T+ c #E8E7EB", +"U+ c #3A3258", +"V+ c #E6E5EA", +"W+ c #DFDEE3", +"X+ c #443E5E", +"Y+ c #BAB8C4", +"Z+ c #C1BFCA", +"`+ c #E0E0E5", +" @ c #D0CED6", +".@ c #362F52", +"+@ c #CECCD5", +"@@ c #413A5B", +"#@ c #6A657F", +"$@ c #9793A6", +" ", +" ", +" ", +" . + @ # $ % ", +" & * = * - ; > , ' ; ; ; ) ! ", +" ~ ; ; { ] ; ^ / ( _ ; : < [ ", +" } | 1 2 3 4 5 6 6 7 : 8 9 0 a b ", +" c : d e f g h i j k l 6 m ; n o 6 p q r s ", +" t u ; v w 6 6 x y z A B 6 C ; D E 6 F G ; H ", +" I J ; ; K L 6 6 M N O P E 6 6 6 Q Q M R S T U V W ", +" X Y ; ; ; ; Z ` .6 ..6 6 6 6 6 +.@.#.$.%.&.*.=.-.;. ", +" >.; ; ; ; ; ; = ,.'.6 ).!.~.6 6 6 6 6 6 E {.].; ; ^. ", +" /.; ; (.R h _.:.<.6 [.~.6 6 6 6 6 6 6 6 6 E }.|.4 1. ", +" 2.3.; 4...6 6 6 6 6 5.6.7.7.7.7.7.7.7.7.6 7.6 6 8.9. ", +" V @ 0.a.b.6 6 6 6 6 c.6 7.6 6 6 6 6 6 7.6 6 7.6 ", +" d.e.f.6 g.6 6 6 6 h.6 7.6 6 6 6 6 6 7.6 6 6 7.i. ", +" j.; ; k.l.l.m.n.7.7.7.7.7.6 6 6 6 6 6 7.7.7.7.7.7. ", +" o.; ; p.q.; ; ; r.6 6 6 7.6 6 6 6 6 6 7.6 6 6 7.s. ", +" t.; ; ; ; u.; ; v.6 6 6 7.6 6 6 6 6 6 7.6 6 7.6 6 w., ", +" x.; ; u.; : y.z.A.6 6 6 7.7.7.7.7.7.7.7.6 7.6 6 B.u.C.D. ", +" E.; ; ; F.G.H.6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 I.; ; J.K. ", +" L.J ; : M.6 6 6 6 N...6 6 6 6 6 6 6 6 6 6 6 6 6 O.P.; ; Q.R. ", +" S.; ; T.6 E 6 U.V.W.X.6 6 6 6 6 6 6 6 6 6 6 6 6 Y.Z.; ; > R. ", +" `.; +.+++6 6 W.u.; @+#+6 6 6 6 6 6 6 6 $+%+6 6 6 &+*+; ; =+-+ ", +" R.;+! >+,+'+x ; ; )+!+~+{+l ]+6 6 6 ^+/+(+_+6 6 6 :+<+[+; ; }+@ ", +" |+1+2+3+4+5+; 6+7+8+; P.]+6 6 E 9+; ; 0+6 6 E 6 o a+; ; = b+ ", +" c+> ; ; ; ; ; ; d+e+; ; f+m.6 6 g+D ; ; h+i+6 6 6 j+k+; ; l+ ", +" > ; ; ; ; m+n+o+; ; p+q+6 6 r+s+; ; t+u+6 6 v+w+; x+3 ", +" y+z+= ; A+B+C+D+; ; E+F+6 6 g+G+; ; ; H+9+I+ ", +" J+4 K+ X ; ; ; L+M+G+N+O+P+; ; ; u.Q+R+ ", +" S+; ; ; ; ; T+U+V+; ; ; ; = W+X+ ", +" Y+Z+`+4 ; ; @.@+@; ; ; s o+T ", +" @@ #@$@o+ ", +" ", +" ", +" "}; diff --git a/SpiralSound/Plugins/TranslatePlugin/TranslatePlugin.C b/SpiralSound/Plugins/TranslatePlugin/TranslatePlugin.C new file mode 100644 index 0000000..b88b6dd --- /dev/null +++ b/SpiralSound/Plugins/TranslatePlugin/TranslatePlugin.C @@ -0,0 +1,148 @@ +/* SpiralSound + * Copyleft (C) 2003 Andy Preston + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "TranslatePlugin.h" +#include "TranslatePluginGUI.h" +#include "SpiralIcon.xpm" +#include "../../NoteTable.h" + +using namespace std; + +extern "C" { + +SpiralPlugin* SpiralPlugin_CreateInstance () { return new TranslatePlugin; } + +char** SpiralPlugin_GetIcon () { return SpiralIcon_xpm; } + +int SpiralPlugin_GetID () { return 121; } + +string SpiralPlugin_GetGroupName() { return "Control"; } + +} + +/////////////////////////////////////////////////////// + +float TranslatePass::Translate (float i) { + return i; +} + +float TranslateNoteToFreq::Translate (float i) { + return (i + 1.0f) * (MAX_FREQ / 2); +} + +float TranslateFreqToNote::Translate (float i) { + return (i / MAX_FREQ * 2) - 1.0f; +} + +float TranslateNoteToVolt::Translate (float i) { + float Freq = (i + 1.0f) * (MAX_FREQ / 2); + float Dif, MinDif = 30000; + int Match=0; + for (int c=0; c<131; c++) { + Dif = fabs (NoteTable[c] - Freq); + if (Dif > MinDif) break; + MinDif = Dif; + Match = c; + } + return (float)Match; +} + +float TranslateVoltToNote::Translate (float i) { + return (NoteTable[int (i)] / MAX_FREQ * 2) - 1.0f; +} + +/////////////////////////////////////////////////////// + +TranslatePlugin::TranslatePlugin () : +m_Method (tr_Pass), +m_Translator (NULL) +{ + m_PluginInfo.Name = "Translate"; + m_PluginInfo.Width = 150; + m_PluginInfo.Height = 60; + m_PluginInfo.NumInputs = 1; + m_PluginInfo.NumOutputs = 1; + m_PluginInfo.PortTips.push_back ("Input"); + m_PluginInfo.PortTips.push_back ("Output"); + m_AudioCH->Register ("Method", &m_Method); + SetUpTranslatorClass (); +} + +TranslatePlugin::~TranslatePlugin () { + if (m_Translator) delete m_Translator; +} + +PluginInfo &TranslatePlugin::Initialise (const HostInfo *Host) { + return SpiralPlugin::Initialise (Host); +} + +SpiralGUIType *TranslatePlugin::CreateGUI() { + return new TranslatePluginGUI (m_PluginInfo.Width, m_PluginInfo.Height, this, m_AudioCH, m_HostInfo); +} + +void TranslatePlugin::SetUpTranslatorClass (void) { + if (m_Translator) { + delete m_Translator; + m_Translator = NULL; + } + switch (m_Method) { + case tr_Pass: + m_Translator = new TranslatePass; + break; + case tr_NoteToFreq: + m_Translator = new TranslateNoteToFreq; + break; + case tr_FreqToNote: + m_Translator = new TranslateFreqToNote; + break; + case tr_NoteToVolt: + m_Translator = new TranslateNoteToVolt; + break; + case tr_VoltToNote: + m_Translator = new TranslateVoltToNote; + break; + } +} + +void TranslatePlugin::ExecuteCommands () { + if (m_AudioCH->IsCommandWaiting ()) { + switch (m_AudioCH->GetCommand()) { + case SETMETHOD: + SetUpTranslatorClass (); + break; + } + } +} + +void TranslatePlugin::Execute () { + for (int n=0; nBUFSIZE; n++) { + SetOutput (0, n, m_Translator->Translate (GetInput (0, n))); + } +} + +void TranslatePlugin::StreamOut (ostream &s) { + s << m_Version << endl; + s << m_Method; +} + +void TranslatePlugin::StreamIn (istream &s) { + int version; + s >> version; + s >> m_Method; + SetUpTranslatorClass (); +} diff --git a/SpiralSound/Plugins/TranslatePlugin/TranslatePlugin.h b/SpiralSound/Plugins/TranslatePlugin/TranslatePlugin.h new file mode 100644 index 0000000..66025d4 --- /dev/null +++ b/SpiralSound/Plugins/TranslatePlugin/TranslatePlugin.h @@ -0,0 +1,78 @@ +/* SpiralSound + * Copyleft (C) 2003 Andy Preston + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "../SpiralPlugin.h" +#include + +#ifndef TranslatePLUGIN +#define TranslatePLUGIN + +class TranslatePlugin; + +class TranslateClass { + public: + virtual float Translate (float i) = 0; +}; + +class TranslatePass : public TranslateClass { + public: + virtual float Translate (float i); +}; + +class TranslateNoteToFreq : public TranslateClass { + public: + virtual float Translate (float i); +}; + +class TranslateFreqToNote : public TranslateClass { + public: + virtual float Translate (float i); +}; + +class TranslateNoteToVolt : public TranslateClass { + public: + virtual float Translate (float i); +}; + +class TranslateVoltToNote : public TranslateClass { + public: + virtual float Translate (float i); +}; + +//////////////////////////////////////////////////////////////////////// + +class TranslatePlugin : public SpiralPlugin { + public: + TranslatePlugin(); + virtual ~TranslatePlugin (); + virtual PluginInfo& Initialise (const HostInfo *Host); + virtual SpiralGUIType* CreateGUI (); + virtual void Execute (); + enum GUICommands { NOCMD, SETMETHOD }; + virtual void ExecuteCommands (); + virtual void StreamOut (std::ostream &s); + virtual void StreamIn (std::istream &s); + enum TranMethod { tr_Pass, tr_NoteToFreq, tr_FreqToNote, tr_NoteToVolt, tr_VoltToNote }; + int GetMethod (void) { return m_Method; } + private: + int m_Method; + TranslateClass *m_Translator; + void SetUpTranslatorClass (void); +}; + +#endif diff --git a/SpiralSound/Plugins/TranslatePlugin/TranslatePluginGUI.C b/SpiralSound/Plugins/TranslatePlugin/TranslatePluginGUI.C new file mode 100644 index 0000000..1c7200f --- /dev/null +++ b/SpiralSound/Plugins/TranslatePlugin/TranslatePluginGUI.C @@ -0,0 +1,62 @@ +/* SpiralPlugin + * Copyleft (C) 2003 Andy Preston + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "TranslatePluginGUI.h" +#include + +using namespace std; + +//////////////////////////////////////////// + +TranslatePluginGUI::TranslatePluginGUI (int w, int h,TranslatePlugin *o,ChannelHandler *ch,const HostInfo *Info) : +SpiralPluginGUI (w, h, o, ch) +{ + m_Method = new Fl_Choice (0, 20, 150, 20, ""); + //m_Method->color (Info->GUI_COLOUR); + m_Method->box (FL_PLASTIC_UP_BOX); + m_Method->textsize (10); + m_Method->labelsize (10); + m_Method->callback ((Fl_Callback*) cb_Method); + m_Method->add ("Pass Through"); + m_Method->add ("Note -> Frequency"); + m_Method->add ("Frequency -> Note"); + m_Method->add ("Note -> Note Number"); + m_Method->add ("Note Number -> Note"); + m_Method->value (0); + add (m_Method); + end (); +} + +void TranslatePluginGUI::UpdateValues (SpiralPlugin *o) { + TranslatePlugin *Plugin = (TranslatePlugin *)o; + m_Method->value (Plugin->GetMethod ()); +} + +inline void TranslatePluginGUI::cb_Method_i (Fl_Choice *o, void *v) { + m_GUICH->Set ("Method", int (o->value ())); + m_GUICH->SetCommand (TranslatePlugin::SETMETHOD); +} + +void TranslatePluginGUI::cb_Method (Fl_Choice *o, void *v) { + ((TranslatePluginGUI*)(o->parent ()))->cb_Method_i (o, v); +} + +const string TranslatePluginGUI::GetHelpText (const string &loc) { + return string("") + + "Translates control voltages into other formats."; +} diff --git a/SpiralSound/Plugins/TranslatePlugin/TranslatePluginGUI.h b/SpiralSound/Plugins/TranslatePlugin/TranslatePluginGUI.h new file mode 100644 index 0000000..68682da --- /dev/null +++ b/SpiralSound/Plugins/TranslatePlugin/TranslatePluginGUI.h @@ -0,0 +1,39 @@ +/* SpiralPlugin + * Copyleft (C) 2003 Andy Preston + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include "TranslatePlugin.h" +#include "../SpiralPluginGUI.h" + +#ifndef TranslateGUI +#define TranslateGUI + +class TranslatePluginGUI : public SpiralPluginGUI { + public: + TranslatePluginGUI (int w, int h, TranslatePlugin *o, ChannelHandler *ch, const HostInfo *Info); + virtual void UpdateValues (SpiralPlugin *o); + protected: + const std::string GetHelpText (const std::string &loc); + private: + Fl_Choice *m_Method; + inline void cb_Method_i (Fl_Choice *o, void *v); + static void cb_Method (Fl_Choice *o, void *v); +}; + +#endif diff --git a/SpiralSynthModular.C b/SpiralSynthModular.C index 3048554..8fb2177 100644 --- a/SpiralSynthModular.C +++ b/SpiralSynthModular.C @@ -126,7 +126,7 @@ void SynthModular::ClearUp() if (i->second->m_Device) { if (i->second->m_Device->Kill()); - } + } i->second->m_DeviceGUI->Clear(); if (i->second->m_DeviceGUI->GetPluginWindow()) diff --git a/configure.in b/configure.in index 9584271..f86dcf5 100644 --- a/configure.in +++ b/configure.in @@ -46,7 +46,7 @@ MeterPlugin MidiPlugin MixSwitchPlugin MixerPlugin MoogFilterPlugin MousePlugin NoteSnapPlugin OperatorPlugin OscillatorPlugin OutputPlugin PoshSamplerPlugin \ RingModPlugin SVFilterPlugin SampleHoldPlugin ScopePlugin SeqSelectorPlugin \ SmoothPlugin SpiralLoopPlugin SplitSwitchPlugin SplitterPlugin StereoMixerPlugin \ -StreamPlugin SwitchPlugin TransposePlugin TrigPlugin WaveShaperPlugin \ +StreamPlugin SwitchPlugin TranslatePlugin TransposePlugin TrigPlugin WaveShaperPlugin \ WaveTablePlugin XFadePlugin" dnl Check whether jack is present or has been disabled @@ -258,6 +258,7 @@ SpiralSound/Plugins/SplitterPlugin/Makefile SpiralSound/Plugins/StereoMixerPlugin/Makefile SpiralSound/Plugins/StreamPlugin/Makefile SpiralSound/Plugins/SwitchPlugin/Makefile +SpiralSound/Plugins/TranslatePlugin/Makefile SpiralSound/Plugins/TransposePlugin/Makefile SpiralSound/Plugins/TrigPlugin/Makefile SpiralSound/Plugins/WaveShaperPlugin/Makefile