View | Details | Raw Unified | Return to bug 233448 | Differences between
and this patch

Collapse All | Expand All

(-)audio/fluidsynth/Makefile (-11 / +10 lines)
Lines 2-11 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	fluidsynth
4
PORTNAME=	fluidsynth
5
PORTVERSION=	1.1.11
6
DISTVERSIONPREFIX=	v
5
DISTVERSIONPREFIX=	v
6
DISTVERSION=	2.0.2
7
CATEGORIES=	audio
7
CATEGORIES=	audio
8
8
9
PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${PORTNAME}/commit/
10
PATCHFILES=	4729b0883e4f8b859343cf8ec384f894f24b0735.patch:-p1 # upstreamed SNDIO patch
11
9
MAINTAINER=	multimedia@FreeBSD.org
12
MAINTAINER=	multimedia@FreeBSD.org
10
COMMENT=	Real-time software synthesizer based on the SoundFont 2 specifications
13
COMMENT=	Real-time software synthesizer based on the SoundFont 2 specifications
11
14
Lines 12-25 Link Here
12
LICENSE=	LGPL21
15
LICENSE=	LGPL21
13
LICENSE_FILE=	${WRKSRC}/LICENSE
16
LICENSE_FILE=	${WRKSRC}/LICENSE
14
17
15
GH_ACCOUNT=	FluidSynth
16
17
OPTIONS_DEFINE=	JACK ALSA DBUS LADSPA LASH PORTAUDIO PULSEAUDIO READLINE \
18
OPTIONS_DEFINE=	JACK ALSA DBUS LADSPA LASH PORTAUDIO PULSEAUDIO READLINE \
18
		SNDFILE SNDIO
19
		SNDFILE SNDIO
19
OPTIONS_DEFAULT=	JACK READLINE
20
OPTIONS_DEFAULT=	JACK READLINE
20
21
21
USES=		cmake pkgconfig tar:bzip2
22
USES=		cmake gnome pkgconfig tar:bzip2
22
USE_GITHUB=	yes
23
USE_GITHUB=	yes
24
GH_ACCOUNT=	FluidSynth
23
USE_GNOME=	glib20
25
USE_GNOME=	glib20
24
USE_LDCONFIG=	yes
26
USE_LDCONFIG=	yes
25
CMAKE_ARGS=	-Denable-ladcca:BOOL=FALSE \
27
CMAKE_ARGS=	-Denable-ladcca:BOOL=FALSE \
Lines 58-71 Link Here
58
SNDIO_CMAKE_BOOL=	enable-sndio
60
SNDIO_CMAKE_BOOL=	enable-sndio
59
61
60
post-patch:
62
post-patch:
61
	${CP} ${FILESDIR}/fluid_sndio.c ${WRKSRC}/src/drivers/
63
	@${REINPLACE_CMD} -e ' \
64
		/Linux/s|^|#| ; \
65
		/_init_lib_suffix/s|"64"|""|' \
66
		${WRKSRC}/CMakeLists.txt
62
	@${REINPLACE_CMD} -e \
67
	@${REINPLACE_CMD} -e \
63
		'/Linux/s|^|#| ; \
64
		 /_init_lib_suffix/s|"64"|""| ; \
65
		 /CMAKE_C_FLAGS_RELEASE/s|-O2|| ; \
66
		 s|enable_midishare|enable-midishare| ; \
