freebsd-ports/comms/fldigi/files/patch-src_soundcard_sound.cxx
Diane Bruce ff35d1f90e - Update to fldigi 4.1.00
- Restore OSS and pulseaudio options
- Fix OSS bug in upstream code causing OSS to fail.

=Version 4.1.0=

2019-01-29  David Freese  <w1hkj@bellsouth.net>

	39a76e8: po update
	79c67d3: WWV doc
	04e53b5: Winkeyer FSK
	b8ca88e: Contests
	b197c75: arq-override
	8572f35: flmsg-dir
	02c66eb: contest-docs
	9d85169: fldigi_def.xml
	20e2c02: socket_mods
	e1c2d80: Fltk 1.4 mod
	5ffd6f5: wefax
	fb1fd67: nanoIO
	7d604b8: CW SOM table
	4eec8f2: flrig: macro
	99b0a01: Audio adjust docs
	146bd7e: feldhell
	6b5c93a: C-11 fixes
	ccbd52f: nano FSK
	ed6a7db: Mint-19/Mate
	e9c0f2d: Signal Browser documentation
	fbb0654: flrig seg fault
2019-01-31 02:04:30 +00:00

44 lines
1.2 KiB
C++

--- src/soundcard/sound.cxx.orig 2018-12-06 14:41:46 UTC
+++ src/soundcard/sound.cxx
@@ -651,7 +651,27 @@ int SoundOSS::Open(int md, int freq)
oflags = oflags | O_CLOEXEC;
# endif
+#ifdef __FreeBSD__
+/*
+ * In FreeBSD sound devices e.g. /dev/dsp0.0 can only be open once
+ * whereas /dev/dsp0 can be open multiple times. fldigi tries
+ * to open /dev/dsp0.0 multiple times which fails. Also see man 4 sound.
+ * "For specific sound card access, please instead use /dev/dsp or /dev/dsp%d"
+ * This is a hack. XXX - db VA3DB
+ */
+ char *fixed_name;
+ char *p;
+ /* Look for a '.' if found, blow it away */
+ fixed_name = strdup(device.c_str());
+ p = fixed_name;
+ while (*p++)
+ if(*p == '.')
+ *p = '\0';
+ device_fd = fl_open(fixed_name, oflags, 0);
+ free(fixed_name);
+#else
device_fd = fl_open(device.c_str(), oflags, 0);
+#endif
if (device_fd == -1)
throw SndException(errno);
@@ -677,12 +697,11 @@ void SoundOSS::Close(unsigned dir)
void SoundOSS::getVersion()
{
version = 0;
-#ifndef __FreeBSD__
+
if (ioctl(device_fd, OSS_GETVERSION, &version) == -1) {
version = -1;
throw SndException("OSS Version");
}
-#endif
}
void SoundOSS::getCapabilities()