@@ -385,7 +385,7 @@ endif | |||
ifeq ($(EXPERIMENTAL_PLUGINS),true) | |||
NATIVE_PLUGINS_FLAGS += -DHAVE_EXPERIMENTAL_PLUGINS | |||
NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs cairo fftw3f libpng12 x11 xft) -lclthreads -lclxclient -lzita-convolver | |||
NATIVE_PLUGINS_LIBS += -lzita-convolver $(shell pkg-config --libs cairo fftw3f libpng12 x11 xft) -lclthreads -lclxclient | |||
endif | |||
ifeq ($(HAVE_ZYN_DEPS),true) | |||
@@ -46,25 +46,49 @@ typedef int (*jack_process_callback)(jack_nframes_t nframes, void* ptr); | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Enums */ | |||
typedef enum { | |||
JackPortIsInput = 1 << 0, | |||
JackPortIsOutput = 1 << 1 | |||
} jack___t; | |||
typedef enum { | |||
JackNoStartServer = 0, | |||
JackServerName | |||
} jack_options_t; | |||
typedef enum { | |||
JackNoError = 0x0 | |||
} jack_status_t; | |||
enum JackPortFlags { | |||
JackPortIsInput = 0x01, | |||
JackPortIsOutput = 0x02, | |||
JackPortIsPhysical = 0x04, | |||
JackPortCanMonitor = 0x08, | |||
JackPortIsTerminal = 0x10 | |||
}; | |||
enum JackOptions { | |||
JackNullOption = 0x00, | |||
JackNoStartServer = 0x01, | |||
JackUseExactName = 0x02, | |||
JackServerName = 0x04, | |||
JackLoadName = 0x08, | |||
JackLoadInit = 0x10, | |||
JackSessionID = 0x20 | |||
}; | |||
enum JackStatus { | |||
JackFailure = 0x0001, | |||
JackInvalidOption = 0x0002, | |||
JackNameNotUnique = 0x0004, | |||
JackServerStarted = 0x0008, | |||
JackServerFailed = 0x0010, | |||
JackServerError = 0x0020, | |||
JackNoSuchClient = 0x0040, | |||
JackLoadFailure = 0x0080, | |||
JackInitFailure = 0x0100, | |||
JackShmFailure = 0x0200, | |||
JackVersionError = 0x0400, | |||
JackBackendError = 0x0800, | |||
JackClientZombie = 0x1000 | |||
}; | |||
typedef enum JackOptions jack_options_t; | |||
typedef enum JackStatus jack_status_t; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Structs */ | |||
typedef struct { | |||
bool isInput; | |||
bool registered; | |||
uint flags; | |||
void* buffer; | |||
} jack_port_t; | |||
@@ -80,22 +104,24 @@ typedef struct { | |||
void* processPtr; | |||
// ports | |||
jack_port_t* portsAudioIn[8]; | |||
jack_port_t* portsAudioOut[8]; | |||
jack_port_t portsAudioIn[8]; | |||
jack_port_t portsAudioOut[8]; | |||
} jack_client_t; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Client functions */ | |||
extern jack_client_t* gLastJackClient; | |||
/* | |||
* NOTE: This function purposefully returns NULL, as we *do not* want global variables. | |||
* The client pointer is passed into the plugin code directly. | |||
*/ | |||
static inline | |||
jack_client_t* jack_client_open(const char* clientname, jack_options_t options, jack_status_t* status, ...) | |||
{ | |||
if (status != NULL) | |||
*status = JackNoError; | |||
*status = JackFailure; | |||
return gLastJackClient; | |||
return NULL; | |||
// unused | |||
(void)clientname; | |||
@@ -135,23 +161,20 @@ int jack_set_process_callback(jack_client_t* client, jack_process_callback callb | |||
* Port functions */ | |||
static inline | |||
jack_port_t* jack_port_register(jack_client_t* client, const char* name, const char* type, jack___t hints, jack_nframes_t buffersize) | |||
jack_port_t* jack_port_register(jack_client_t* client, const char* name, const char* type, ulong flags, ulong buffersize) | |||
{ | |||
jack_port_t** const ports = (hints & JackPortIsInput) ? client->portsAudioIn : client->portsAudioOut; | |||
jack_port_t* const ports = (flags & JackPortIsInput) ? client->portsAudioIn : client->portsAudioOut; | |||
for (int i=0; i<8; ++i) | |||
{ | |||
if (ports[i] != NULL) | |||
continue; | |||
jack_port_t* const port = (jack_port_t*)calloc(1, sizeof(jack_port_t)); | |||
jack_port_t* const port = &ports[i]; | |||
if (port == NULL) | |||
return NULL; | |||
port->isInput = (hints & JackPortIsInput); | |||
if (port->registered) | |||
continue; | |||
ports[i] = port; | |||
port->registered = true; | |||
port->flags = flags; | |||
port->buffer = NULL; | |||
return port; | |||
} | |||
@@ -167,13 +190,15 @@ jack_port_t* jack_port_register(jack_client_t* client, const char* name, const c | |||
static inline | |||
int jack_port_unregister(jack_client_t* client, jack_port_t* port) | |||
{ | |||
jack_port_t** const ports = port->isInput ? client->portsAudioIn : client->portsAudioOut; | |||
jack_port_t* const ports = (port->flags & JackPortIsInput) ? client->portsAudioIn : client->portsAudioOut; | |||
for (int i=0; i<8; ++i) | |||
{ | |||
if (ports[i] == port) | |||
if (&ports[i] == port) | |||
{ | |||
ports[i] = NULL; | |||
port->registered = false; | |||
port->flags = 0x0; | |||
port->buffer = NULL; | |||
return 0; | |||
} | |||
} | |||
@@ -253,7 +253,7 @@ $(OBJDIR)/zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_H) $(ZYN_UI_FI | |||
$(OBJDIR)/zita-bls1.cpp.o: zita-bls1.cpp | |||
-@mkdir -p $(OBJDIR) | |||
@echo "Compiling $<" | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) -DSHARED=\"/usr/share/zita-bls1\" $(shell pkg-config --cflags cairo fftw3f libpng12 x11 xft) -c -o $@ | |||
@$(CXX) $< $(BUILD_CXX_FLAGS) $(shell pkg-config --cflags cairo fftw3f libpng12 x11 xft) -Wno-unused-parameter -Wno-unused-result -c -o $@ | |||
# ---------------------------------------------------------------------------------------------------------------------------- | |||
@@ -15,11 +15,7 @@ | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#include "CarlaNativeJack.h" | |||
// ----------------------------------------------------------------------- | |||
jack_client_t* gLastJackClient = NULL; | |||
#include "CarlaNative.h" | |||
// ----------------------------------------------------------------------- | |||
@@ -16,21 +16,23 @@ | |||
*/ | |||
#include "CarlaNative.hpp" | |||
#include "CarlaMutex.hpp" | |||
#include "CarlaMathUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
#include "juce_audio_basics.h" | |||
#include "zita-bls1/source/png2img.cc" | |||
#include "zita-bls1/source/guiclass.cc" | |||
#include "zita-bls1/source/hp3filt.cc" | |||
#include "zita-bls1/source/jclient.cc" | |||
#include "zita-bls1/source/lfshelf2.cc" | |||
#include "zita-bls1/source/mainwin.cc" | |||
#include "zita-bls1/source/rotary.cc" | |||
#include "zita-bls1/source/shuffler.cc" | |||
#include "zita-bls1/source/styles.cc" | |||
// this one needs to be first | |||
#include "zita-bls1/png2img.cc" | |||
#include "zita-bls1/guiclass.cc" | |||
#include "zita-bls1/hp3filt.cc" | |||
#include "zita-bls1/jclient.cc" | |||
#include "zita-bls1/lfshelf2.cc" | |||
#include "zita-bls1/mainwin.cc" | |||
#include "zita-bls1/rotary.cc" | |||
#include "zita-bls1/shuffler.cc" | |||
#include "zita-bls1/styles.cc" | |||
using juce::FloatVectorOperations; | |||
using juce::ScopedPointer; | |||
@@ -38,7 +40,8 @@ using juce::ScopedPointer; | |||
// ----------------------------------------------------------------------- | |||
// BLS1 Plugin | |||
class BLS1Plugin : public NativePluginClass | |||
class BLS1Plugin : public NativePluginClass, | |||
private Mainwin::ValueChangedCallback | |||
{ | |||
public: | |||
static const uint32_t kNumInputs = 2; | |||
@@ -68,7 +71,6 @@ public: | |||
CARLA_SAFE_ASSERT(host != nullptr); | |||
carla_zeroStruct(fJackClient); | |||
gLastJackClient = &fJackClient; | |||
fJackClient.clientName = "bls1"; | |||
fJackClient.bufferSize = getBufferSize(); | |||
@@ -78,7 +80,7 @@ public: | |||
char* argv[] = { (char*)"bls1" }; | |||
xresman.init(&argc, argv, (char*)"bls1", nullptr, 0); | |||
jclient = new Jclient(xresman.rname(), nullptr); | |||
jclient = new Jclient(xresman.rname(), &fJackClient); | |||
// set initial values | |||
fParameters[kParameterINPBAL] = 0.0f; | |||
@@ -125,40 +127,41 @@ public: | |||
switch (index) | |||
{ | |||
case kParameterINPBAL: | |||
param.name = "INPBAL"; | |||
param.name = "Input balance"; | |||
//param.unit = "dB"; | |||
param.ranges.def = 0.0f; | |||
param.ranges.min = -3.0f; | |||
param.ranges.max = 3.0f; | |||
break; | |||
case kParameterHPFILT: | |||
hints |= NATIVE_PARAMETER_IS_LOGARITHMIC; | |||
param.name = "HPFILT"; | |||
param.name = "Highpass filter"; | |||
param.ranges.def = 40.0f; | |||
param.ranges.min = 10.0f; | |||
param.ranges.max = 320.0f; | |||
break; | |||
case kParameterSHGAIN: | |||
param.name = "SHGAIN"; | |||
param.name = "Shuffler gain"; | |||
param.ranges.def = 15.0f; | |||
param.ranges.min = 0.0f; | |||
param.ranges.max = 24.0f; | |||
break; | |||
case kParameterSHFREQ: | |||
hints |= NATIVE_PARAMETER_IS_LOGARITHMIC; | |||
param.name = "SHFREQ"; | |||
param.name = "Shuffler frequency"; | |||
param.ranges.def = 5e2f; | |||
param.ranges.min = 125.0f; | |||
param.ranges.max = 2e3f; | |||
break; | |||
case kParameterLFFREQ: | |||
hints |= NATIVE_PARAMETER_IS_LOGARITHMIC; | |||
param.name = "LFFREQ"; | |||
param.name = "LF shelf filter frequency"; | |||
param.ranges.def = 80.0f; | |||
param.ranges.min = 20.0f; | |||
param.ranges.max = 320.0f; | |||
break; | |||
case kParameterLFGAIN: | |||
param.name = "LFGAIN"; | |||
param.name = "LF shelf filter gain"; | |||
param.ranges.def = 0.0f; | |||
param.ranges.min = -9.0f; | |||
param.ranges.max = 9.0f; | |||
@@ -225,10 +228,10 @@ public: | |||
} | |||
for (uint32_t i=0; i<kNumInputs; ++i) | |||
fJackClient.portsAudioIn[i]->buffer = inBuffer[i]; | |||
fJackClient.portsAudioIn[i].buffer = inBuffer[i]; | |||
for (uint32_t i=0; i<kNumOutputs; ++i) | |||
fJackClient.portsAudioOut[i]->buffer = outBuffer[i]; | |||
fJackClient.portsAudioOut[i].buffer = outBuffer[i]; | |||
fJackClient.processCallback(frames, fJackClient.processPtr); | |||
} | |||
@@ -247,10 +250,10 @@ public: | |||
if (display->dpy() == nullptr) | |||
return hostUiUnavailable(); | |||
styles_init(display, &xresman); | |||
styles_init(display, &xresman, getResourceDir()); | |||
rootwin = new X_rootwin(display); | |||
mainwin = new Mainwin(rootwin, &xresman, 0, 0, jclient); | |||
mainwin = new Mainwin(rootwin, &xresman, 0, 0, jclient, this); | |||
rootwin->handle_event(); | |||
mainwin->x_set_title(getUiName()); | |||
@@ -285,20 +288,6 @@ public: | |||
handler->next_event(); | |||
} | |||
// check if parameters were updated | |||
float value; | |||
for (uint32_t i=0; i<kParameterNROTARY; ++i) | |||
{ | |||
value = mainwin->_rotary[i]->value(); | |||
if (fParameters[i] == value) | |||
continue; | |||
fParameters[i] = value; | |||
uiParameterChanged(i, value); | |||
} | |||
if (ev == EV_EXIT) | |||
{ | |||
handler = nullptr; | |||
@@ -343,6 +332,15 @@ public: | |||
} | |||
// ------------------------------------------------------------------- | |||
// Mainwin callbacks | |||
void valueChangedCallback(uint index, double value) override | |||
{ | |||
fParameters[index] = value; | |||
uiParameterChanged(index, value); | |||
} | |||
// ------------------------------------------------------------------- | |||
private: | |||
// Fake jack client | |||
@@ -365,7 +363,7 @@ private: | |||
// ----------------------------------------------------------------------- | |||
static const NativePluginDescriptor bls1Desc = { | |||
/* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, | |||
/* category */ NATIVE_PLUGIN_CATEGORY_FILTER, | |||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE | |||
|NATIVE_PLUGIN_HAS_UI | |||
|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||
@@ -1 +0,0 @@ | |||
Fons Adriaensen <fons@linuxaudio.org> |
@@ -1,340 +0,0 @@ | |||
GNU GENERAL PUBLIC LICENSE | |||
Version 2, June 1991 | |||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. | |||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
Everyone is permitted to copy and distribute verbatim copies | |||
of this license document, but changing it is not allowed. | |||
Preamble | |||
The licenses for most software are designed to take away your | |||
freedom to share and change it. By contrast, the GNU General Public | |||
License is intended to guarantee your freedom to share and change free | |||
software--to make sure the software is free for all its users. This | |||
General Public License applies to most of the Free Software | |||
Foundation's software and to any other program whose authors commit to | |||
using it. (Some other Free Software Foundation software is covered by | |||
the GNU Library General Public License instead.) You can apply it to | |||
your programs, too. | |||
When we speak of free software, we are referring to freedom, not | |||
price. Our General Public Licenses are designed to make sure that you | |||
have the freedom to distribute copies of free software (and charge for | |||
this service if you wish), that you receive source code or can get it | |||
if you want it, that you can change the software or use pieces of it | |||
in new free programs; and that you know you can do these things. | |||
To protect your rights, we need to make restrictions that forbid | |||
anyone to deny you these rights or to ask you to surrender the rights. | |||
These restrictions translate to certain responsibilities for you if you | |||
distribute copies of the software, or if you modify it. | |||
For example, if you distribute copies of such a program, whether | |||
gratis or for a fee, you must give the recipients all the rights that | |||
you have. You must make sure that they, too, receive or can get the | |||
source code. And you must show them these terms so they know their | |||
rights. | |||
We protect your rights with two steps: (1) copyright the software, and | |||
(2) offer you this license which gives you legal permission to copy, | |||
distribute and/or modify the software. | |||
Also, for each author's protection and ours, we want to make certain | |||
that everyone understands that there is no warranty for this free | |||
software. If the software is modified by someone else and passed on, we | |||
want its recipients to know that what they have is not the original, so | |||
that any problems introduced by others will not reflect on the original | |||
authors' reputations. | |||
Finally, any free program is threatened constantly by software | |||
patents. We wish to avoid the danger that redistributors of a free | |||
program will individually obtain patent licenses, in effect making the | |||
program proprietary. To prevent this, we have made it clear that any | |||
patent must be licensed for everyone's free use or not licensed at all. | |||
The precise terms and conditions for copying, distribution and | |||
modification follow. | |||
GNU GENERAL PUBLIC LICENSE | |||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |||
0. This License applies to any program or other work which contains | |||
a notice placed by the copyright holder saying it may be distributed | |||
under the terms of this General Public License. The "Program", below, | |||
refers to any such program or work, and a "work based on the Program" | |||
means either the Program or any derivative work under copyright law: | |||
that is to say, a work containing the Program or a portion of it, | |||
either verbatim or with modifications and/or translated into another | |||
language. (Hereinafter, translation is included without limitation in | |||
the term "modification".) Each licensee is addressed as "you". | |||
Activities other than copying, distribution and modification are not | |||
covered by this License; they are outside its scope. The act of | |||
running the Program is not restricted, and the output from the Program | |||
is covered only if its contents constitute a work based on the | |||
Program (independent of having been made by running the Program). | |||
Whether that is true depends on what the Program does. | |||
1. You may copy and distribute verbatim copies of the Program's | |||
source code as you receive it, in any medium, provided that you | |||
conspicuously and appropriately publish on each copy an appropriate | |||
copyright notice and disclaimer of warranty; keep intact all the | |||
notices that refer to this License and to the absence of any warranty; | |||
and give any other recipients of the Program a copy of this License | |||
along with the Program. | |||
You may charge a fee for the physical act of transferring a copy, and | |||
you may at your option offer warranty protection in exchange for a fee. | |||
2. You may modify your copy or copies of the Program or any portion | |||
of it, thus forming a work based on the Program, and copy and | |||
distribute such modifications or work under the terms of Section 1 | |||
above, provided that you also meet all of these conditions: | |||
a) You must cause the modified files to carry prominent notices | |||
stating that you changed the files and the date of any change. | |||
b) You must cause any work that you distribute or publish, that in | |||
whole or in part contains or is derived from the Program or any | |||
part thereof, to be licensed as a whole at no charge to all third | |||
parties under the terms of this License. | |||
c) If the modified program normally reads commands interactively | |||
when run, you must cause it, when started running for such | |||
interactive use in the most ordinary way, to print or display an | |||
announcement including an appropriate copyright notice and a | |||
notice that there is no warranty (or else, saying that you provide | |||
a warranty) and that users may redistribute the program under | |||
these conditions, and telling the user how to view a copy of this | |||
License. (Exception: if the Program itself is interactive but | |||
does not normally print such an announcement, your work based on | |||
the Program is not required to print an announcement.) | |||
These requirements apply to the modified work as a whole. If | |||
identifiable sections of that work are not derived from the Program, | |||
and can be reasonably considered independent and separate works in | |||
themselves, then this License, and its terms, do not apply to those | |||
sections when you distribute them as separate works. But when you | |||
distribute the same sections as part of a whole which is a work based | |||
on the Program, the distribution of the whole must be on the terms of | |||
this License, whose permissions for other licensees extend to the | |||
entire whole, and thus to each and every part regardless of who wrote it. | |||
Thus, it is not the intent of this section to claim rights or contest | |||
your rights to work written entirely by you; rather, the intent is to | |||
exercise the right to control the distribution of derivative or | |||
collective works based on the Program. | |||
In addition, mere aggregation of another work not based on the Program | |||
with the Program (or with a work based on the Program) on a volume of | |||
a storage or distribution medium does not bring the other work under | |||
the scope of this License. | |||
3. You may copy and distribute the Program (or a work based on it, | |||
under Section 2) in object code or executable form under the terms of | |||
Sections 1 and 2 above provided that you also do one of the following: | |||
a) Accompany it with the complete corresponding machine-readable | |||
source code, which must be distributed under the terms of Sections | |||
1 and 2 above on a medium customarily used for software interchange; or, | |||
b) Accompany it with a written offer, valid for at least three | |||
years, to give any third party, for a charge no more than your | |||
cost of physically performing source distribution, a complete | |||
machine-readable copy of the corresponding source code, to be | |||
distributed under the terms of Sections 1 and 2 above on a medium | |||
customarily used for software interchange; or, | |||
c) Accompany it with the information you received as to the offer | |||
to distribute corresponding source code. (This alternative is | |||
allowed only for noncommercial distribution and only if you | |||
received the program in object code or executable form with such | |||
an offer, in accord with Subsection b above.) | |||
The source code for a work means the preferred form of the work for | |||
making modifications to it. For an executable work, complete source | |||
code means all the source code for all modules it contains, plus any | |||
associated interface definition files, plus the scripts used to | |||
control compilation and installation of the executable. However, as a | |||
special exception, the source code distributed need not include | |||
anything that is normally distributed (in either source or binary | |||
form) with the major components (compiler, kernel, and so on) of the | |||
operating system on which the executable runs, unless that component | |||
itself accompanies the executable. | |||
If distribution of executable or object code is made by offering | |||
access to copy from a designated place, then offering equivalent | |||
access to copy the source code from the same place counts as | |||
distribution of the source code, even though third parties are not | |||
compelled to copy the source along with the object code. | |||
4. You may not copy, modify, sublicense, or distribute the Program | |||
except as expressly provided under this License. Any attempt | |||
otherwise to copy, modify, sublicense or distribute the Program is | |||
void, and will automatically terminate your rights under this License. | |||
However, parties who have received copies, or rights, from you under | |||
this License will not have their licenses terminated so long as such | |||
parties remain in full compliance. | |||
5. You are not required to accept this License, since you have not | |||
signed it. However, nothing else grants you permission to modify or | |||
distribute the Program or its derivative works. These actions are | |||
prohibited by law if you do not accept this License. Therefore, by | |||
modifying or distributing the Program (or any work based on the | |||
Program), you indicate your acceptance of this License to do so, and | |||
all its terms and conditions for copying, distributing or modifying | |||
the Program or works based on it. | |||
6. Each time you redistribute the Program (or any work based on the | |||
Program), the recipient automatically receives a license from the | |||
original licensor to copy, distribute or modify the Program subject to | |||
these terms and conditions. You may not impose any further | |||
restrictions on the recipients' exercise of the rights granted herein. | |||
You are not responsible for enforcing compliance by third parties to | |||
this License. | |||
7. If, as a consequence of a court judgment or allegation of patent | |||
infringement or for any other reason (not limited to patent issues), | |||
conditions are imposed on you (whether by court order, agreement or | |||
otherwise) that contradict the conditions of this License, they do not | |||
excuse you from the conditions of this License. If you cannot | |||
distribute so as to satisfy simultaneously your obligations under this | |||
License and any other pertinent obligations, then as a consequence you | |||
may not distribute the Program at all. For example, if a patent | |||
license would not permit royalty-free redistribution of the Program by | |||
all those who receive copies directly or indirectly through you, then | |||
the only way you could satisfy both it and this License would be to | |||
refrain entirely from distribution of the Program. | |||
If any portion of this section is held invalid or unenforceable under | |||
any particular circumstance, the balance of the section is intended to | |||
apply and the section as a whole is intended to apply in other | |||
circumstances. | |||
It is not the purpose of this section to induce you to infringe any | |||
patents or other property right claims or to contest validity of any | |||
such claims; this section has the sole purpose of protecting the | |||
integrity of the free software distribution system, which is | |||
implemented by public license practices. Many people have made | |||
generous contributions to the wide range of software distributed | |||
through that system in reliance on consistent application of that | |||
system; it is up to the author/donor to decide if he or she is willing | |||
to distribute software through any other system and a licensee cannot | |||
impose that choice. | |||
This section is intended to make thoroughly clear what is believed to | |||
be a consequence of the rest of this License. | |||
8. If the distribution and/or use of the Program is restricted in | |||
certain countries either by patents or by copyrighted interfaces, the | |||
original copyright holder who places the Program under this License | |||
may add an explicit geographical distribution limitation excluding | |||
those countries, so that distribution is permitted only in or among | |||
countries not thus excluded. In such case, this License incorporates | |||
the limitation as if written in the body of this License. | |||
9. The Free Software Foundation may publish revised and/or new versions | |||
of the General Public License from time to time. Such new versions will | |||
be similar in spirit to the present version, but may differ in detail to | |||
address new problems or concerns. | |||
Each version is given a distinguishing version number. If the Program | |||
specifies a version number of this License which applies to it and "any | |||
later version", you have the option of following the terms and conditions | |||
either of that version or of any later version published by the Free | |||
Software Foundation. If the Program does not specify a version number of | |||
this License, you may choose any version ever published by the Free Software | |||
Foundation. | |||
10. If you wish to incorporate parts of the Program into other free | |||
programs whose distribution conditions are different, write to the author | |||
to ask for permission. For software which is copyrighted by the Free | |||
Software Foundation, write to the Free Software Foundation; we sometimes | |||
make exceptions for this. Our decision will be guided by the two goals | |||
of preserving the free status of all derivatives of our free software and | |||
of promoting the sharing and reuse of software generally. | |||
NO WARRANTY | |||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | |||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | |||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | |||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | |||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | |||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | |||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | |||
REPAIR OR CORRECTION. | |||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | |||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | |||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | |||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | |||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | |||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | |||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | |||
POSSIBILITY OF SUCH DAMAGES. | |||
END OF TERMS AND CONDITIONS | |||
How to Apply These Terms to Your New Programs | |||
If you develop a new program, and you want it to be of the greatest | |||
possible use to the public, the best way to achieve this is to make it | |||
free software which everyone can redistribute and change under these terms. | |||
To do so, attach the following notices to the program. It is safest | |||
to attach them to the start of each source file to most effectively | |||
convey the exclusion of warranty; and each file should have at least | |||
the "copyright" line and a pointer to where the full notice is found. | |||
<one line to give the program's name and a brief idea of what it does.> | |||
Copyright (C) <year> <name of author> | |||
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 | |||
Also add information on how to contact you by electronic and paper mail. | |||
If the program is interactive, make it output a short notice like this | |||
when it starts in an interactive mode: | |||
Gnomovision version 69, Copyright (C) year name of author | |||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |||
This is free software, and you are welcome to redistribute it | |||
under certain conditions; type `show c' for details. | |||
The hypothetical commands `show w' and `show c' should show the appropriate | |||
parts of the General Public License. Of course, the commands you use may | |||
be called something other than `show w' and `show c'; they could even be | |||
mouse-clicks or menu items--whatever suits your program. | |||
You should also get your employer (if you work as a programmer) or your | |||
school, if any, to sign a "copyright disclaimer" for the program, if | |||
necessary. Here is a sample; alter the names: | |||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program | |||
`Gnomovision' (which makes passes at compilers) written by James Hacker. | |||
<signature of Ty Coon>, 1 April 1989 | |||
Ty Coon, President of Vice | |||
This General Public License does not permit incorporating your program into | |||
proprietary programs. If your program is a subroutine library, you may | |||
consider it more useful to permit linking proprietary applications with the | |||
library. If this is what you want to do, use the GNU Library General | |||
Public License instead of this License. |
@@ -1,24 +0,0 @@ | |||
To install, cd to this directory, make, sudo make install. | |||
To build this program you need the shared libraries | |||
libclthreads-2.4.0 | |||
libclxclient-3.6.1 | |||
libzita-convolver-3.0.0 | |||
and the corresponding header files. They are available at | |||
<http://www.kokkinizita.net/linuxaudio/downloads> | |||
Install clthreads first as clxclient depends on it. | |||
The other dependencies (X11, Xft, png, cairo, fftw3f, jack) | |||
should be provided by any Linux distro. | |||
To install into /usr instead of /usr/local modify the | |||
definition of 'PREFIX' in the Makefile. | |||
Note: the 'make install' step is necessary to make | |||
the application work - it expects to find some files | |||
in $PREFIX/share/zita-bls1. | |||
@@ -1,3 +0,0 @@ | |||
See doc/html/quickguide.html | |||
@@ -1,111 +0,0 @@ | |||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |||
<html><head> | |||
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8"> | |||
<meta http-equiv="Content-Language" content="en"> | |||
<link rel="stylesheet" type="text/css" href="styles.css"> | |||
<title>BLS1 - Quick guide</title> | |||
</head> | |||
<body> | |||
<table border="0" cellpadding="0" cellspacing="10" width="950"> | |||
<tbody> | |||
<tr height="50"> | |||
<td width="150"> | |||
<img src="redzita.png" border=0> | |||
</td> | |||
<td width="850" align="center"> | |||
<h2>BLS1 - Quick guide</h2> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td></td> | |||
<td class="content"> | |||
<p>BLS1 is a digital realisation of the 'Blumlein Shuffler', invented by Alan | |||
Blumlen in the early 1930s and analysed in detail by Michael Gerzon in a | |||
paper presented at the 1993 AES Convention in San Francisco.</p> | |||
<p>The Blumlein Shuffler is used to convert binaural stereo signals into a | |||
form suitable for reproduction using a convential stereo speaker pair. | |||
Binaural signals are provided by e.g. a dummy head, or a pair of closely | |||
spaced omnis with a baffle (e.g. a Jecklin disk) in between them. Such signals | |||
have no significant level differences for off-centre signals at low and low-mid | |||
frequencies, only a phase difference which depends on the frequency, the distance | |||
between the mics and the source direction. The shuffler turns these phase | |||
differences into amplitude differences by applying a specific filter to the | |||
(L-R) signal. This can be done only as long as the phase difference is not | |||
ambiguous, i.e. less than half a cycle, so the shuffler is normally set up | |||
to not affect higher frequencies. For these, sufficient channel separation must | |||
be provided by the input signals themselves, typically by using some sort of | |||
baffle between the mics.</p> | |||
<p> The ideal difference channel filter would be of the form 1 + a/s, i.e. unity | |||
plus an integrator, or the inverse of a first order highpass. But since this has | |||
unbounded gain as frequency goes down it can't be used. An analog implementation | |||
would use an LF shelf filter instead. The problem with this is that limiting the | |||
gain at LF also means that the phase response returns to zero, while it should | |||
ideally stay at 90 degrees. This could be compensated for by using all-pass filters | |||
in both the sum and difference channels, but this complicates the circuit (in | |||
particular if the shuffler parameters are variable) and of course also affects | |||
the overall phase response.</p> | |||
<p>Zita-bls1 uses a FIR filter (1024 taps at 48 kHz) that has the amplitude | |||
response of the shelf filter but the phase response of the ideal filter, and | |||
the sum channel is just a matching delay. The finite length of the FIR means | |||
there will be some roll-off at very low frequencies, in this case -3dB at 40 Hz, | |||
which is probably not a bad thing. It could be avoided by using a longer FIR.</p> | |||
<p>Apart from the basic shuffler algorithm some extras are provided: an input | |||
gain balance control, an 18 dB/oct highpass filter, and a variable frequency | |||
LF shelf filter.</p> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td></td> | |||
<td align="center"> | |||
<img src="zita-bls1.png" border=0> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td></td> | |||
<td class="content"> | |||
<p> The rotary knobs can be used in two ways:</p> | |||
<p> * Click on the knob with the <b>left</b> mouse button, keep it pressed | |||
and move either left..right or up..down.</p> | |||
<p> * Using the <b>mouse wheel</b>. This provides 'sensible' steps, e.g. | |||
1 or 1/2 dB for gains and 1/3 or 1/6 octave for frequencies. Press <b>Shift | |||
</b>for smaller steps.</p> | |||
<p>From Left to right we have: | |||
</p> | |||
<p><b>* Input balance.</b> | |||
Not all mic preamps provide perfect matching of channel gains, and the mics | |||
themselves may have slightly different sensitivities as well Since the | |||
shuffler amplifies the difference between the L and R inputs, even small | |||
gain errors could have a significant impact. This control is provided to | |||
allow exact matching of the two input signal gains.</p> | |||
<p><b>* Highpass filter.</b> | |||
As the shuffler boosts LF signals it's advisable to remove any low | |||
frequency rumble. Ideally this should be done by the mic preamps, but | |||
not all of them all provide such a filter. Filter slope is 18 dB/oct. | |||
When set to 10 Hz it has no significant effect in the audio band.</p> | |||
<p><b>* Shuffler gain.</b> | |||
This the maximum gain the difference channel filter will have as | |||
frequency goes down. Depending on the combined gain and frequency | |||
settings It may not reach this value since there is also a fixed | |||
rolloff (-3 dB at 40 Hz).</p> | |||
<p><b>* Shuffler frequency.</b> | |||
This is the frequency at which the difference channel filter will | |||
have 3dB gain.</p> | |||
<p><b>* LF shelf filter frequency and gain.</b> | |||
The LF shelf filter is provided to correct the tonal balance in | |||
the low frequency range which may be affected by the action of the | |||
shuffler. It is a second order design and has a somewhat steeper | |||
slope than most shelf filters. | |||
</p> | |||
</td> | |||
</tr> | |||
</tbody> | |||
</table> | |||
</body> |
@@ -1,24 +0,0 @@ | |||
body | |||
{ | |||
font-family: sans-serif; | |||
margin: 0; | |||
color: #FFFFFF; | |||
background-color: #383838; | |||
background-image: url(emboss.png); | |||
background-repeat: repeat; | |||
background-attachment: scroll; | |||
background-position: top left; | |||
} | |||
a:link { font-size: 10pt; font-weight: bold; color: #60FF60; } | |||
a:visited { font-size: 10pt; font-weight: bold; color: #8080FF; } | |||
h1 { font-size: 18pt; font-weight:bold; background-color: #0000E0; color: #FFFFFF; padding: 8pt; } | |||
h2 { font-size: 14pt; font-weight:normal; background-color: #0000E0; color: #FFFFFF; padding-left: 8pt; } | |||
h3 { font-size: 12pt; font-weight:normal; background-color: #FF0000; color: #FFFFFF; padding-left: 8pt; } | |||
.content { font-size: 10pt; font-weight: normal; color: #FFFFFF; padding-bottom: 10pt; } | |||
.comment { font-size: 10pt; font-weight: bold; color: #FFFF00; } | |||
.lborder { font-size: 11pt; font-weight: bold; padding: 15pt; } | |||
.theader { font-size: 10pt; font-weight: bold; color: #FFFF00; } | |||
@@ -102,7 +102,7 @@ void HP3filt::prepare (int nsamp) | |||
} | |||
float HP3filt::response (float /*f*/) | |||
float HP3filt::response (float f) | |||
{ | |||
// Compute gain at frequency f from _c1 _c2, _c3, _g. | |||
// This is left as an exercise for the reader. | |||
@@ -110,7 +110,7 @@ float HP3filt::response (float /*f*/) | |||
} | |||
void HP3filt::calcpar1 (int /*nsamp*/, float f) | |||
void HP3filt::calcpar1 (int nsamp, float f) | |||
{ | |||
float a, b, t; | |||
@@ -23,9 +23,9 @@ | |||
#include "jclient.h" | |||
Jclient::Jclient (const char *jname, const char *jserv) : | |||
Jclient::Jclient (const char *jname, jack_client_t *jclient) : | |||
A_thread ("Jclient"), | |||
_jack_client (0), | |||
_jack_client (jclient), | |||
_active (false), | |||
_jname (0), | |||
_inpbal0 (0), | |||
@@ -35,7 +35,7 @@ Jclient::Jclient (const char *jname, const char *jserv) : | |||
_da (0.0f), | |||
_db (0.0f) | |||
{ | |||
init_jack (jname, jserv); | |||
init_jack (jname); | |||
} | |||
@@ -45,19 +45,11 @@ Jclient::~Jclient (void) | |||
} | |||
void Jclient::init_jack (const char *jname, const char *jserv) | |||
void Jclient::init_jack (const char *jname) | |||
{ | |||
jack_status_t stat; | |||
struct sched_param spar; | |||
int options, abspri, policy, k; | |||
int abspri, policy, k; | |||
options = JackNoStartServer; | |||
if (jserv) options |= JackServerName; | |||
if ((_jack_client = jack_client_open (jname, (jack_options_t) options, &stat, jserv)) == 0) | |||
{ | |||
fprintf (stderr, "Can't connect to JACK\n"); | |||
exit (1); | |||
} | |||
jack_set_process_callback (_jack_client, jack_static_process, (void *) this); | |||
jack_on_shutdown (_jack_client, jack_static_shutdown, (void *) this); | |||
@@ -1,7 +1,7 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// | |||
// 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 | |||
@@ -38,7 +38,7 @@ class Jclient : public A_thread | |||
{ | |||
public: | |||
Jclient (const char *jname, const char *jserv); | |||
Jclient (const char *jname, jack_client_t *jclient); | |||
~Jclient (void); | |||
const char *jname (void) const { return _jname; } | |||
@@ -65,7 +65,7 @@ public: | |||
private: | |||
void init_jack (const char *jname, const char *jserv); | |||
void init_jack (const char *jname); | |||
void close_jack (void); | |||
void jack_shutdown (void); | |||
int jack_process (int nframes); | |||
@@ -88,7 +88,7 @@ private: | |||
HP3filt _hpfilt; | |||
LFshelf2 _lshelf; | |||
Shuffler _shuffl; | |||
static void jack_static_shutdown (void *arg); | |||
static int jack_static_process (jack_nframes_t nframes, void *arg); | |||
}; |
@@ -119,7 +119,7 @@ void LFshelf2::prepare (int nsamp) | |||
} | |||
float LFshelf2::response (float /*f*/) | |||
float LFshelf2::response (float f) | |||
{ | |||
// Compute gain at frequency f from _a0, _a1, _a2, _b1, _b2. | |||
// This is left as an exercise for the reader. |
@@ -1,7 +1,7 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// | |||
// 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 | |||
@@ -27,13 +27,14 @@ | |||
#include "mainwin.h" | |||
Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jclient) : | |||
Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jclient, ValueChangedCallback* valuecb) : | |||
A_thread ("Main"), | |||
X_window (parent, xp, yp, XSIZE, YSIZE, XftColors_bls1 [C_MAIN_BG]->pixel), | |||
_stop (false), | |||
_xres (xres), | |||
_jclient (jclient), | |||
_touch (false) | |||
_touch (false), | |||
_valuecb (valuecb) | |||
{ | |||
X_hints H; | |||
char s [1024]; | |||
@@ -50,7 +51,7 @@ Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jc | |||
H.maxsize (XSIZE, YSIZE); | |||
H.rname (xres->rname ()); | |||
H.rclas (xres->rclas ()); | |||
x_apply (&H); | |||
x_apply (&H); | |||
RotaryCtl::init (disp ()); | |||
_rotary [INPBAL] = new Rlinctl (this, this, &inpbal_img, 20, 0, 120, 4, -3.0f, 3.0f, 0.0f, INPBAL); | |||
@@ -66,19 +67,19 @@ Mainwin::Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jc | |||
_parmind = -1; | |||
_timeout = 0; | |||
x_add_events (ExposureMask); | |||
x_map (); | |||
x_add_events (ExposureMask); | |||
x_map (); | |||
set_time (0); | |||
inc_time (250000); | |||
} | |||
Mainwin::~Mainwin (void) | |||
{ | |||
RotaryCtl::fini (); | |||
} | |||
int Mainwin::process (void) | |||
{ | |||
int e; | |||
@@ -102,8 +103,8 @@ void Mainwin::handle_event (XEvent *E) | |||
{ | |||
case Expose: | |||
expose ((XExposeEvent *) E); | |||
break; | |||
break; | |||
case ClientMessage: | |||
clmesg ((XClientMessageEvent *) E); | |||
break; | |||
@@ -133,9 +134,12 @@ void Mainwin::handle_time (void) | |||
inc_time (100000); | |||
XFlush (dpy ()); | |||
if (_touch && _jclient->shuffler ()->ready ()) | |||
if (_touch && _jclient->shuffler ()->ready ()) | |||
{ | |||
_jclient->shuffler ()->prepare (_rotary [SHGAIN]->value (), _rotary [SHFREQ]->value ()); | |||
double v1 = _rotary [SHGAIN]->value (), v2 = _rotary [SHFREQ]->value (); | |||
_jclient->shuffler ()->prepare (v1, v2); | |||
_valuecb->valueChangedCallback (SHGAIN, v1); | |||
_valuecb->valueChangedCallback (SHFREQ, v2); | |||
_touch = 0; | |||
} | |||
} | |||
@@ -147,10 +151,11 @@ void Mainwin::handle_stop (void) | |||
} | |||
void Mainwin::handle_callb (int type, X_window *W, XEvent * /*E*/) | |||
void Mainwin::handle_callb (int type, X_window *W, XEvent *E) | |||
{ | |||
RotaryCtl *R; | |||
int k; | |||
double v, v2; | |||
switch (type) | |||
{ | |||
@@ -170,10 +175,14 @@ void Mainwin::handle_callb (int type, X_window *W, XEvent * /*E*/) | |||
switch (k) | |||
{ | |||
case INPBAL: | |||
_jclient->set_inpbal (_rotary [INPBAL]->value ()); | |||
v = _rotary [INPBAL]->value (); | |||
_jclient->set_inpbal (v); | |||
_valuecb->valueChangedCallback (INPBAL, v); | |||
break; | |||
case HPFILT: | |||
_jclient->set_hpfilt (_rotary [HPFILT]->value ()); | |||
v = _rotary [HPFILT]->value (); | |||
_jclient->set_hpfilt (v); | |||
_valuecb->valueChangedCallback (HPFILT, v); | |||
break; | |||
case SHGAIN: | |||
case SHFREQ: | |||
@@ -181,7 +190,11 @@ void Mainwin::handle_callb (int type, X_window *W, XEvent * /*E*/) | |||
break; | |||
case LFFREQ: | |||
case LFGAIN: | |||
_jclient->set_loshelf (_rotary [LFGAIN]->value (), _rotary [LFFREQ]->value ()); | |||
v = _rotary [LFGAIN]->value (); | |||
v2 = _rotary [LFFREQ]->value (); | |||
_jclient->set_loshelf (v, v2); | |||
_valuecb->valueChangedCallback (LFGAIN, v); | |||
_valuecb->valueChangedCallback (LFFREQ, v2); | |||
break; | |||
} | |||
break; | |||
@@ -194,18 +207,17 @@ void Mainwin::redraw (void) | |||
XPutImage (dpy (), win (), dgc (), inputsect, 0, 0, 20, 0, 130, 75); | |||
XPutImage (dpy (), win (), dgc (), shuffsect, 0, 0, 190, 0, 170, 75); | |||
XPutImage (dpy (), win (), dgc (), lfshfsect, 0, 0, 410, 0, 105, 75); | |||
XPutImage (dpy (), win (), dgc (), redzita_img, 0, 0, XSIZE - 35, 0, 35, 75); | |||
} | |||
void Mainwin::numdisp (int k) | |||
{ | |||
int y = 0; | |||
_timeout = 10; | |||
if (k >= 0) fmtfreq (k); | |||
if (k == _parmind) return; | |||
if (k < 0) | |||
if (k < 0) | |||
{ | |||
_numtext->x_unmap (); | |||
_parmind = -1; |
@@ -1,7 +1,7 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// | |||
// 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 | |||
@@ -33,20 +33,25 @@ class Mainwin : public A_thread, public X_window, public X_callback | |||
{ | |||
public: | |||
enum { XSIZE = 640, YSIZE = 75 }; | |||
struct ValueChangedCallback { | |||
virtual ~ValueChangedCallback() {} | |||
virtual void valueChangedCallback(uint, double) = 0; | |||
}; | |||
enum { XSIZE = 540, YSIZE = 75 }; | |||
Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jclient); | |||
Mainwin (X_rootwin *parent, X_resman *xres, int xp, int yp, Jclient *jclient, ValueChangedCallback* valuecb); | |||
~Mainwin (void); | |||
Mainwin (const Mainwin&); | |||
Mainwin& operator=(const Mainwin&); | |||
void stop (void) { _stop = true; } | |||
int process (void); | |||
int process (void); | |||
private: | |||
enum { INPBAL, HPFILT, SHGAIN, SHFREQ, LFFREQ, LFGAIN, NROTARY }; | |||
virtual void thr_main (void) {} | |||
void handle_time (void); | |||
@@ -69,6 +74,8 @@ private: | |||
int _timeout; | |||
int _touch; | |||
ValueChangedCallback* _valuecb; | |||
friend class BLS1Plugin; | |||
}; | |||
@@ -1,7 +1,7 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2010 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// | |||
// 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 | |||
@@ -58,7 +58,7 @@ RotaryCtl::RotaryCtl (X_window *parent, | |||
{ | |||
x_add_events ( ExposureMask | |||
| Button1MotionMask | ButtonPressMask | ButtonReleaseMask); | |||
} | |||
} | |||
RotaryCtl::~RotaryCtl (void) | |||
@@ -68,9 +68,6 @@ RotaryCtl::~RotaryCtl (void) | |||
void RotaryCtl::init (X_display *disp) | |||
{ | |||
if (_cairosurf != NULL) | |||
return; | |||
_cairosurf = cairo_xlib_surface_create (disp->dpy (), 0, disp->dvi (), 50, 50); | |||
_cairotype = cairo_create (_cairosurf); | |||
} | |||
@@ -78,14 +75,8 @@ void RotaryCtl::init (X_display *disp) | |||
void RotaryCtl::fini (void) | |||
{ | |||
if (_cairosurf == NULL) | |||
return; | |||
cairo_destroy (_cairotype); | |||
cairo_surface_destroy (_cairosurf); | |||
_cairotype = NULL; | |||
_cairosurf = NULL; | |||
} | |||
@@ -95,11 +86,11 @@ void RotaryCtl::handle_event (XEvent *E) | |||
{ | |||
case Expose: | |||
render (); | |||
break; | |||
break; | |||
case ButtonPress: | |||
bpress ((XButtonEvent *) E); | |||
break; | |||
break; | |||
case ButtonRelease: | |||
brelse ((XButtonEvent *) E); | |||
@@ -109,7 +100,7 @@ void RotaryCtl::handle_event (XEvent *E) | |||
motion ((XMotionEvent *) E); | |||
break; | |||
default: | |||
default: | |||
fprintf (stderr, "RotaryCtl: event %d\n", E->type ); | |||
} | |||
} | |||
@@ -135,11 +126,11 @@ void RotaryCtl::bpress (XButtonEvent *E) | |||
else if ((int)E->button == _wb_up) | |||
{ | |||
r = handle_mwheel (1); | |||
} | |||
else if ((int)E->button == _wb_dn) | |||
} | |||
else if ((int)E->button == _wb_dn) | |||
{ | |||
r = handle_mwheel (-1); | |||
} | |||
} | |||
if (r) | |||
{ | |||
callback (r); | |||
@@ -179,7 +170,7 @@ void RotaryCtl::motion (XMotionEvent *E) | |||
void RotaryCtl::set_state (int s) | |||
{ | |||
_state = s; | |||
_state = s; | |||
render (); | |||
} | |||
@@ -68,7 +68,7 @@ public: | |||
virtual void set_state (int s); | |||
virtual void set_value (double v) = 0; | |||
virtual void get_string (char * /*p*/, int /*n*/) {} | |||
virtual void get_string (char *p, int n) {} | |||
static void init (X_display *disp); | |||
static void fini (void); |
@@ -1,64 +0,0 @@ | |||
# -------------------------------------------------------------------------- | |||
# | |||
# Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
# | |||
# 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., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
# | |||
# -------------------------------------------------------------------------- | |||
PREFIX = /usr/local | |||
SUFFIX := $(shell uname -m | sed -e 's/^unknown/$//' -e 's/^i.86/$//' -e 's/^x86_64/$/64/') | |||
LIBDIR = lib$(SUFFIX) | |||
BINDIR = $(PREFIX)/bin | |||
SHARED = $(PREFIX)/share/zita-bls1 | |||
VERSION = 0.1.0 | |||
DISTDIR = zita-bls1-$(VERSION) | |||
CPPFLAGS += -DVERSION=\"$(VERSION)\" -DSHARED=\"$(SHARED)\" | |||
CXXFLAGS += -O2 -ffast-math -Wall -MMD -MP | |||
CXXFLAGS += -march=native | |||
all: zita-bls1 | |||
ZITA-BLS1_O = zita-bls1.o styles.o jclient.o mainwin.o png2img.o guiclass.o rotary.o \ | |||
hp3filt.o lfshelf2.o shuffler.o | |||
zita-bls1: CPPFLAGS += -I/usr/X11R6/include `freetype-config --cflags` | |||
zita-bls1: LDLIBS += -lzita-convolver -lfftw3f -lclxclient -lclthreads -ljack -lcairo -lpthread -lpng -lXft -lX11 -lrt | |||
zita-bls1: LDFLAGS += -L/usr/X11R6/lib | |||
zita-bls1: $(ZITA-BLS1_O) | |||
g++ $(LDFLAGS) -o $@ $(ZITA-BLS1_O) $(LDLIBS) | |||
$(ZITA-BLS1_O): | |||
-include $(ZITA-BLS1_O:%.o=%.d) | |||
install: all | |||
install -d $(DESTDIR)$(BINDIR) | |||
install -d $(DESTDIR)$(SHARED) | |||
install -m 755 zita-bls1 $(DESTDIR)$(BINDIR) | |||
rm -rf $(DESTDIR)$(SHARED)/* | |||
install -m 644 ../share/* $(DESTDIR)$(SHARED) | |||
uninstall: | |||
rm -f $(DESTDIR)$(BINDIR)/zita-bls1 | |||
rm -rf $(DESTDIR)$(SHARED) | |||
clean: | |||
/bin/rm -f *~ *.o *.a *.d *.so | |||
/bin/rm -f zita-bls1 | |||
@@ -1,129 +0,0 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
// | |||
// ---------------------------------------------------------------------- | |||
#include <stdlib.h> | |||
#include <stdio.h> | |||
#include <clthreads.h> | |||
#include <sys/mman.h> | |||
#include <signal.h> | |||
#include "global.h" | |||
#include "styles.h" | |||
#include "jclient.h" | |||
#include "mainwin.h" | |||
#define NOPTS 4 | |||
#define CP (char *) | |||
XrmOptionDescRec options [NOPTS] = | |||
{ | |||
{ CP"-h", CP".help", XrmoptionNoArg, CP"true" }, | |||
{ CP"-g", CP".geometry", XrmoptionSepArg, 0 }, | |||
{ CP"-s", CP".server", XrmoptionSepArg, 0 } | |||
}; | |||
static Jclient *jclient = 0; | |||
static Mainwin *mainwin = 0; | |||
static void help (void) | |||
{ | |||
fprintf (stderr, "\n%s-%s\n\n", PROGNAME, VERSION); | |||
fprintf (stderr, " (C) 2011 Fons Adriaensen <fons@linuxaudio.org>\n\n"); | |||
fprintf (stderr, "Options:\n"); | |||
fprintf (stderr, " -h Display this text\n"); | |||
fprintf (stderr, " -g <geometry> Window position\n"); | |||
fprintf (stderr, " -s <server> Jack server name\n"); | |||
exit (1); | |||
} | |||
static void sigint_handler (int) | |||
{ | |||
signal (SIGINT, SIG_IGN); | |||
mainwin->stop (); | |||
} | |||
int main (int ac, char *av []) | |||
{ | |||
X_resman xresman; | |||
X_display *display; | |||
X_handler *handler; | |||
X_rootwin *rootwin; | |||
int ev, xp, yp, xs, ys; | |||
xresman.init (&ac, av, CP PROGNAME, options, NOPTS); | |||
if (xresman.getb (".help", 0)) help (); | |||
display = new X_display (xresman.get (".display", 0)); | |||
if (display->dpy () == 0) | |||
{ | |||
fprintf (stderr, "Can't open display.\n"); | |||
delete display; | |||
return 1; | |||
} | |||
xp = yp = 100; | |||
xs = Mainwin::XSIZE + 4; | |||
ys = Mainwin::YSIZE + 30; | |||
xresman.geometry (".geometry", display->xsize (), display->ysize (), 1, xp, yp, xs, ys); | |||
if (styles_init (display, &xresman)) | |||
{ | |||
delete display; | |||
return 1; | |||
} | |||
jclient = new Jclient (xresman.rname (), xresman.get (".server", 0)); | |||
rootwin = new X_rootwin (display); | |||
mainwin = new Mainwin (rootwin, &xresman, xp, yp, jclient); | |||
rootwin->handle_event (); | |||
handler = new X_handler (display, mainwin, EV_X11); | |||
handler->next_event (); | |||
XFlush (display->dpy ()); | |||
ITC_ctrl::connect (jclient, EV_EXIT, mainwin, EV_EXIT); | |||
if (mlockall (MCL_CURRENT | MCL_FUTURE)) fprintf (stderr, "Warning: memory lock failed.\n"); | |||
signal (SIGINT, sigint_handler); | |||
do | |||
{ | |||
ev = mainwin->process (); | |||
if (ev == EV_X11) | |||
{ | |||
rootwin->handle_event (); | |||
handler->next_event (); | |||
} | |||
} | |||
while (ev != EV_EXIT); | |||
delete jclient; | |||
delete handler; | |||
delete rootwin; | |||
delete display; | |||
return 0; | |||
} | |||
@@ -1,7 +1,7 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// | |||
// 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 | |||
@@ -22,6 +22,7 @@ | |||
#include "styles.h" | |||
#include "png2img.h" | |||
#include "CarlaString.hpp" | |||
XftColor *XftColors_bls1 [NXFTCOLORS]; | |||
XftFont *XftFonts_bls1 [NXFTFONTS]; | |||
@@ -31,7 +32,6 @@ X_textln_style tstyle1; | |||
XImage *inputsect; | |||
XImage *shuffsect; | |||
XImage *lfshfsect; | |||
XImage *redzita_img; | |||
RotaryImg inpbal_img; | |||
RotaryImg hpfilt_img; | |||
RotaryImg shfreq_img; | |||
@@ -41,7 +41,7 @@ RotaryImg lfgain_img; | |||
int styles_init (X_display *disp, X_resman *xrm) | |||
int styles_init (X_display *disp, X_resman *xrm, const char *resdir) | |||
{ | |||
XftColors_bls1 [C_MAIN_BG] = disp->alloc_xftcolor (0.25f, 0.25f, 0.25f, 1.0f); | |||
XftColors_bls1 [C_MAIN_FG] = disp->alloc_xftcolor (1.0f, 1.0f, 1.0f, 1.0f); | |||
@@ -54,11 +54,11 @@ int styles_init (X_display *disp, X_resman *xrm) | |||
tstyle1.color.normal.bgnd = XftColors_bls1 [C_TEXT_BG]->pixel; | |||
tstyle1.color.normal.text = XftColors_bls1 [C_TEXT_FG]; | |||
inputsect = png2img (SHARED"/inputsect.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
shuffsect = png2img (SHARED"/shuffsect.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
lfshfsect = png2img (SHARED"/lfshfsect.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
redzita_img = png2img (SHARED"/redzita.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
if (!inputsect || !shuffsect || !lfshfsect || !redzita_img) return 1; | |||
const CarlaString SHARED = CarlaString(resdir)+"/bls1"; | |||
inputsect = png2img (SHARED+"/inputsect.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
shuffsect = png2img (SHARED+"/shuffsect.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
lfshfsect = png2img (SHARED+"/lfshfsect.png", disp, XftColors_bls1 [C_MAIN_BG]); | |||
if (!inputsect || !shuffsect || !lfshfsect) return 1; | |||
inpbal_img._backg = XftColors_bls1 [C_MAIN_BG]; | |||
inpbal_img._image [0] = inputsect; | |||
@@ -92,7 +92,7 @@ int styles_init (X_display *disp, X_resman *xrm) | |||
shgain_img._xref = 12.5; | |||
shgain_img._yref = 12.5; | |||
shgain_img._rad = 12; | |||
shfreq_img._backg = XftColors_bls1 [C_MAIN_BG]; | |||
shfreq_img._image [0] = shuffsect; | |||
shfreq_img._lncol [0] = 0; | |||
@@ -103,7 +103,7 @@ int styles_init (X_display *disp, X_resman *xrm) | |||
shfreq_img._xref = 12.5; | |||
shfreq_img._yref = 12.5; | |||
shfreq_img._rad = 12; | |||
lffreq_img._backg = XftColors_bls1 [C_MAIN_BG]; | |||
lffreq_img._image [0] = lfshfsect; | |||
lffreq_img._lncol [0] = 0; | |||
@@ -130,6 +130,6 @@ int styles_init (X_display *disp, X_resman *xrm) | |||
} | |||
void styles_fini (X_display * /*disp*/) | |||
void styles_fini (X_display *disp) | |||
{ | |||
} |
@@ -1,7 +1,7 @@ | |||
// ---------------------------------------------------------------------- | |||
// | |||
// Copyright (C) 2011 Fons Adriaensen <fons@linuxaudio.org> | |||
// | |||
// | |||
// 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 | |||
@@ -40,7 +40,7 @@ enum | |||
}; | |||
extern int styles_init (X_display *disp, X_resman *xrm); | |||
extern int styles_init (X_display *disp, X_resman *xrm, const char *resdir); | |||
extern void styles_fini (X_display *disp); | |||
extern XftColor *XftColors_bls1 [NXFTCOLORS]; | |||
@@ -51,7 +51,6 @@ extern X_textln_style tstyle1; | |||
extern XImage *inputsect; | |||
extern XImage *shuffsect; | |||
extern XImage *lfshfsect; | |||
extern XImage *redzita_img; | |||
extern RotaryImg inpbal_img; | |||
extern RotaryImg hpfilt_img; | |||
extern RotaryImg shfreq_img; |