67
		 s|$${LIB_INSTALL_DIR}$${LIB_SUFFIX}/pkgconfig|$${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|' ${WRKSRC}/CMakeLists.txt
68
	@${REINPLACE_CMD} -e \
69
		's|share/man|man|' ${WRKSRC}/cmake_admin/DefaultDirs.cmake
68
		's|share/man|man|' ${WRKSRC}/cmake_admin/DefaultDirs.cmake
70
69
71
.include <bsd.port.mk>
70
.include <bsd.port.mk>
(-)audio/fluidsynth/distinfo (-3 / +5 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1527888754
1
TIMESTAMP = 1542999861
2
SHA256 (FluidSynth-fluidsynth-v1.1.11_GH0.tar.gz) = da8878ff374d12392eecf87e96bad8711b8e76a154c25a571dd8614d1af80de8
2
SHA256 (FluidSynth-fluidsynth-v2.0.2_GH0.tar.gz) = 3a18eb135920ca141f769dd288eae1b5c751b0162261da8cd6c1fe0cea850ecf
3
SIZE (FluidSynth-fluidsynth-v1.1.11_GH0.tar.gz) = 634566
3
SIZE (FluidSynth-fluidsynth-v2.0.2_GH0.tar.gz) = 1373253
4
SHA256 (4729b0883e4f8b859343cf8ec384f894f24b0735.patch) = a35beb86edebf8c1ffe4c2a698d3eb1e6c0b1a3fc811226d8ee4f69887abc775
5
SIZE (4729b0883e4f8b859343cf8ec384f894f24b0735.patch) = 23131
(-)audio/fluidsynth/files/fluid_sndio.c (-521 lines)
Lines 1-521 Link Here
1
/* sndio backend for FluidSynth - A Software Synthesizer
2
 *
3
 * Copyright (c) 2008 Jacob Meuser <jakemsr@sdf.lonestar.org>
4
 *
5
 * Permission to use, copy, modify, and distribute this software for any
6
 * purpose with or without fee is hereby granted, provided that the above
7
 * copyright notice and this permission notice appear in all copies.
8
 *
9
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
 */
17
18
19
/* fluid_sndio.c
20
 *
21
 * Driver for the sndio audio access library
22
 */
23
24
#include "fluid_synth.h"
25
#include "fluid_adriver.h"
26
#include "fluid_midi.h"
27
#include "fluid_mdriver.h"
28
#include "fluid_settings.h"
29
30
#if SNDIO_SUPPORT
31
32
#include <sndio.h>
33
34
#include <sys/time.h>
35
#include <sys/types.h>
36
#include <pthread.h>
37
#include <unistd.h>
38
39
40
/** fluid_sndio_audio_driver_t
41
 *
42
 * This structure should not be accessed directly. Use audio port
43
 * functions instead.
44
 */
45
typedef struct {
46
  fluid_audio_driver_t driver;
47
  fluid_synth_t* synth;
48
  fluid_audio_callback_t read;
49
  void* buffer;
50
  pthread_t thread;
51
  int cont;
52
  struct sio_hdl *hdl;
53
  struct sio_par par;
54
  int buffer_size;
55
  int buffer_byte_size;
56
  fluid_audio_func_t callback;
57
  void* data;
58
  float* buffers[2];
59
} fluid_sndio_audio_driver_t;
60
61
typedef struct {
62
  fluid_midi_driver_t driver;
63
  struct mio_hdl *hdl;
64
  pthread_t thread;
65
  int status;
66
  fluid_midi_parser_t *parser;
67
} fluid_sndio_midi_driver_t;
68
69
int delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p);
70
71
/* local utilities */
72
static void* fluid_sndio_audio_run(void* d);
73
static void* fluid_sndio_audio_run2(void* d);
74
75
76
void
77
fluid_sndio_audio_driver_settings(fluid_settings_t* settings)
78
{
79
  fluid_settings_register_str(settings, "audio.sndio.device", "default", 0, NULL, NULL);
80
}
81
82
/*
83
 * new_fluid_sndio_audio_driver
84
 */
85
fluid_audio_driver_t*
86
new_fluid_sndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth)
87
{
88
  fluid_sndio_audio_driver_t* dev = NULL;
89
  double sample_rate;
90
  int periods, period_size;
91
  char* devname;
92
  pthread_attr_t attr;
93
  int err;
94
95
  dev = FLUID_NEW(fluid_sndio_audio_driver_t);
96
  if (dev == NULL) {
97
    FLUID_LOG(FLUID_ERR, "Out of memory");
98
    return NULL;
99
  }
100
  FLUID_MEMSET(dev, 0, sizeof(fluid_sndio_audio_driver_t));
101
102
  fluid_settings_getint(settings, "audio.periods", &periods);
103
  fluid_settings_getint(settings, "audio.period-size", &period_size);
104
  fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate);
105
106
  dev->hdl = NULL;
107
  dev->synth = synth;
108
  dev->callback = NULL;
109
  dev->data = NULL;
110
  dev->cont = 1;
111
112
  if (!fluid_settings_getstr(settings, "audio.sndio.device", &devname)) {
113
    devname = NULL;
114
  }
115
116
  dev->hdl = sio_open(devname, SIO_PLAY, 0);
117
  if (dev->hdl == NULL) {
118
    FLUID_LOG(FLUID_ERR, "sndio could not be opened for writing");
119
    goto error_recovery;
120
  }
121
122
  sio_initpar(&dev->par);
123
124
  if (fluid_settings_str_equal(settings, "audio.sample-format", "16bits")) {
125
    dev->par.bits = 16;
126
    dev->par.le = SIO_LE_NATIVE;
127
    dev->read = fluid_synth_write_s16;
128
  } else {
129
    FLUID_LOG(FLUID_ERR, "Unknown sample format");
130
    goto error_recovery;
131
  }
132
133
  dev->par.appbufsz = period_size * periods;
134
  dev->par.round = period_size;
135
136
  dev->par.pchan = 2;
137
  dev->par.rate = sample_rate;
138
139
  if (!sio_setpar(dev->hdl, &dev->par)) {
140
    FLUID_LOG(FLUID_ERR, "Couldn't set sndio audio parameters");
141
    goto error_recovery;
142
  }
143
144
  if (!sio_getpar(dev->hdl, &dev->par)) {
145
    FLUID_LOG(FLUID_ERR, "Couldn't get sndio audio parameters");
146
    goto error_recovery;
147
  } else if (dev->par.pchan != 2 || dev->par.rate != sample_rate ||
148
      dev->par.bits != 16) {
149
    FLUID_LOG(FLUID_ERR, "Couldn't set sndio audio parameters as desired");
150
    goto error_recovery;
151
  }
152
153
  dev->buffer_size = dev->par.round;
