Skip to content

Commit

Permalink
Merge pull request #55 from tresf/travis
Browse files Browse the repository at this point in the history
Add Travis-CI build job
  • Loading branch information
swh authored Nov 4, 2017
2 parents a61ed6f + b9c02dd commit 6d15dc3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: c
compiler: gcc
dist: trusty
sudo: required
matrix:
include:
- os: linux
install:
- sudo apt-get install automake autopoint libxml2-utils perl libxml-perl liblist-moreutils-perl fftw3-dev
script:
- autoreconf -i
- ./configure
- make
- make install prefix=$HOME/dist
- cd $HOME/dist/lib/ladspa/ && echo -e "Found $(ls *.so |wc -l) files\n-------" && ls *.so
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ AM_PROG_CC_C_O
AC_REQUIRE_CPP
ALL_LINGUAS="en_GB"
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.3])
AM_GNU_GETTEXT_VERSION([0.18.3])
AC_C_BIGENDIAN

LIBS="$LIBS -lm"
Expand Down
8 changes: 4 additions & 4 deletions makestub.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w

use List::Util qw(any);
use List::MoreUtils qw(any);
use XML::Parser;

$xml_line = 1;
Expand Down Expand Up @@ -68,7 +68,7 @@
print <<EOB;
\#include <stdlib.h>
\#include <string.h>
\#ifndef WIN32
\#ifndef _WIN32
\#include "config.h"
\#endif
Expand All @@ -85,7 +85,7 @@
\#include "ladspa.h"
\#ifdef WIN32
\#ifdef _WIN32
\#define _WINDOWS_DLL_EXPORT_ __declspec(dllexport)
int bIsFirstTime = 1;
static void __attribute__((constructor)) swh_init(); // forward declaration
Expand Down Expand Up @@ -123,7 +123,7 @@
_WINDOWS_DLL_EXPORT_
const LADSPA_Descriptor *ladspa_descriptor(unsigned long index) {
\#ifdef WIN32
\#ifdef _WIN32
if (bIsFirstTime) {
swh_init();
bIsFirstTime = 0;
Expand Down
21 changes: 17 additions & 4 deletions util/blo.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
#include <math.h>
#include <fcntl.h>
#include <sys/types.h>
#ifndef _WIN32
#include <sys/mman.h>
#endif

#include "blo.h"

Expand All @@ -42,10 +44,13 @@ blo_h_tables *blo_h_tables_new(int table_size)
float table_size_f = table_size;
float max;
unsigned int table_count = 0;
unsigned int i, h;
int i;
unsigned int h;
size_t all_tables_size = sizeof(float) * (table_size + BLO_TABLE_WR)
* (BLO_N_HARMONICS - 1) * 2;
#ifndef _WIN32
int shm_fd;
#endif
char shm_path[128];

this = malloc(sizeof(blo_h_tables));
Expand All @@ -56,6 +61,7 @@ blo_h_tables *blo_h_tables_new(int table_size)

snprintf(shm_path, 128, "/blo-1-%dx%dx%d.tbl", BLO_N_WAVES,
BLO_N_HARMONICS, table_size + BLO_TABLE_WR);
#ifndef _WIN32
if ((shm_fd = shm_open(shm_path, O_RDONLY, 0)) > 0) {
/* There is an existing SHM segment that matches what we want */

Expand Down Expand Up @@ -119,12 +125,15 @@ blo_h_tables *blo_h_tables_new(int table_size)
return this;
} else if ((shm_fd = shm_open(shm_path, O_CREAT | O_RDWR, 0644)) > 0) {
/* There is no existing SHM segment, but we can make one */
ftruncate(shm_fd, all_tables_size);
int err = ftruncate(shm_fd, all_tables_size);

all_tables = mmap(0, all_tables_size, PROT_READ | PROT_WRITE,
MAP_SHARED, shm_fd, 0);
if (!err) {
all_tables = mmap(0, all_tables_size, PROT_READ | PROT_WRITE,
MAP_SHARED, shm_fd, 0);
}
close(shm_fd);
}
#endif

/* Fallback case, can't map a SHM segment, just malloc it and suffer */
if (!all_tables) {
Expand Down Expand Up @@ -224,15 +233,19 @@ blo_h_tables *blo_h_tables_new(int table_size)
}
}

#ifndef _WIN32
msync(all_tables, all_tables_size, MS_ASYNC);
#endif

return this;
}

void blo_h_tables_free(blo_h_tables *tables)
{
if (tables->store_type == BLO_MMAP) {
#ifndef _WIN32
munmap(tables->alloc_space, tables->alloc_size);
#endif
} else {
free(tables->alloc_space);
}
Expand Down

0 comments on commit 6d15dc3

Please sign in to comment.