Commit ad624e7e authored by Monty Montgomery's avatar Monty Montgomery

Merge branch 'macosx-fixes' into 'master'

Various macOS fixes

See merge request !1
parents 42ff45b3 0bfab96c
*.d
*.o
postfish-staterc
postfish-wisdomrc
postfish
......@@ -27,6 +27,7 @@
#include "postfish.h"
#include "bessel.h"
#include "compat.h"
typedef struct {
double re, im;
......
/*
*
* postfish
*
* Copyright (C) 2018 Xiph.Org
*
* Postfish 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, or (at your option)
* any later version.
*
* Postfish 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 Postfish; see the file COPYING. If not, write to the
* Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
*/
/* Work around M_PIl only being available in libc */
#ifndef M_PIl
# define M_PIl 3.141592653589793238462643383279502884L
#endif
/* Work-around lack of PATH_MAX */
#ifndef PATH_MAX
# define PATH_MAX 1024
#endif
......@@ -24,7 +24,14 @@
#include "postfish.h"
#include "feedback.h"
static pthread_mutex_t feedback_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static pthread_mutex_t feedback_mutex;
static pthread_mutexattr_t feedback_mutex_attr;
void feedback_init() {
pthread_mutexattr_init(&feedback_mutex_attr);
pthread_mutexattr_settype(&feedback_mutex_attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&feedback_mutex, &feedback_mutex_attr);
}
feedback_generic *feedback_new(feedback_generic_pool *pool,
feedback_generic *(*constructor)(void)){
......
......@@ -31,6 +31,8 @@ typedef struct feedback_generic_pool{
feedback_generic *feedback_pool;
} feedback_generic_pool;
extern void feedback_init();
extern feedback_generic *feedback_new(feedback_generic_pool *pool,
feedback_generic *(*constructor)(void));
extern void feedback_push(feedback_generic_pool *pool,
......
......@@ -28,6 +28,7 @@
#include "freq.h"
#include "lpc.h"
#include "window.h"
#include "compat.h"
extern int input_rate;
extern int input_size;
......
......@@ -36,7 +36,8 @@ int input_rate;
int input_ch;
int input_size;
pthread_mutex_t input_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
pthread_mutex_t input_mutex;
pthread_mutexattr_t input_mutex_attr;
typedef struct {
FILE *f;
......@@ -77,6 +78,12 @@ static feedback_generic_pool feedpool;
static time_linkage out;
void input_init() {
pthread_mutexattr_init(&input_mutex_attr);
pthread_mutexattr_settype(&input_mutex_attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&input_mutex, &input_mutex_attr);
}
void input_Acursor_set(off_t c){
pthread_mutex_lock(&input_mutex);
Acursor=c;
......
......@@ -21,6 +21,8 @@
*
*/
extern void input_init();
extern void input_Acursor_set(off_t c);
extern void input_Bcursor_set(off_t c);
extern off_t input_time_to_cursor(const char *t);
......
......@@ -229,6 +229,11 @@ void sigill_handler(int sig){
int main(int argc, char **argv){
int wisdom=0;
/* Init sub-components */
feedback_init();
window_init();
input_init();
version=strstr(VERSION,"version.h");
if(version){
char *versionend=strchr(version,' ');
......@@ -251,6 +256,7 @@ int main(int argc, char **argv){
its better to ignore other traps in production than to crash the
app. Please inform the FPU of this. */
/*
#ifndef DEBUG
fedisableexcept(FE_INVALID);
fedisableexcept(FE_INEXACT);
......@@ -262,6 +268,7 @@ int main(int argc, char **argv){
feenableexcept(FE_UNDERFLOW);
feenableexcept(FE_OVERFLOW);
#endif
*/
/* Linux Altivec support has a very annoying problem; by default,
math on denormalized floats will simply crash the program. FFTW3
......
......@@ -40,6 +40,7 @@
#include "mute.h"
#include "mix.h"
#include "freeverb.h"
#include "compat.h"
output_settings outset;
......@@ -522,6 +523,21 @@ static void output_probe_monitor_pulse(){
}
}
static void output_probe_monitor_macosx(){
/* does this AO even have macosx output? */
int id = ao_driver_id("macosx");
if(id>=0){
/* test open; format doesn't matter */
ao_sample_format format={16,48000,2,AO_FMT_NATIVE,NULL};
ao_device *test=ao_open_live(id, &format, NULL);
if(test){
add_monitor(NULL,"macosx",id);
ao_close(test);
}
}
}
static int moncomp(const void *a, const void *b){
output_monitor_entry *ma=(output_monitor_entry *)a;
output_monitor_entry *mb=(output_monitor_entry *)b;
......@@ -534,6 +550,8 @@ int output_probe_monitor(void ){
return 0;
}
output_probe_monitor_macosx();
output_probe_monitor_pulse();
{
int n = monitor_entries;
......
......@@ -26,6 +26,7 @@
#include "window.h"
#include "subband.h"
#include "lpc.h"
#include "compat.h"
extern int input_size;
extern int input_rate;
......
......@@ -23,8 +23,10 @@
#include "postfish.h"
#include "window.h"
#include "compat.h"
static pthread_mutex_t window_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static pthread_mutex_t window_mutex;
static pthread_mutexattr_t window_mutex_attr;
static float ***window_func=0; /* sin(), sin()^2, sin(sin()^2),sin(sin^2)^2
1,2,4,8,16,32,64,128,256,512,1024,
......@@ -45,6 +47,12 @@ static int ilog(long x){
return ret;
}
void window_init() {
pthread_mutexattr_init(&window_mutex_attr);
pthread_mutexattr_settype(&window_mutex_attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&window_mutex, &window_mutex_attr);
}
float *window_get(int type,int n){
int bits=ilog(n),i;
if((1<<bits)!=n)return 0;
......
......@@ -21,5 +21,6 @@
*
*/
extern void window_init();
extern float *window_get(int type,int n);
extern void window_apply(float *data, float *window, float scale, int halfn);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment