guitarixOSX 0.24

You need help with guitarix, ask here

guitarixOSX 0.24

Postby maciimacii » Mon Nov 05, 2012 11:49 am

I've got guitarix 0.24 running ok on OSX and have uploaded the OSX guitarix install file.

I've tested just about every guitarix 0.24 feature on my Snow Leopard 10.6.8 mac.

The install file contains all of the runtime libraries that guitarix 0.24 needs, so guitarix should (theoretically) run on any OSX system without any additional library installs or library compiling.

It was compiled and tested with X11 XQuartz 2.3.6 (Snow Leopard 10.6.8) and I havn't tested it with other XQuartz versions.

I'd suggest that the old guitarix 0.19 version be replaced by this version as the guitarix 0.19 version didn't include the runtime libraries and it also has a few issues with the semaphore code as well.

I just tested it with later XQuartz versions that install into the /opt/X11 directory which is different to where the Apple X11 directory is in /usr/X11 and this version of guitarix is compiled against Apples /usr/X11 path so if anyone wants to use guitarix with later versions of XQuartz then enter this into a terminal before running guitarix and it will enable the later XQuartz in /opt/X11 to be used.

export DYLD_FALLBACK_LIBRARY_PATH=:/opt/X11/lib:/usr/local/lib:/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH

or maybe

export DYLD_LIBRARY_PATH=:/opt/X11/lib:/usr/local/lib:/usr/lib:$DYLD_LIBRARY_PATH
Last edited by maciimacii on Mon Nov 12, 2012 1:19 pm, edited 1 time in total.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby brummer10 » Mon Nov 05, 2012 7:41 pm

Hi maciimacii

Great, yep I have replaced the old guitarixOSX with the new version in our file repository.
Now I'm really interested in the needed changes to make to make it all work.
If you like I could open for you a developer access to our GIT repository, to make our source suitable for MACOSX and LINUX
we already have the #ifdef IS_MACOSX macro, which could to the job to split the source were it is needed.

greets
hermann
User avatar
brummer10
Site Admin
 
Posts: 299
Joined: Thu Mar 26, 2009 6:57 pm

Re: guitarixOSX 0.24

Postby maciimacii » Tue Nov 06, 2012 3:16 am

Most of the changes are some minor path changes and semaphore emulation changes.

Some minor path changes.

guitarix had some trouble trying to make the config directory so I changed gx_system to

user_dir = string(getenv("HOME")) + "/guitarix/";

and also in various places in ladspa_guitarix

ie

sl.add(string(getenv("HOME")) + "/guitarix/"); //FIXME

and I set the

XDG_DATA_HOME environmental variable to HOME/guitarix because the gtk recently-used.xbel file had trouble being created in it's default path.

and I also had to set

XDG_DATA_DIRS to /opt/local/share/:/usr/local/share/:/usr/share/

I also had trouble with mime.
mime doesn't work very well unless mime is setup for the OSX terminal which means that mime doesn't work that well for terminal apps (like guitarix) for most OSX users with out of the box OSX installs so I didn't use mime.
If I did use mime on a usual OSX install, then the ladspa plugins wouldn't appear and also wav file problems etc.

I also removed the clearlooks references in common.rc because a lot of OSX users wouldn't have clearlooks.

The main changes are emulation of the semaphore functions because Apple doesn't implement all of the semaphore functions.


The defines that work for OSX are __APPLE__ and __MACH__

I expanded the zita convolver semaphore emulation with some added functions and it seems to work ok.

Changes to the thread code for semaphore emulation


#ifdef __APPLE__

// NOTE: ***** I DO NOT REPEAT NOT PROVIDE SUPPORT FOR OSX *****
//
// The following code partially emulates the POSIX sem_t for which
// OSX has only a crippled implementation. It may or may not compile,
// and if it compiles it may or may not work correctly. Blame APPLE
// for not following POSIX standards.

