$OpenBSD: patch-src_fluid_oss_c,v 1.3 2008/12/26 08:45:12 jakemsr Exp $ --- src/fluid_oss.c.orig Tue Sep 18 23:10:57 2007 +++ src/fluid_oss.c Sat Dec 20 17:57:57 2008 @@ -34,6 +34,9 @@ #include #include + +#endif /*#if OSS_SUPPORT */ + #include #include #include @@ -49,6 +52,8 @@ #define OSS_PCM_SCHED_PRIORITY 90 #define OSS_MIDI_SCHED_PRIORITY 90 +#if OSS_SUPPORT + /** fluid_oss_audio_driver_t * * This structure should not be accessed directly. Use audio port @@ -82,6 +87,7 @@ static int fluid_oss_get_sample_formats(fluid_oss_audi static void* fluid_oss_audio_run(void* d); static void* fluid_oss_audio_run2(void* d); +#endif /*#if OSS_SUPPORT */ typedef struct { fluid_midi_driver_t driver; @@ -99,6 +105,7 @@ int delete_fluid_oss_midi_driver(fluid_midi_driver_t* int fluid_oss_midi_driver_status(fluid_midi_driver_t* p); static void* fluid_oss_midi_run(void* d); +#if OSS_SUPPORT void fluid_oss_audio_driver_settings(fluid_settings_t* settings) @@ -639,10 +646,11 @@ fluid_oss_audio_run2(void* d) return 0; /* not reached */ } +#endif /*#if OSS_SUPPORT */ void fluid_oss_midi_driver_settings(fluid_settings_t* settings) { - fluid_settings_register_str(settings, "midi.oss.device", "/dev/midi", 0, NULL, NULL); + fluid_settings_register_str(settings, "midi.oss.device", DEVOSSMIDI, 0, NULL, NULL); } /* @@ -655,8 +663,10 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, int err; fluid_oss_midi_driver_t* dev; pthread_attr_t attr; +#if !defined(__OpenBSD__) int sched = SCHED_FIFO; struct sched_param priority; +#endif char* device; /* not much use doing anything */ @@ -687,7 +697,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, /* get the device name. if none is specified, use the default device. */ fluid_settings_getstr(settings, "midi.oss.device", &device); if (device == NULL) { - device = "/dev/midi"; + device = DEVOSSMIDI; } /* open the default hardware device. only use midi in. */ @@ -704,6 +714,14 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, FLUID_LOG(FLUID_ERR, "Couldn't initialize midi thread attributes"); goto error_recovery; } + +#if defined(__OpenBSD__) + err = pthread_create(&dev->thread, &attr, fluid_oss_midi_run, (void*) dev); + if (err) { + FLUID_LOG(FLUID_ERR, "Couldn't create midi thread"); + goto error_recovery; + } +#else /* use fifo scheduling. if it fails, use default scheduling. */ while (1) { err = pthread_attr_setschedpolicy(&attr, sched); @@ -735,6 +753,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings, } break; } +#endif /* __OpenBSD__ */ return (fluid_midi_driver_t*) dev; error_recovery: @@ -833,4 +852,3 @@ fluid_oss_midi_driver_status(fluid_midi_driver_t* p) return dev->status; } -#endif /*#if OSS_SUPPORT */