Skip to content

Commit

Permalink
Fix issues #56 and #55 build with FREEBSD/clang
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Mar 25, 2024
1 parent 49d88eb commit 33edef3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 50 deletions.
2 changes: 1 addition & 1 deletion libxputty
10 changes: 7 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@
LOCAL_DIR ?= $(SHARE_DIR)/locale

# set compile flags
CXXFLAGS += -std=gnu++17 -O3 -D_FORTIFY_SOURCE=2 -Wall -fstack-protector -funroll-loops -ffast-math -fomit-frame-pointer \
-fstrength-reduce -fschedule-insns -MMD $(SSE_CFLAGS)

CXXFLAGS += -std=gnu++17 -O3 -D_FORTIFY_SOURCE=2 -Wall -fstack-protector -funroll-loops \
-ffast-math -fomit-frame-pointer -MMD $(SSE_CFLAGS)
ifneq ($(CXX), clang)
CXXFLAGS += -fstrength-reduce -fschedule-insns
endif
DEBUG_CXXFLAGS += -g -D DEBUG
LDFLAGS += -Wl,-z,noexecstack -Wl,--no-undefined \
`pkg-config --libs jack cairo x11 sigc++-2.0 liblo smf fluidsynth` -lm -pthread -lasound
`pkg-config --libs jack cairo x11 sigc++-2.0 liblo smf fluidsynth` -lm -pthread -lasound -lstdc++
INCFLAGS = -I./ -I../libxputty/libxputty/include/ -I../libscala-file/ \
`pkg-config --cflags jack cairo x11 sigc++-2.0 liblo smf fluidsynth`\
-DVERSION=\"$(VER)\"
Expand Down
2 changes: 1 addition & 1 deletion src/Mamba.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ bool MidiLoad::load_file(std::vector<MidiEvent> *play, int *song_bpm, const char
}
}
// filter out 0xFF system reset message
if ((smf_event->midi_buffer[0] == 0xff)) {
if (smf_event->midi_buffer[0] == 0xff) {
continue;
}
ev = {{smf_event->midi_buffer[0], smf_event->midi_buffer[1], smf_event->midi_buffer[2]},
Expand Down
66 changes: 22 additions & 44 deletions src/MidiKeyBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3293,8 +3293,7 @@ void XKeyBoard::set_on_off_label(void *w_, void* user_data) noexcept{
//static
void XKeyBoard::instrument_callback(void *w_, void* user_data) {
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(xjmkb->fs_instruments->adj);
xjmkb->xsynth->channel_instrument[xjmkb->mchannel] = i;
std::istringstream buf(xjmkb->xsynth->instruments[i]);
Expand Down Expand Up @@ -3323,8 +3322,7 @@ void XKeyBoard::rebuild_instrument_list() {
//static
void XKeyBoard::soundfont_callback(void *w_, void* user_data) {
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
if (!strstr(xjmkb->soundfontname.data(), w->label)) {
std::string sf = xjmkb->soundfontpath;
sf +="/";
Expand Down Expand Up @@ -3370,8 +3368,7 @@ int XKeyBoard::get_edo_steps() {
//static
void XKeyBoard::edo_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
if ( xjmkb->mchannel > 15) xjmkb->xsynth->activate_tunning_for_all_channel(i);
else xjmkb->xsynth->activate_tuning_for_channel(xjmkb->mchannel, i);
Expand All @@ -3382,8 +3379,7 @@ void XKeyBoard::edo_callback(void *w_, void* user_data) noexcept{
//static
void XKeyBoard::synth_hide_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
adj_set_value(xjmkb->fs[0]->adj, 0.0);
}

Expand Down Expand Up @@ -3572,8 +3568,7 @@ void XKeyBoard::draw_looper_ui(void *w_, void* user_data) noexcept{
XWindowAttributes attrs;
XGetWindowAttributes(w->app->dpy, (Window)w->widget, &attrs);
if (attrs.map_state != IsViewable) return;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
set_pattern(w,&w->app->color_scheme->selected,&w->app->color_scheme->normal,BACKGROUND_);
cairo_paint (w->crb);
widget_set_scale(w);
Expand Down Expand Up @@ -3611,135 +3606,118 @@ void XKeyBoard::show_looper_ui(int present) {
//static
void XKeyBoard::looper_hide_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
adj_set_value(xjmkb->lmc->adj, 0.0);
}

static void play_channel1_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[0].store(i, std::memory_order_release);
}

static void play_channel2_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[1].store(i, std::memory_order_release);
}

static void play_channel3_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[2].store(i, std::memory_order_release);
}

static void play_channel4_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[3].store(i, std::memory_order_release);
}

static void play_channel5_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[4].store(i, std::memory_order_release);
}

static void play_channel6_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[5].store(i, std::memory_order_release);
}

static void play_channel7_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[6].store(i, std::memory_order_release);
}

static void play_channel8_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[7].store(i, std::memory_order_release);
}

static void play_channel9_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[8].store(i, std::memory_order_release);
}

static void play_channel10_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[9].store(i, std::memory_order_release);
}

static void play_channel11_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[10].store(i, std::memory_order_release);
}

static void play_channel12_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[11].store(i, std::memory_order_release);
}

static void play_channel13_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[12].store(i, std::memory_order_release);
}

static void play_channel14_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[13].store(i, std::memory_order_release);
}

static void play_channel15_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[14].store(i, std::memory_order_release);
}

static void play_channel16_callback(void *w_, void* user_data) noexcept{
Widget_t *w = (Widget_t*)w_;
Widget_t *win = get_toplevel_widget(w->app);
XKeyBoard *xjmkb = (XKeyBoard*) win->parent_struct;
XKeyBoard *xjmkb = XKeyBoard::get_instance(w);
int i = (int)adj_get_value(w->adj);
xjmkb->xjack->channel_matrix[15].store(i, std::memory_order_release);
}
Expand Down
1 change: 0 additions & 1 deletion src/MidiKeyBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ class XKeyBoard {
Widget_t *file_remove_menu;
Widget_t *load_midi;
Widget_t *add_midi;
Widget_t *load_scala;
Widget_t *sfont_menu;
Widget_t *fs_instruments;
Widget_t *fs_soundfont;
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 33edef3

Please sign in to comment.