Browse Source

Fix minor issues in NekoFilter UI

tags/1.9.4
falkTX 12 years ago
parent
commit
8db5be8637
2 changed files with 31 additions and 10 deletions
  1. +22
    -4
      source/backend/native/nekofilter/ui.c
  2. +9
    -6
      source/backend/native/nekofilter/ui.py

+ 22
- 4
source/backend/native/nekofilter/ui.c View File

@@ -268,6 +268,20 @@ nekoui_quit(
{
write(control_ptr->send_pipe, "quit\n", 5);
control_ptr->visible = false;
/* for a while wait child to exit, we dont like zombie processes */
if (!wait_child(control_ptr->pid))
{
fprintf(stderr, "force killing misbehaved child %d (exit)\n", (int)control_ptr->pid);
if (kill(control_ptr->pid, SIGKILL) == -1)
{
fprintf(stderr, "kill() failed: %s (exit)\n", strerror(errno));
}
else
{
wait_child(control_ptr->pid);
}
}
}

#if defined(FORK_TIME_MEASURE)
@@ -324,7 +338,7 @@ nekoui_instantiate(
char ui_send_pipe[100];
int oldflags;
FORK_TIME_MEASURE_VAR;
const char * argv[5];
const char * argv[6];
int ret;
int i;
char ch;
@@ -361,6 +375,9 @@ nekoui_instantiate(

strcpy(filename, bundle_path);
strcat(filename, UI_EXECUTABLE);
char sample_rate_str[12] = { 0 };
snprintf(sample_rate_str, 12, "%g", host->get_sample_rate(host->handle));

control_ptr->running = false;
control_ptr->visible = false;
@@ -369,9 +386,10 @@ nekoui_instantiate(

argv[0] = "python";
argv[1] = filename;
argv[2] = ui_recv_pipe; /* reading end */
argv[3] = ui_send_pipe; /* writting end */
argv[4] = NULL;
argv[2] = sample_rate_str;
argv[3] = ui_recv_pipe; /* reading end */
argv[4] = ui_send_pipe; /* writting end */
argv[5] = NULL;

FORK_TIME_MEASURE_BEGIN;



+ 9
- 6
source/backend/native/nekofilter/ui.py View File

@@ -621,8 +621,8 @@ class Knob(gtk.VBox):
return False

class filter_band:
def __init__(self):
self.fsamp = 48e3
def __init__(self, sample_rate):
self.fsamp = sample_rate

def set_params(self, freq, bandw, gain):
freq_ratio = freq / self.fsamp
@@ -827,9 +827,9 @@ class frequency_response(gtk.DrawingArea):
cairo_ctx.show_text(label)
cairo_ctx.stroke()

def add_filter(self, label, adj_hz, adj_db, adj_bw, color):
def add_filter(self, label, sample_rate, adj_hz, adj_db, adj_bw, color):
#print "filter %s added (%.2f Hz, %.2f dB, %.2f bw)" % (label, adj_hz.value, adj_db.value, adj_bw.value)
filter = filter_band()
filter = filter_band(sample_rate)
filter.enabled = False
filter.label = label
filter.color = color
@@ -880,9 +880,11 @@ class filter_ui:

if self.fake:
self.shown = False
self.sample_rate = 48e3
else:
self.recv_pipe_fd = int(argv[1])
self.send_pipe_fd = int(argv[2])
self.sample_rate = float(argv[1])
self.recv_pipe_fd = int(argv[2])
self.send_pipe_fd = int(argv[3])

oldflags = fcntl.fcntl(self.recv_pipe_fd, fcntl.F_GETFL)
fcntl.fcntl(self.recv_pipe_fd, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
@@ -1006,6 +1008,7 @@ class filter_ui:

self.fr.add_filter(
str(i + 1),
self.sample_rate,
self.ports[port_index - 3]['adj'], # frequency
self.ports[port_index - 1]['adj'], # gain
self.ports[port_index - 2]['adj'], # bandwidth


Loading…
Cancel
Save