View | Details | Raw Unified | Return to bug 212838
Collapse All | Expand All

(-)Makefile (-1 / +5 lines)
Lines 13-19 Link Here
13
LICENSE=	LGPL20
13
LICENSE=	LGPL20
14
LICENSE_FILE=	${WRKSRC}/COPYING
14
LICENSE_FILE=	${WRKSRC}/COPYING
15
15
16
OPTIONS_DEFINE=	JACK ALSA DBUS LADSPA LASH PORTAUDIO PULSEAUDIO SNDFILE
16
OPTIONS_DEFINE=	JACK ALSA DBUS LADSPA LASH PORTAUDIO PULSEAUDIO SNDFILE SNDIO
17
OPTIONS_DEFAULT=	JACK
17
OPTIONS_DEFAULT=	JACK
18
18
19
USE_GNOME=	glib20
19
USE_GNOME=	glib20
Lines 49-55 Link Here
49
SNDFILE_LIB_DEPENDS=	libsndfile.so:audio/libsndfile
49
SNDFILE_LIB_DEPENDS=	libsndfile.so:audio/libsndfile
50
SNDFILE_CMAKE_OFF=	-Denable-libsndfile:BOOL=FALSE
50
SNDFILE_CMAKE_OFF=	-Denable-libsndfile:BOOL=FALSE
51
51
52
SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio
53
SNDIO_CMAKE_OFF=	-Denable-sndio:BOOL=FALSE
54
52
post-patch:
55
post-patch:
56
	${CP} ${FILESDIR}/fluid_sndio.c ${WRKSRC}/src/drivers/
53
	@${REINPLACE_CMD} -e \
57
	@${REINPLACE_CMD} -e \
54
		'/Linux/s|^|#| ; \
58
		'/Linux/s|^|#| ; \
55
		 /_init_lib_suffix/s|"64"|""| ; \
59
		 /_init_lib_suffix/s|"64"|""| ; \
(-)files/fluid_sndio.c (+521 lines)
Line 0 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 */
(-)files/patch-CMakeLists.txt (+22 lines)
Line 0 Link Here
1
--- CMakeLists.txt.orig	2012-08-16 04:01:13 UTC
2
+++ CMakeLists.txt
3
@@ -61,6 +61,7 @@ option ( enable-debug "enable debugging 
4
 option ( enable-libsndfile "compile libsndfile support (if it is available)" on )
5
 option ( enable-aufile "compile support for sound file output" 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-jack "compile JACK support (if it is available)" on )
9
 option ( enable-midishare "compile MidiShare support (if it is available)" on )
10
 option ( enable-readline "compile readline lib line editing (if it is available)" on )
11
@@ -313,6 +314,11 @@ else ( enable-pulseaudio )
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 )
(-)files/patch-cmake__admin_report.cmake (+15 lines)
Line 0 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 )
(-)files/patch-src_CMakeLists.txt (+30 lines)
Line 0 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}
(-)files/patch-src_config.cmake (+12 lines)
Line 0 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
 
(-)files/patch-src_drivers_fluid__adriver.c (+54 lines)
Line 0 Link Here
1
$OpenBSD: patch-src_drivers_fluid_adriver_c,v 1.1 2013/03/29 12:37:43 sthen Exp $
2
--- src/drivers/fluid_adriver.c.orig	2012-08-16 04:01:13 UTC
3
+++ src/drivers/fluid_adriver.c
4
@@ -64,6 +64,15 @@ int delete_fluid_oss_audio_driver(fluid_
5
 void fluid_oss_audio_driver_settings(fluid_settings_t* settings);
6
 #endif
7
 
8
+#if SNDIO_SUPPORT
9
+fluid_audio_driver_t* new_fluid_sndio_audio_driver(fluid_settings_t* settings,
10
+						 fluid_synth_t* synth);
11
+fluid_audio_driver_t* new_fluid_sndio_audio_driver2(fluid_settings_t* settings,
12
+						fluid_audio_func_t func, void* data);
13
+int delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p);
14
+void fluid_sndio_audio_driver_settings(fluid_settings_t* settings);
15
+#endif
16
+
17
 #if COREAUDIO_SUPPORT
18
 fluid_audio_driver_t* new_fluid_core_audio_driver(fluid_settings_t* settings,
19
 						  fluid_synth_t* synth);
20
@@ -120,6 +129,13 @@ int delete_fluid_file_audio_driver(fluid
21
 
22
 /* Available audio drivers, listed in order of preference */
23
 fluid_audriver_definition_t fluid_audio_drivers[] = {
24
+#if SNDIO_SUPPORT
25
+  { "sndio",
26
+    new_fluid_sndio_audio_driver,
27
+    new_fluid_sndio_audio_driver2,
28
+    delete_fluid_sndio_audio_driver,
29
+    fluid_sndio_audio_driver_settings },
30
+#endif
31
 #if JACK_SUPPORT
32
   { "jack",
33
     new_fluid_jack_audio_driver,
34
@@ -223,7 +239,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
@@ -257,6 +275,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
(-)files/patch-src_drivers_fluid__mdriver.c (+53 lines)
Line 0 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

Return to bug 212838