154
  dev->buffer_byte_size = dev->par.round * dev->par.bps * dev->par.pchan;
155
156
  dev->buffer = FLUID_MALLOC(dev->buffer_byte_size);
157
  if (dev->buffer == NULL) {
158
    FLUID_LOG(FLUID_ERR, "Out of memory");
159
    goto error_recovery;
160
  }
161
162
  if (!sio_start(dev->hdl)) {
163
    FLUID_LOG(FLUID_ERR, "Couldn't start sndio");
164
    goto error_recovery;
165
  }
166
167
  if (pthread_attr_init(&attr)) {
168
    FLUID_LOG(FLUID_ERR, "Couldn't initialize audio thread attributes");
169
    goto error_recovery;
170
  }
171
172
  err = pthread_create(&dev->thread, &attr, fluid_sndio_audio_run, (void*) dev);
173
  if (err) {
174
    FLUID_LOG(FLUID_ERR, "Couldn't create audio thread");
175
    goto error_recovery;
176
  }
177
178
  return (fluid_audio_driver_t*) dev;
179
180
error_recovery:
181
  delete_fluid_sndio_audio_driver((fluid_audio_driver_t*) dev);
182
  return NULL;
183
}
184
185
fluid_audio_driver_t*
186
new_fluid_sndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, void* data)
187
{
188
  fluid_sndio_audio_driver_t* dev = NULL;
189
  double sample_rate;
190
  int periods, period_size;
191
  char* devname;
192
  pthread_attr_t attr;
193
  int err;
194
195
  dev = FLUID_NEW(fluid_sndio_audio_driver_t);
196
  if (dev == NULL) {
197
    FLUID_LOG(FLUID_ERR, "Out of memory");
198
    return NULL;
199
  }
200
  FLUID_MEMSET(dev, 0, sizeof(fluid_sndio_audio_driver_t));
201
202
  fluid_settings_getint(settings, "audio.periods", &periods);
203
  fluid_settings_getint(settings, "audio.period-size", &period_size);
204
  fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate);
205
206
  dev->hdl = NULL;
207
  dev->synth = NULL;
208
  dev->read = NULL;
209
  dev->callback = func;
210
  dev->data = data;
211
  dev->cont = 1;
212
213
  if (!fluid_settings_getstr(settings, "audio.sndio.device", &devname)) {
214
    devname = NULL;
215
  }
216
217
  dev->hdl = sio_open(devname, SIO_PLAY, 0);
218
  if (dev->hdl == NULL) {
219
    FLUID_LOG(FLUID_ERR, "sndio could not be opened for writing");
220
    goto error_recovery;
221
  }
222
223
  sio_initpar(&dev->par);
224
225
  dev->par.appbufsz = period_size * periods;
226
  dev->par.round = period_size;
227
228
  dev->par.bits = 16;
229
  dev->par.le = SIO_LE_NATIVE;
230
  dev->par.pchan = 2;
231
  dev->par.rate = sample_rate;
232
233
  if (!sio_setpar(dev->hdl, &dev->par)){
234
    FLUID_LOG(FLUID_ERR, "Can't configure sndio parameters");
235
    goto error_recovery;
236
  }
237
238
  if (!sio_getpar(dev->hdl, &dev->par)) {
239
    FLUID_LOG(FLUID_ERR, "Couldn't get sndio audio parameters");
240
    goto error_recovery;
241
  } else if (dev->par.pchan != 2 || dev->par.rate != sample_rate ||
242
      dev->par.bits != 16) {
243
    FLUID_LOG(FLUID_ERR, "Couldn't set sndio audio parameters as desired");
244
    goto error_recovery;
245
  }
246
247
  dev->buffer_size = dev->par.round;
248
  dev->buffer_byte_size = dev->par.round * dev->par.bps * dev->par.pchan;
249
250
  /* allocate the buffers. FIXME!!! don't use interleaved samples */
251
  dev->buffer = FLUID_MALLOC(dev->buffer_byte_size);
252
  if (dev->buffer == NULL) {
253
    FLUID_LOG(FLUID_ERR, "Out of memory");
254
    goto error_recovery;
255
  }
256
  dev->buffers[0] = FLUID_ARRAY(float, dev->buffer_size);
257
  dev->buffers[1] = FLUID_ARRAY(float, dev->buffer_size);
258
  if ((dev->buffer == NULL) || (dev->buffers[0] == NULL) || (dev->buffers[1] == NULL)) {
259
    FLUID_LOG(FLUID_ERR, "Out of memory");
260
    goto error_recovery;
261
  }
262
263
  if (!sio_start(dev->hdl)) {
264
    FLUID_LOG(FLUID_ERR, "Couldn't start sndio");
265
    goto error_recovery;
266
  }
267
268
  if (pthread_attr_init(&attr)) {
269
    FLUID_LOG(FLUID_ERR, "Couldn't initialize audio thread attributes");
270
    goto error_recovery;
271
  }
272
273
  err = pthread_create(&dev->thread, &attr, fluid_sndio_audio_run2, (void*) dev);
274
  if (err) {
275
    FLUID_LOG(FLUID_ERR, "Couldn't create audio2 thread");
276
    goto error_recovery;
277
  }
278
279
  return (fluid_audio_driver_t*) dev;
280
281
error_recovery:
282
  delete_fluid_sndio_audio_driver((fluid_audio_driver_t*) dev);
283
  return NULL;
284
}
285
286
/*
287
 * delete_fluid_sndio_audio_driver
288
 */
289
int
290
delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p)
291
{
292
  fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) p;
293
294
  if (dev == NULL) {
295
    return FLUID_OK;
296
  }
297
  dev->cont = 0;
298
  if (dev->thread) {
299
    if (pthread_join(dev->thread, NULL)) {
300
      FLUID_LOG(FLUID_ERR, "Failed to join the audio thread");
301
      return FLUID_FAILED;
302
    }
303
  }
304
  if (dev->hdl) {
305
    sio_close(dev->hdl);
306
  }
307
  if (dev->buffer != NULL) {
308
    FLUID_FREE(dev->buffer);
309
  }
310
  FLUID_FREE(dev);
311
  return FLUID_OK;
312
}
313
314
/*
315
 * fluid_sndio_audio_run
316
 */
317
void*
318
fluid_sndio_audio_run(void* d)
319
{
320
  fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) d;
321
  fluid_synth_t* synth = dev->synth;
322
  void* buffer = dev->buffer;
323
  int len = dev->buffer_size;
324
325
  /* it's as simple as that: */
326
  while (dev->cont)
327
  {
328
    dev->read (synth, len, buffer, 0, 2, buffer, 1, 2);
329
    sio_write (dev->hdl, buffer, dev->buffer_byte_size);
330
  }
331
332
  FLUID_LOG(FLUID_DBG, "Audio thread finished");
333
334
  pthread_exit(NULL);
335
336
  return 0; /* not reached */
337
}
338
339
340
/*
341
 * fluid_sndio_audio_run
342
 */
343
void*
344
fluid_sndio_audio_run2(void* d)
345
{
346
  fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) d;
347
  short* buffer = (short*) dev->buffer;
348
  float* left = dev->buffers[0];
349
  float* right = dev->buffers[1];
350
  int buffer_size = dev->buffer_size;
351
  int dither_index = 0;
352
353
  FLUID_LOG(FLUID_DBG, "Audio thread running");
354
355
  /* it's as simple as that: */
356
  while (dev->cont)
357
  {
358
    (*dev->callback)(dev->data, buffer_size, 0, NULL, 2, dev->buffers);
359
360
    fluid_synth_dither_s16 (&dither_index, buffer_size, left, right,
361
			    buffer, 0, 2, buffer, 1, 2);
362
363
    sio_write (dev->hdl, buffer, dev->buffer_byte_size);
364
  }
365
366
  FLUID_LOG(FLUID_DBG, "Audio thread finished");
367
368
  pthread_exit(NULL);
369
370
  return 0; /* not reached */
371
}
372
373
void fluid_sndio_midi_driver_settings(fluid_settings_t* settings)
374
{
375
  fluid_settings_register_str(settings, "midi.sndio.device", "default", 0, NULL, NULL);
376
}
377
378
int
379
delete_fluid_sndio_midi_driver(fluid_midi_driver_t *addr)
380
{
381
  int err;
382
  fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
383
384
  if (dev == NULL) {
385
    return FLUID_OK;
386
  }
387
  dev->status = FLUID_MIDI_DONE;
388
389
  /* cancel the thread and wait for it before cleaning up */
390
  if (dev->thread) {
391
    err = pthread_cancel(dev->thread);
392
    if (err) {
393
      FLUID_LOG(FLUID_ERR, "Failed to cancel the midi thread");
394
      return FLUID_FAILED;
395
    }
396
    if (pthread_join(dev->thread, NULL)) {
397
      FLUID_LOG(FLUID_ERR, "Failed to join the midi thread");
398
      return FLUID_FAILED;
399
    }
400
  }
401
  if (dev->hdl != NULL) {
402
    mio_close(dev->hdl);
403
  }
404
  if (dev->parser != NULL) {
405
    delete_fluid_midi_parser(dev->parser);
406
  }
407
  FLUID_FREE(dev);
408
  return FLUID_OK;
409
}
410
411
void *
412
fluid_sndio_midi_run(void *addr)
413
{
414
  int n, i;
415
  fluid_midi_event_t* evt;
416
  fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
417
#define MIDI_BUFLEN (3125 / 10)
418
  unsigned char buffer[MIDI_BUFLEN];
419
420
  /* make sure the other threads can cancel this thread any time */
421
  if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)) {
422
    FLUID_LOG(FLUID_ERR, "Failed to set the cancel state of the midi thread");
423
    pthread_exit(NULL);
424
  }
425
  if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL)) {
426
    FLUID_LOG(FLUID_ERR, "Failed to set the cancel state of the midi thread");
427
    pthread_exit(NULL);
428
  }
429
430
  /* go into a loop until someone tells us to stop */
431
  dev->status = FLUID_MIDI_LISTENING;
