aboutsummaryrefslogtreecommitdiff
path: root/sndfiler/src/sndfiler.h
blob: f5fbd2cee58afd9906726553a93208a18c36a538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 *
 * threaded soundfiler for pd
 * Copyright (C) 2005, Tim Blechmann
 *           (C) 2005, Georg Holzmann <grh@mur.at>
 *
 * This program 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 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef _SND_FILER__
#define _SND_FILER__


/* to be compatible with main pd */
#ifdef USE_PD_MAIN

#define  getalignedbytes(a)     getbytes(a)
#define  freealignedbytes(a,b)  freebytes(a,b)
#include "threadlib.h"

#else /* now for pd_devel */

#include "m_pd.h"
#include "m_fifo.h"

#include "pthread.h"

#endif /* USE_PD_MAIN */


#include "g_canvas.h"
#include "sndfile.h"
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"

#include "stdlib.h"
#include <stdio.h>
#include "sched.h" /* for thread priority */
#include <string.h>
#include "semaphore.h"

#ifdef MSW
#include <io.h>
#include <fcntl.h>
#endif

/* for alloca */
#ifdef MSW
#include <malloc.h>
#else
#include "alloca.h"
#endif

#if (_POSIX_MEMLOCK - 0) >=  200112L
#include <sys/mman.h>
#endif /* _POSIX_MEMLOCK */

#ifdef __APPLE__
#include <mach/mach.h>
#include <mach/task.h>
#include <mach/semaphore.h>
#define SEM_T semaphore_t
#define SEM_INIT(s) (semaphore_create(mach_task_self(),&s,SYNC_POLICY_FIFO,0) == 0)
#define SEM_SIGNAL(s) semaphore_signal(s)
#define SEM_WAIT(s) semaphore_wait(s)
#else
#define SEM_T sem_t
#define SEM_INIT(s) (sem_init(&s,0,0) == 0)
#define SEM_SIGNAL(s) sem_post(&s)
#define SEM_WAIT(s) sem_wait(&s)
#endif


#endif // _SND_FILER__