class ZCsema
{
public:

ZCsema (void) : _count (0)
{
init (0, 0);
}

~ZCsema (void)
{
pthread_mutex_destroy (&_mutex);
pthread_cond_destroy (&_cond);
}

ZCsema (const ZCsema&); // disabled
ZCsema& operator= (const ZCsema&); // disabled

int init (int s, int v)
{
_count = v;
return pthread_mutex_init (&_mutex, 0) || pthread_cond_init (&_cond, 0);
}

int post (void)
{
pthread_mutex_lock (&_mutex);
_count++;
if (_count == 1) pthread_cond_signal (&_cond);
pthread_mutex_unlock (&_mutex);
return 0;
}

int wait (void)
{
pthread_mutex_lock (&_mutex);
while (_count < 1) pthread_cond_wait (&_cond, &_mutex);
_count--;
pthread_mutex_unlock (&_mutex);
return 0;
}

int timedwait (timespec *ts)
{
pthread_mutex_lock (&_mutex);
while (_count < 1)
{
if (pthread_cond_timedwait(&_cond, &_mutex, ts) == ETIMEDOUT)
{
pthread_mutex_unlock (&_mutex);
return 1;
}
}
_count--;
pthread_mutex_unlock (&_mutex);
return 0;
}

int getvalue(void)
{
int retcount;
pthread_mutex_lock (&_mutex);
retcount = _count;
pthread_mutex_unlock (&_mutex);
return retcount;
}

int trywait (void)
{
if (pthread_mutex_trylock (&_mutex)) return -1;
if (_count < 1)
{
pthread_mutex_unlock (&_mutex);
return -1;
}
_count--;
pthread_mutex_unlock (&_mutex);
return 0;
}

private:

int _count;
pthread_mutex_t _mutex;
pthread_cond_t _cond;
};

#define ZCSEMA_IS_IMPLEMENTED
#endif




then we use these instead of the semaphores ie

class ProcessingChainBase {
public:
enum RampMode { ramp_mode_down_dead, ramp_mode_down, ramp_mode_up_dead, ramp_mode_up, ramp_mode_off };
private:
// sem_t sync_sem; // RT
ZCsema sync_sem; // RT
list<Plugin*> to_release;
int ramp_value; // RT




ProcessingChainBase::ProcessingChainBase():
sync_sem(),
to_release(),
ramp_value(0),
ramp_mode(ramp_mode_down_dead),
stopped(true),
steps_up(),
steps_up_dead(),
steps_down(),
modules(),
next_commit_needs_ramp() {
// sem_init(&sync_sem, 0, 0);
sync_sem.init (0, 0);
}



emulating missing sem_timedwait



bool ProcessingChainBase::wait_rt_finished() {
if (stopped) {
return true;
}
timespec ts;
timeval now;
// clock_gettime(CLOCK_REALTIME, &ts);

gettimeofday(&now,NULL);

ts.tv_sec = now.tv_sec;
ts.tv_nsec = now.tv_usec*1000;


const long ns_in_sec = 1000000000;
ts.tv_nsec += ns_in_sec / 10;
if (ts.tv_nsec >= ns_in_sec) {
ts.tv_nsec -= ns_in_sec;
ts.tv_sec += 1;
}



if(sync_sem.timedwait(&ts) == 1)
{
gx_system::gx_print_warning("sem_timedwait", "timeout");
return false;
}


return true;


}


original

bool ProcessingChainBase::wait_rt_finished() {
if (stopped) {
return true;
}
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
const long ns_in_sec = 1000000000;
ts.tv_nsec += ns_in_sec / 10;
if (ts.tv_nsec >= ns_in_sec) {
ts.tv_nsec -= ns_in_sec;
ts.tv_sec += 1;
}
while (sem_timedwait(&sync_sem, &ts) == -1) {
if (errno == EINTR) {
continue;
}
if (errno == ETIMEDOUT) {
gx_system::gx_print_warning("sem_timedwait", "timeout");
return false;
}
gx_system::gx_print_error("sem_timedwait", "unknown error");
break;
}
return true;
}


and emulating missing sem_getvalue


void ProcessingChainBase::set_latch() {
int val;
// sem_getvalue(&sync_sem, &val);
// if (val > 0) {
// sem_wait(&sync_sem);
// }
// assert(sem_getvalue(&sync_sem, &val) == 0 && val == 0);

val = sync_sem.getvalue();

if (val > 0)
sync_sem.wait();
}



class ProcessingChainBase {
public:
enum RampMode { ramp_mode_down_dead, ramp_mode_down, ramp_mode_up_dead, ramp_mode_up, ramp_mode_off };
private:
// sem_t sync_sem; // RT
ZCsema sync_sem; // RT
list<Plugin*> to_release;
int ramp_value; // RT
int ramp_mode; // RT should be RampMode, but gcc 4.5 doesn't accept it for g_atomic_int_compare_and_exchange
bool stopped;
protected:
int steps_up; // RT; >= 1
int steps_up_dead; // RT; >= 0
int steps_down; // RT; >= 1
list<Plugin*> modules;
inline void set_ramp_value(int n) { gx_system::atomic_set(&ramp_value, n); } // RT
inline void set_ramp_mode(RampMode n) { gx_system::atomic_set(&ramp_mode, n); } // RT
void try_set_ramp_mode(RampMode oldmode, RampMode newmode, int oldrv, int newrv); // RT
public:
bool next_commit_needs_ramp;
ProcessingChainBase();
inline RampMode get_ramp_mode() {
return static_cast<RampMode>(gx_system::atomic_get(ramp_mode)); // RT
}
inline int get_ramp_value() { return gx_system::atomic_get(ramp_value); } // RT
void set_samplerate(int samplerate);
bool set_plugin_list(const list<Plugin*> &p);
void clear_module_states();
inline void post_rt_finished() { // RT
int val;
//sem_getvalue(&sync_sem, &val);
//if (val == 0) {
// sem_post(&sync_sem);
//}

val = sync_sem.getvalue();

if (val == 0)
sync_sem.post();

}
bool wait_rt_finished();
void set_latch();
void wait_latch() { wait_rt_finished(); }
void sync() { set_latch(); wait_latch(); }
inline bool check_release() { return !to_release.empty(); }
void release();
void wait_ramp_down_finished();
void start_ramp_up();
void start_ramp_down();
inline void set_down_dead() { set_ramp_mode(ramp_mode_down_dead); }
void set_stopped(bool v);
#ifndef NDEBUG
void print_chain_state(const char *title);
#endif
};
Last edited by maciimacii on Wed Nov 14, 2012 1:51 pm, edited 6 times in total.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby maciimacii » Tue Nov 06, 2012 3:19 am

Compiling from the start.

This is for my Snow Leopard 10.6.8 system.

XCode 3.2 (Snow Leopard)

Updating Snow Leopards XCode 3.2 compilers for Snow Leopard.

Install GCC-10.6.pkg at https://github.com/kennethreitz/osx-gcc-installer

Install Apples clang 2.1 from GCC-10.7.pkg at https://github.com/kennethreitz/osx-gcc-installer

Install the GCC-10.6.pkg first and then the updated clang compiler from GCC-10.7.pkg in that order, otherwise there is clang --demangle configuration problems.

Apples clang 2.0 and gcc 4.2.1 can't handle the guitarix 0.24 code but Apples clang 2.1 can and also gcc 4.8 can.

Install just the clang 2.1 package in GCC-10.7.pkg and no other packages otherwise there are going to be conflicts because the other packages are for a later XCode (Lion) version than XCode 3.2 (Snow Leopard) but the updated clang 2.1 package works with XCode 3.2 (Snow Leopard).

If someone has Lion or Mountain Lion and a later version of XCode then they can ignore the above Snow Leopard compiler updating.

To switch to clang 2.1 to compile guitarix 0.24 use

export CC=$CC/usr/bin/clang

export CXX=$CXX/usr/bin/clang++

and then ./waf configure will pick up clang 2.1 as the compiler.

Apples Clang 2.1 doesn't seem to recognize the CPATH and LIBRARY_PATH settings (a bug) but waf picks up the paths ok if the boost headers are in usr/local/include

Boost only seems to need the headers installed for the version I'm using which is 1.45, so editing out the boost_system library check in the wscript file means that the boost libraries don't have to be built and just the boost headers can be used.

If X11 is installed in /usr/X11 then XQuartz installs in /opt/X11

As I understand it, Snow Leopard has Apples X11 installed in /usr/X11 but Mountain Lion doesn't as Apple dropped X11 and now XQuartz needs to be installed.

If there is no Apple X11 installed in /usr/X11, then XQuartz seems to install in both /usr/X11 and /opt/X11 but if Apples X11 is installed in /usr/X11 (ie Snow Leopard) then XQuartz just installs in /opt/X11.

Either way, there seems to be a X11 install in /usr/X11 for both Apple and XQuartz, so the X window linking should really be done against /usr/X11 and not /opt/X11.

Compiling the libraries.

pango 1.30.1 has a bug that breaks the coretext fonts and pango 1.30.0 doesn't have the bug.

Pango's coretext font code is still a bit buggy in pango 1.30.0 so I would disable it by disabling ATSUI and CoreText in the configuration file.
Later versions of Pango might be a bit better at handling coretext (I havn't tried them)

Apples gcc 4.2.1 can be used for compiling the libraries.

I used Apples gcc 4.2.1 to compile the libraries and then used Apples clang 2.1 to compile guitarix 0.24.


move the uncompressed library folders to Desktop otherwise there can be some problems with paths when compiling.

Set the environment.

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/local/lib/pkgconfig:/usr/local/lib/pkgconfig

export PATH=$PATH:/opt/local/bin:/usr/local/bin

export CPATH=$CPATH:/usr/include:/opt/local/include:/usr/local/include

export LIBRARY_PATH=$LIBRARY_PATH:/usr/lib:/opt/local/lib:/usr/local/lib

Follow the library compile order as certain libraries depend on others.

library compile and install order

gettext 0.18.11

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

libffi 3.0.11

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

pkg-config 0.27.1

CFLAGS=-O2 ./configure --prefix=/opt/local --with-internal-glib

make

sudo make install


glib 2.35.1

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

atk 2.2.0

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

freetype 2.1.10

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

libjpeg jpegsrc.v8d

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

libxml2 2.8.0

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


libcroco 0.6.7

CFLAGS=-O2 ./configure --prefix=/opt/local --disable-Bsymbolic

make

sudo make install

tiff 3.9.5

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

libpng 1.5.13

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

pixbuf 2.26.4

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


pixman 0.26.2


CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

fontconfig 2.9.0

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

cairo 1.12.2

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


pango 1.30.0

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


librsvg 2.36.3

CFLAGS=-O2 ./configure --prefix=/opt/local --disable-Bsymbolic --disable-introspection

make

sudo make install


gtk 2.24.13

CFLAGS=-O2 ./configure --prefix=/opt/local --disable-introspection

make

sudo make install


libsigc++ 2.2.11

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


glibmm 2.32.1

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


cairomm 1.10

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


pangomm 2.28.4

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


atkmm 2.22.6

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


gtkmm 2.24.2

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


fftw 3.3.2

CFLAGS="-O3 -fomit-frame-pointer" ./configure --prefix=/opt/local --enable-shared --enable-float

make

sudo make install

libsndfile 1.0.25


CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

raptor2 2.0.8

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install

kWh LRDF (lrdf 0.50 needs ladspa.h from ardour)

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install


intltool 0.50.2

CFLAGS=-O2 ./configure --prefix=/opt/local

make

sudo make install
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby maciimacii » Fri Nov 30, 2012 2:10 pm

I made a gtk quartz version of guitarix.

What that means is that X11 is not needed and the gtk graphics go through a native OSX quartz graphics gtk backend.

The whole app and libraries then get bundled into a OSX bundle and the user just clicks on the apps bundle icon and the app runs, so no more command line terminal and bash or X11 needed.

This is what Ardour and Gimp are doing for their OSX distros.

It ran ok but it seems like there is some problem with the DragIcon drag and drop Gtk quartz code and it crashes on a drag and drop.

The menus behaved differently with an initial click to select the menu (as usual) but then no button press when scrolling to a selection needed for it to work. If the button was kept down while scrolling then the selection wouldn't work.

The Ladspa windows Cancel, Apply and Save buttons had trouble being highlighted and selected but the Convolution setup windows similar Cancel etc worked fine.

The Gtk menu text was pretty small for some reason as well.

A few other small things as well.

But, it looks possible to make a standalone native build of guitarix without needing X11 or the Command Line Terminal.

I might work on it every now and then and see what happens.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby maciimacii » Tue Dec 04, 2012 6:12 am

guitarixOSX-0.24-v5 has been uploaded.

This fixes the pango 1.30.1 coretext bug that was causing a lot of problems.

A certain person put a commit into pango 1.30.1 that was a coretext bug and for the next pango version it was quickly removed.

Unfortunately I was using pango 1.30.1 and it took a while to trace the coretext bug but that's how the dice roll.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby brummer10 » Tue Dec 04, 2012 3:19 pm

Did that mean that also LADSPA load with rdf files works now on OSX? I remember you mention that the error could be related to pango?
User avatar
brummer10
Site Admin
 
Posts: 299
Joined: Thu Mar 26, 2009 6:57 pm

Re: guitarixOSX 0.24

Postby maciimacii » Wed Dec 05, 2012 1:59 am

Yes, the ladspa rdf code works now and there are no more random glib thread crashes.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby maciimacii » Fri Dec 07, 2012 7:20 am

Here is a tip for not having to use the terminal to start guitarix.

Launch Automator and select the Application template and then choose Run Shell Script from the options in the list.

Detete whatever is in the editing window (mine has cat) and then enter

/usr/local/bin/guitarix -i system:capture_1 -o system:playback_1

or whatever options are preferred

and then save into the Applications folder with a program name, like guitarix or whatever.

Then just click on the Automator icon that has your program name in the Applications folder (don't forget to start JackPilot first) and guitarix should start.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Re: guitarixOSX 0.24

Postby maciimacii » Mon Dec 10, 2012 1:08 pm

I made an Application folder icon for guitarix which means that guitarix can just be started by clicking on the icon after the icon is put into the Applications folder of course :)

JackOSX can be autostarted by guitarix by initially setting the JackOSX preferences using JackPilot and then selecting the "jackd autostart" option from guitarix's "Jack Startup Control" menu selection (Options menu).

Theoretically after all this, guitarix can just be started by clicking on the guitarixOSX icon in the Applications folder without the need to first start JackPilot or needing to start guitarix using the terminal.

The guitarixOSX icon will automaticaly start guitarix (with one input and 2 outputs) and then guitarix will automatically start JackOSX and X11 (XQuartz).

One more hint is to use the Line In and not the Microphone input due to the microphones input causing feedback at higher levels but it depends on the hardware used and so does the JackOSX latency.

Routing into and out of Apps like Ardour and Logic and even Audacity could be interesting using the JackOSX "Jack Router" and also Soundflower.

Audacity seems to create the JackRouter ports on the fly (portaudio seems to work like this) after the record or play button is activated so pausing just after activating the play or record button might be needed for some routing cases.

I havn't tested the routing possibilities much at the moment.
User avatar
maciimacii
 
Posts: 38
Joined: Wed Oct 10, 2012 7:36 am

Next

Return to need help with guitarix

Who is online

Users browsing this forum: No registered users and 1 guest