432
433
  while (dev->status == FLUID_MIDI_LISTENING) {
434
435
    /* read new data */
436
    n = mio_read(dev->hdl, buffer, MIDI_BUFLEN);
437
    if (n == 0 && mio_eof(dev->hdl)) {
438
      FLUID_LOG(FLUID_ERR, "Failed to read the midi input");
439
      dev->status = FLUID_MIDI_DONE;
440
    }
441
442
    /* let the parser convert the data into events */
443
    for (i = 0; i < n; i++) {
444
      evt = fluid_midi_parser_parse(dev->parser, buffer[i]);
445
      if (evt != NULL) {
446
	/* send the event to the next link in the chain */
447
	(*dev->driver.handler)(dev->driver.data, evt);
448
      }
449
    }
450
  }
451
  pthread_exit(NULL);
452
}
453
454
int
455
fluid_sndio_midi_driver_status(fluid_midi_driver_t *addr)
456
{
457
  fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
458
  return dev->status;
459
}
460
461
462
fluid_midi_driver_t *
463
new_fluid_sndio_midi_driver(fluid_settings_t *settings,
464
			       handle_midi_event_func_t handler, void *data)
465
{
466
  int err;
467
  fluid_sndio_midi_driver_t *dev;
468
  char *device;
469
470
  /* not much use doing anything */
471
  if (handler == NULL) {
472
    FLUID_LOG(FLUID_ERR, "Invalid argument");
473
    return NULL;
474
  }
475
476
  /* allocate the device */
477
  dev = FLUID_NEW(fluid_sndio_midi_driver_t);
478
  if (dev == NULL) {
479
    FLUID_LOG(FLUID_ERR, "Out of memory");
480
    return NULL;
481
  }
482
  FLUID_MEMSET(dev, 0, sizeof(fluid_sndio_midi_driver_t));
483
  dev->hdl = NULL;
484
485
  dev->driver.handler = handler;
486
  dev->driver.data = data;
487
488
  /* allocate one event to store the input data */
489
  dev->parser = new_fluid_midi_parser();
490
  if (dev->parser == NULL) {
491
    FLUID_LOG(FLUID_ERR, "Out of memory");
492
    goto error_recovery;
493
  }
494
495
  /* get the device name. if none is specified, use the default device. */
496
  if (!fluid_settings_getstr(settings, "midi.sndio.device", &device)) {
497
	device = NULL;
498
  }
499
500
  /* open the default hardware device. only use midi in. */
501
  dev->hdl = mio_open(device, MIO_IN, 0);
502
  if (dev->hdl == NULL) {
503
    FLUID_LOG(FLUID_ERR, "Couldn't open sndio midi device");
504
    goto error_recovery;
505
  }
506
507
  dev->status = FLUID_MIDI_READY;
508
509
  err = pthread_create(&dev->thread, NULL, fluid_sndio_midi_run, (void *)dev);
510
  if (err) {
511
    FLUID_LOG(FLUID_PANIC, "Couldn't create the midi thread.");
512
    goto error_recovery;
513
  }
514
  return (fluid_midi_driver_t *) dev;
515
516
 error_recovery:
517
  delete_fluid_sndio_midi_driver((fluid_midi_driver_t *)dev);
518
  return NULL;
519
}
520
521
#endif /*#if SNDIO_SUPPORT */
(-)audio/fluidsynth/files/patch-CMakeLists.txt (-22 lines)
Lines 1-22 Link Here
1
--- CMakeLists.txt.orig	2018-05-06 07:05:11 UTC
2
+++ CMakeLists.txt
3
@@ -68,6 +68,7 @@ option ( enable-midishare "compile MidiS
4
 option ( enable-oss "compile OSS support (if it is available)" on )
5
 option ( enable-pkgconfig "use pkg-config to locate fluidsynth's (mostly optional) dependencies" on )
6
 option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
7
+option ( enable-sndio "compile Sndio support (if it is available)" on )
8
 option ( enable-readline "compile readline lib line editing (if it is available)" on )
9
 
10
 # Platform specific options
11
@@ -358,6 +359,11 @@ else(NOT enable-pkgconfig)
12
     unset_pkg_config ( PULSE )
13
     endif ( enable-pulseaudio )
14
 
15
+    unset ( SNDIO_SUPPORT CACHE )
16
+    if ( enable-sndio )
17
+      set ( SNDIO_SUPPORT 1 )
18
+    endif ( enable-sndio )
19
+
20
     unset ( ALSA_SUPPORT CACHE )
21
     if ( enable-alsa )
22
     pkg_check_modules ( ALSA alsa>=0.9.1 )
(-)audio/fluidsynth/files/patch-cmake__admin_report.cmake (-15 lines)
Lines 1-15 Link Here
1
--- cmake_admin/report.cmake.orig	2012-08-16 04:01:13 UTC
2
+++ cmake_admin/report.cmake
3
@@ -25,6 +25,12 @@ else ( PULSE_SUPPORT ) 
4
   message ( "PulseAudio:            no" )
5
 endif ( PULSE_SUPPORT )
6
 
7
+if ( SNDIO_SUPPORT )
8
+  message ( "Sndio:                 yes" )
9
+else ( SNDIO_SUPPORT )
10
+  message ( "Sndio:                 no" )
11
+endif ( SNDIO_SUPPORT )
12
+
13
 if ( JACK_SUPPORT )
14
   message ( "JACK:                  yes" )
15
 else ( JACK_SUPPORT )
(-)audio/fluidsynth/files/patch-src_CMakeLists.txt (-30 lines)
Lines 1-30 Link Here
1
--- src/CMakeLists.txt.orig	2012-08-16 04:01:13 UTC
2
+++ src/CMakeLists.txt
3
@@ -47,6 +47,11 @@ if ( PULSE_SUPPORT )
4
   include_directories ( ${PULSE_INCLUDEDIR} ${PULSE_INCLUDE_DIRS} )
5
 endif ( PULSE_SUPPORT )
6
 
7
+if ( SNDIO_SUPPORT )
8
+  set ( fluid_sndio_SOURCES drivers/fluid_sndio.c )
9
+  set ( SNDIO_LIBRARIES sndio )
10
+endif ( SNDIO_SUPPORT )
11
+
12
 if ( ALSA_SUPPORT )
13
   set ( fluid_alsa_SOURCES drivers/fluid_alsa.c )
14
   include_directories ( ${ALSA_INCLUDEDIR} ${ALSA_INCLUDE_DIRS} )
15
@@ -244,6 +249,7 @@ add_library ( libfluidsynth
16
     ${fluid_oss_SOURCES}
17
     ${fluid_portaudio_SOURCES}
18
     ${fluid_pulse_SOURCES}
19
+    ${fluid_sndio_SOURCES}
20
     ${fluid_windows_SOURCES}
21
     ${libfluidsynth_SOURCES}
22
     ${public_HEADERS}
23
@@ -286,6 +292,7 @@ target_link_libraries ( libfluidsynth
24
     ${JACK_LIBRARIES}
25
     ${ALSA_LIBRARIES}
26
     ${PULSE_LIBRARIES}
27
+    ${SNDIO_LIBRARIES}
28
     ${PORTAUDIO_LIBRARIES}
29
     ${LIBSNDFILE_LIBRARIES}
30
     ${DBUS_LIBRARIES}
(-)audio/fluidsynth/files/patch-src_bindings_fluid__rtkit.c (-18 / +8 lines)
Lines 1-6 Link Here
1
--- src/bindings/fluid_rtkit.c.orig	2012-08-16 04:01:13 UTC
1
--- src/bindings/fluid_rtkit.c.orig	2018-11-18 14:43:03 UTC
2
+++ src/bindings/fluid_rtkit.c
2
+++ src/bindings/fluid_rtkit.c
3
@@ -34,7 +34,7 @@
3
@@ -32,7 +32,7 @@
4
 #include "fluid_rtkit.h"
4
 #include "fluid_rtkit.h"
5
 
5
 
6
 
6
 
Lines 9-39 Link Here
9
 
9
 
10
 #ifndef _GNU_SOURCE
10
 #ifndef _GNU_SOURCE
11
 #define _GNU_SOURCE
11
 #define _GNU_SOURCE
12
@@ -44,12 +44,27 @@
12
@@ -42,10 +42,17 @@
13
 #include <string.h>
14
 #include <unistd.h>
15
 #include <sys/types.h>
16
+#include <sys/time.h>
17
 #include <sys/syscall.h>
13
 #include <sys/syscall.h>
18
 #include <sys/resource.h>
14
 #include <sys/resource.h>
19
+#include <sys/param.h>
20
 
15
 
21
+#if defined(__FreeBSD__)
16
+#if defined(__FreeBSD__)
22
+#include <pthread_np.h>
17
+#include <pthread_np.h>
23
+#endif
18
+#endif
24
 
19
 
25
 static pid_t _gettid(void) {
20
 static pid_t _gettid(void)
21
 {
26
+#if defined(__FreeBSD__)
22
+#if defined(__FreeBSD__)
27
+#if __FreeBSD__version > 900030
23
+    return pthread_getthreadid_np();
28
+        return pthread_getthreadid_np();
29
+#else
24
+#else
30
+        long tid;
25
     return (pid_t) syscall(SYS_gettid);
31
+        syscall(SYS_thr_self, &tid);
32
+        return tid;	
33
+#endif
26
+#endif
34
+#else
35
         return (pid_t) syscall(SYS_gettid);
36
+#endif
37
 }
27
 }
38
 
28
 
39
 static int translate_error(const char *name) {
29
 static int translate_error(const char *name)
(-)audio/fluidsynth/files/patch-src_config.cmake (-12 lines)
Lines 1-12 Link Here
1
--- src/config.cmake.orig	2012-08-16 04:01:13 UTC
2
+++ src/config.cmake
3
@@ -178,6 +178,9 @@
4
 /* Define to enable PulseAudio driver */
5
 #cmakedefine PULSE_SUPPORT @PULSE_SUPPORT@
6
 
7
+/* Define to enable Sndio driver */
8
+#cmakedefine SNDIO_SUPPORT @SNDIO_SUPPORT@
9
+
10
 /* Define to 1 if you have the ANSI C header files. */
11
 #cmakedefine STDC_HEADERS @STDC_HEADERS@
12
 
(-)audio/fluidsynth/files/patch-src_drivers_fluid__adriver.c (-54 lines)
Lines 1-54 Link Here
1
--- src/drivers/fluid_adriver.c.orig	2018-05-06 07:05:11 UTC
2
+++ src/drivers/fluid_adriver.c
3
@@ -64,6 +64,15 @@ int delete_fluid_oss_audio_driver(fluid_
4
 void fluid_oss_audio_driver_settings(fluid_settings_t* settings);
5
 #endif
6
 
7
+#if SNDIO_SUPPORT
8
+fluid_audio_driver_t* new_fluid_sndio_audio_driver(fluid_settings_t* settings,
9
+						   fluid_synth_t* synth);
10
+fluid_audio_driver_t* new_fluid_sndio_audio_driver2(fluid_settings_t* settings,
11
+						    fluid_audio_func_t func, void* data);
12
+int delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p);
13
+void fluid_sndio_audio_driver_settings(fluid_settings_t* settings);
14
+#endif
15
+
16
 #if COREAUDIO_SUPPORT
17
 fluid_audio_driver_t* new_fluid_core_audio_driver(fluid_settings_t* settings,
18
 						  fluid_synth_t* synth);
19
@@ -122,6 +131,14 @@ int delete_fluid_file_audio_driver(fluid
20
 /* Available audio drivers, listed in order of preference */
21
 static const fluid_audriver_definition_t fluid_audio_drivers[] =
22
 {
23
+#if SNDIO_SUPPORT
24
+    { "sndio",
25
+        new_fluid_sndio_audio_driver,
26
+        new_fluid_sndio_audio_driver2,
27
+        delete_fluid_sndio_audio_driver,
28
+        fluid_sndio_audio_driver_settings },
29
+#endif
30
+
31
 #if JACK_SUPPORT
32
     { "jack",
33
         new_fluid_jack_audio_driver,
34
@@ -238,7 +255,9 @@ void fluid_audio_driver_settings(fluid_s
35
                                FLUID_DEFAULT_AUDIO_RT_PRIO, 0, 99, 0, NULL, NULL);
36
 
37
   /* Set the default driver */
38
-#if JACK_SUPPORT
39
+#if SNDIO_SUPPORT
40
+  fluid_settings_register_str(settings, "audio.driver", "sndio", 0, NULL, NULL);
41
+#elif JACK_SUPPORT
42
   fluid_settings_register_str(settings, "audio.driver", "jack", 0, NULL, NULL);
43
 #elif ALSA_SUPPORT
44
   fluid_settings_register_str(settings, "audio.driver", "alsa", 0, NULL, NULL);
45
@@ -272,6 +291,9 @@ void fluid_audio_driver_settings(fluid_s
46
 #if OSS_SUPPORT
47
   fluid_settings_add_option(settings, "audio.driver", "oss");
48
 #endif
49
+#if SNDIO_SUPPORT
50
+  fluid_settings_add_option(settings, "audio.driver", "sndio");
51
+#endif
52
 #if COREAUDIO_SUPPORT
53
   fluid_settings_add_option(settings, "audio.driver", "coreaudio");
54
 #endif
(-)audio/fluidsynth/files/patch-src_drivers_fluid__mdriver.c (-53 lines)
Lines 1-53 Link Here
1
$OpenBSD: patch-src_drivers_fluid_mdriver_c,v 1.1 2013/03/29 12:37:43 sthen Exp $
2
--- src/drivers/fluid_mdriver.c.orig	2012-08-16 04:01:13 UTC
3
+++ src/drivers/fluid_mdriver.c
4
@@ -46,6 +46,15 @@ fluid_midi_driver_t *new_fluid_jack_midi
5
 int delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
6
 #endif
7
 
8
+/* SNDIO */
9
+#if SNDIO_SUPPORT
10
+fluid_midi_driver_t* new_fluid_sndio_midi_driver(fluid_settings_t* settings,
11
+					     handle_midi_event_func_t handler,
12
+					     void* event_handler_data);
13
+int delete_fluid_sndio_midi_driver(fluid_midi_driver_t* p);
14
+void fluid_sndio_midi_driver_settings(fluid_settings_t* settings);
15
+#endif
16
+
17
 /* OSS */
18
 #if OSS_SUPPORT
19
 fluid_midi_driver_t* new_fluid_oss_midi_driver(fluid_settings_t* settings,
20
@@ -96,6 +105,12 @@ struct fluid_mdriver_definition_t {
21
 
22
 
23
 struct fluid_mdriver_definition_t fluid_midi_drivers[] = {
24
+#if SNDIO_SUPPORT
25
+  { "sndio",
26
+    new_fluid_sndio_midi_driver,
27
+    delete_fluid_sndio_midi_driver,
28
+    fluid_sndio_midi_driver_settings },
29
+#endif
30
 #if JACK_SUPPORT
31
   { "jack",
32
     new_fluid_jack_midi_driver,
33
@@ -149,7 +164,9 @@ void fluid_midi_driver_settings(fluid_se
34
                                FLUID_DEFAULT_MIDI_RT_PRIO, 0, 99, 0, NULL, NULL);
35
 
36
   /* Set the default driver */
37
-#if ALSA_SUPPORT
38
+#if SNDIO_SUPPORT
39
+  fluid_settings_register_str(settings, "midi.driver", "sndio", 0, NULL, NULL);
40
+#elif ALSA_SUPPORT
41
   fluid_settings_register_str(settings, "midi.driver", "alsa_seq", 0, NULL, NULL);
42
 #elif JACK_SUPPORT
43
   fluid_settings_register_str(settings, "midi.driver", "jack", 0, NULL, NULL);
44
@@ -170,6 +187,9 @@ void fluid_midi_driver_settings(fluid_se
45
   fluid_settings_add_option(settings, "midi.driver", "alsa_seq");
46
   fluid_settings_add_option(settings, "midi.driver", "alsa_raw");
47
 #endif
48
+#if SNDIO_SUPPORT
49
+  fluid_settings_add_option(settings, "midi.driver", "sndio");
50
+#endif
51
 #if JACK_SUPPORT
52
   fluid_settings_add_option(settings, "midi.driver", "jack");
53
 #endif
(-)audio/fluidsynth/files/patch-src_drivers_fluid__oss.c (-5 / +5 lines)
Lines 1-4 Link Here
1
--- src/drivers/fluid_oss.c.orig	2018-05-06 07:05:11 UTC
1
--- src/drivers/fluid_oss.c.orig	2018-11-23 17:31:11 UTC
2
+++ src/drivers/fluid_oss.c
2
+++ src/drivers/fluid_oss.c
3
@@ -45,9 +45,9 @@
3
@@ -45,9 +45,9 @@
4
 #define BUFFER_LENGTH 512
4
 #define BUFFER_LENGTH 512
Lines 5-15 Link Here
5
 
5
 
6
 // Build issue on some systems (OSS 4.0)?
6
 // Build issue on some systems (OSS 4.0)?
7
-#if !defined(SOUND_PCM_WRITE_CHANNELS) && defined(SNDCTL_DSP_CHANNELS)
7
-#if !defined(SOUND_PCM_WRITE_CHANNELS) && defined(SNDCTL_DSP_CHANNELS)
8
-  #define SOUND_PCM_WRITE_CHANNELS        SNDCTL_DSP_CHANNELS
8
-#define SOUND_PCM_WRITE_CHANNELS        SNDCTL_DSP_CHANNELS
9
-#endif
9
-#endif
10
+// #if !defined(SOUND_PCM_WRITE_CHANNELS) && defined(SNDCTL_DSP_CHANNELS)
10
+//#if !defined(SOUND_PCM_WRITE_CHANNELS) && defined(SNDCTL_DSP_CHANNELS)
11
+//   #define SOUND_PCM_WRITE_CHANNELS        SNDCTL_DSP_CHANNELS
11
+//#define SOUND_PCM_WRITE_CHANNELS        SNDCTL_DSP_CHANNELS
12
+// #endif
12
+//#endif
13
 
13
 
14
 /** fluid_oss_audio_driver_t
14
 /** fluid_oss_audio_driver_t
15
  *
15
  *
(-)audio/fluidsynth/pkg-plist (-3 / +3 lines)
Lines 3-13 Link Here
3
include/fluidsynth/audio.h
3
include/fluidsynth/audio.h
4
include/fluidsynth/event.h
4
include/fluidsynth/event.h
5
include/fluidsynth/gen.h
5
include/fluidsynth/gen.h
6
include/fluidsynth/ladspa.h
6
include/fluidsynth/log.h
7
include/fluidsynth/log.h
7
include/fluidsynth/midi.h
8
include/fluidsynth/midi.h
8
include/fluidsynth/misc.h
9
include/fluidsynth/misc.h
9
include/fluidsynth/mod.h
10
include/fluidsynth/mod.h
10
include/fluidsynth/ramsfont.h
11
include/fluidsynth/seq.h
11
include/fluidsynth/seq.h
12
include/fluidsynth/seqbind.h
12
include/fluidsynth/seqbind.h
13
include/fluidsynth/settings.h
13
include/fluidsynth/settings.h
Lines 18-24 Link Here
18
include/fluidsynth/version.h
18
include/fluidsynth/version.h
19
include/fluidsynth/voice.h
19
include/fluidsynth/voice.h
20
lib/libfluidsynth.so
20
lib/libfluidsynth.so
21
lib/libfluidsynth.so.1
21
lib/libfluidsynth.so.2
22
lib/libfluidsynth.so.1.7.2
22
lib/libfluidsynth.so.2.0.2
23
libdata/pkgconfig/fluidsynth.pc
23
libdata/pkgconfig/fluidsynth.pc
24
man/man1/fluidsynth.1.gz
24
man/man1/fluidsynth.1.gz

Return to bug 233448