1 $NetBSD: patch-aa,v 1.2 2007/12/16 15:18:29 adam Exp $
3 --- src/fluid_oss.c.orig 2007-09-19 08:10:57.000000000 +0200
10 +#define DEVOSSMIDI "/dev/rmidi0"
12 +#define DEVOSSMIDI "/dev/midi"
15 #define BUFFER_LENGTH 512
17 /* SCHED_FIFO priorities for OSS threads (see pthread_attr_setschedparam) */
18 @@ -103,7 +109,7 @@ static void* fluid_oss_midi_run(void* d)
20 fluid_oss_audio_driver_settings(fluid_settings_t* settings)
22 - fluid_settings_register_str(settings, "audio.oss.device", "/dev/dsp", 0, NULL, NULL);
23 + fluid_settings_register_str(settings, "audio.oss.device", DEVOSSAUDIO, 0, NULL, NULL);
27 @@ -122,8 +128,10 @@ new_fluid_oss_audio_driver(fluid_setting
31 +#if !defined(__NetBSD__)
32 int sched = SCHED_FIFO;
33 struct sched_param priority;
36 dev = FLUID_NEW(fluid_oss_audio_driver_t);
38 @@ -168,7 +176,7 @@ new_fluid_oss_audio_driver(fluid_setting
41 if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
42 - devname = "/dev/dsp";
43 + devname = DEVOSSAUDIO;
46 if (stat(devname, &devstat) == -1) {
47 @@ -229,6 +237,13 @@ new_fluid_oss_audio_driver(fluid_setting
52 + err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run, (void*) dev);
54 + FLUID_LOG(FLUID_ERR, "Couldn't create audio thread");
55 + goto error_recovery;
58 /* the pthread_create man page explains that
59 pthread_attr_setschedpolicy returns an error if the user is not
60 permitted the set SCHED_FIFO. it seems however that no error is
61 @@ -264,6 +279,7 @@ new_fluid_oss_audio_driver(fluid_setting
65 +#endif /* __NetBSD__ */
67 return (fluid_audio_driver_t*) dev;
69 @@ -285,8 +301,10 @@ new_fluid_oss_audio_driver2(fluid_settin
73 +#if !defined(__NetBSD__)
74 int sched = SCHED_FIFO;
75 struct sched_param priority;
78 dev = FLUID_NEW(fluid_oss_audio_driver_t);
80 @@ -311,7 +329,7 @@ new_fluid_oss_audio_driver2(fluid_settin
83 if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
84 - devname = "/dev/dsp";
85 + devname = DEVOSSAUDIO;
87 if (stat(devname, &devstat) == -1) {
88 FLUID_LOG(FLUID_ERR, "Device <%s> does not exists", devname);
89 @@ -380,6 +398,13 @@ new_fluid_oss_audio_driver2(fluid_settin
94 + err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run2, (void*) dev);
96 + FLUID_LOG(FLUID_ERR, "Couldn't create audio2 thread");
97 + goto error_recovery;
100 /* the pthread_create man page explains that
101 pthread_attr_setschedpolicy returns an error if the user is not
102 permitted the set SCHED_FIFO. it seems however that no error is
103 @@ -415,6 +440,7 @@ new_fluid_oss_audio_driver2(fluid_settin
107 +#endif /* __NetBSD__ */
109 return (fluid_audio_driver_t*) dev;
111 @@ -642,7 +668,7 @@ fluid_oss_audio_run2(void* d)
113 void fluid_oss_midi_driver_settings(fluid_settings_t* settings)
115 - fluid_settings_register_str(settings, "midi.oss.device", "/dev/midi", 0, NULL, NULL);
116 + fluid_settings_register_str(settings, "midi.oss.device", DEVOSSMIDI, 0, NULL, NULL);
120 @@ -655,8 +681,10 @@ new_fluid_oss_midi_driver(fluid_settings
122 fluid_oss_midi_driver_t* dev;
124 +#if !defined __NetBSD__
125 int sched = SCHED_FIFO;
126 struct sched_param priority;
130 /* not much use doing anything */
131 @@ -687,7 +715,7 @@ new_fluid_oss_midi_driver(fluid_settings
132 /* get the device name. if none is specified, use the default device. */
133 fluid_settings_getstr(settings, "midi.oss.device", &device);
134 if (device == NULL) {
135 - device = "/dev/midi";
136 + device = DEVOSSMIDI;
139 /* open the default hardware device. only use midi in. */
140 @@ -704,6 +732,14 @@ new_fluid_oss_midi_driver(fluid_settings
141 FLUID_LOG(FLUID_ERR, "Couldn't initialize midi thread attributes");
146 + err = pthread_create(&dev->thread, &attr, fluid_oss_midi_run, (void*) dev);
148 + FLUID_LOG(FLUID_ERR, "Couldn't create midi thread");
149 + goto error_recovery;
152 /* use fifo scheduling. if it fails, use default scheduling. */
154 err = pthread_attr_setschedpolicy(&attr, sched);
155 @@ -735,6 +771,7 @@ new_fluid_oss_midi_driver(fluid_settings
159 +#endif /* __NetBSD__ */
160 return (fluid_midi_driver_t*) dev;