summaryrefslogtreecommitdiff
path: root/audio/sidplay/patches
diff options
context:
space:
mode:
authorfrueauf <frueauf@pkgsrc.org>1999-06-07 08:19:48 +0000
committerfrueauf <frueauf@pkgsrc.org>1999-06-07 08:19:48 +0000
commit557d2a614b3591e9f4ed17b7211a402f743537c8 (patch)
tree385512b2cc5bb4bc23b5ed278208bd25efa8966d /audio/sidplay/patches
parent62a7f6a63ec25f1d81fa24e589f1d1b21e2fb99f (diff)
downloadpkgsrc-557d2a614b3591e9f4ed17b7211a402f743537c8.tar.gz
Add patches from Michael Schwendt <sidplay@geocities.com> to enable
ossaudio. Provided in pr 7693 by Antti Kantee.
Diffstat (limited to 'audio/sidplay/patches')
-rw-r--r--audio/sidplay/patches/patch-ad194
-rw-r--r--audio/sidplay/patches/patch-ae35
-rw-r--r--audio/sidplay/patches/patch-af16
3 files changed, 245 insertions, 0 deletions
diff --git a/audio/sidplay/patches/patch-ad b/audio/sidplay/patches/patch-ad
new file mode 100644
index 00000000000..e508168c78e
--- /dev/null
+++ b/audio/sidplay/patches/patch-ad
@@ -0,0 +1,194 @@
+$NetBSD: patch-ad,v 1.3 1999/06/07 08:19:48 frueauf Exp $
+
+--- console/audio/linux/audiodrv.cpp.orig Sun Mar 7 08:38:58 1999
++++ console/audio/linux/audiodrv.cpp Wed Jun 2 20:06:29 1999
+@@ -1,8 +1,5 @@
+-//
+-// 1997/09/27 21:38:01
+-//
+ // --------------------------------------------------------------------------
+-// ``Open Sound System (OSS)'' / Linux specific audio interface.
++// ``Open Sound System (OSS)'' specific audio driver interface.
+ // --------------------------------------------------------------------------
+
+ #include "audiodrv.h"
+@@ -21,6 +18,7 @@
+ channels = 0;
+ encoding = 0;
+ precision = 0;
++ swapEndian = false;
+ audioHd = (-1);
+ }
+
+@@ -35,7 +33,8 @@
+ {
+ if ((audioHd=open(AUDIODEVICE,O_WRONLY,0)) == (-1))
+ {
+- errorString = "AUDIO: Could not open audio device.";
++ perror(AUDIODEVICE);
++ errorString = "ERROR: Could not open audio device.";
+ return false;
+ }
+
+@@ -47,34 +46,102 @@
+ fragments = inFragments;
+ fragSizeBase = inFragBase;
+
+- // Set sample precision and type of encoding.
+- int dsp_sampleSize;
+- if (precision == SIDEMU_16BIT)
+- dsp_sampleSize = 16;
+- else // if (precision == SIDEMU_8BIT)
+- dsp_sampleSize = 8;
+- if (ioctl(audioHd,SNDCTL_DSP_SAMPLESIZE,&dsp_sampleSize) == (-1))
++ int mask;
++ // Query supported sample formats.
++ if (ioctl(audioHd,SNDCTL_DSP_GETFMTS,&mask) == (-1))
+ {
+- errorString = "AUDIO: Could not set sample size.";
++ perror(AUDIODEVICE);
++ errorString = "AUDIO: Could not get sample formats.";
+ return false;
+ }
+- // Verify and accept the sample precision the driver accepted.
+- if (dsp_sampleSize == 16)
++
++ // Assume CPU and soundcard have same endianess.
++ swapEndian = false;
++
++ int wantedFormat;
++ // Set sample precision and type of encoding.
++ if (precision == SIDEMU_16BIT)
+ {
+- precision = SIDEMU_16BIT;
+- encoding = SIDEMU_SIGNED_PCM;
++#if defined(WORDS_BIGENDIAN)
++ if (mask & AFMT_S16_BE)
++ {
++ wantedFormat = AFMT_S16_BE;
++ encoding = SIDEMU_SIGNED_PCM;
++ }
++ else if (mask & AFMT_U16_BE)
++ {
++ wantedFormat = AFMT_U16_BE;
++ encoding = SIDEMU_UNSIGNED_PCM;
++ }
++ else if (mask & AFMT_S16_LE)
++ {
++ wantedFormat = AFMT_S16_LE;
++ encoding = SIDEMU_SIGNED_PCM;
++ swapEndian = true;
++ }
++ else if (mask & AFMT_U16_LE)
++ {
++ wantedFormat = AFMT_U16_LE;
++ encoding = SIDEMU_UNSIGNED_PCM;
++ swapEndian = true;
++ }
++#else
++ if (mask & AFMT_S16_LE)
++ {
++ wantedFormat = AFMT_S16_LE;
++ encoding = SIDEMU_SIGNED_PCM;
++ }
++ else if (mask & AFMT_U16_LE)
++ {
++ wantedFormat = AFMT_U16_LE;
++ encoding = SIDEMU_UNSIGNED_PCM;
++ }
++ else if (mask & AFMT_S16_BE)
++ {
++ wantedFormat = AFMT_S16_BE;
++ encoding = SIDEMU_SIGNED_PCM;
++ swapEndian = true;
++ }
++ else if (mask & AFMT_U16_BE)
++ {
++ wantedFormat = AFMT_U16_BE;
++ encoding = SIDEMU_UNSIGNED_PCM;
++ swapEndian = true;
++ }
++#endif
++ else // 16-bit not supported
++ {
++ wantedFormat = AFMT_U8;
++ precision = SIDEMU_8BIT;
++ encoding = SIDEMU_UNSIGNED_PCM;
++ }
+ }
+- else if (dsp_sampleSize == 8)
++ else // if (precision == SIDEMU_8BIT)
+ {
++ wantedFormat = AFMT_U8;
+ precision = SIDEMU_8BIT;
+ encoding = SIDEMU_UNSIGNED_PCM;
+ }
+- else
+- {
+- errorString = "AUDIO: Could not set sample size.";
+- return false;
+- }
+
++ if ( !(mask&wantedFormat) )
++ {
++ errorString = "AUDIO: Desired sample encoding not supported.";
++ return false;
++ }
++
++ int format = wantedFormat;
++ if (ioctl(audioHd,SNDCTL_DSP_SETFMT,&format) == (-1))
++ {
++ perror(AUDIODEVICE);
++ errorString = "AUDIO: Could not set sample format.";
++ return false;
++ }
++ if (format != wantedFormat)
++ {
++ errorString = "AUDIO: Audio driver did not accept sample format.";
++ return false;
++ }
++
+ // Set mono/stereo.
+ int dsp_stereo;
+ if (channels == SIDEMU_STEREO)
+@@ -83,6 +150,7 @@
+ dsp_stereo = 0;
+ if (ioctl(audioHd,SNDCTL_DSP_STEREO,&dsp_stereo) == (-1))
+ {
++ perror(AUDIODEVICE);
+ errorString = "AUDIO: Could not set mono/stereo.";
+ return false;
+ }
+@@ -101,6 +169,7 @@
+ int dsp_speed = frequency;
+ if (ioctl(audioHd,SNDCTL_DSP_SPEED,&dsp_speed) == (-1))
+ {
++ perror(AUDIODEVICE);
+ errorString = "AUDIO: Could not set frequency.";
+ return false;
+ }
+@@ -120,6 +189,7 @@
+ audio_buf_info myAudInfo;
+ if (ioctl(audioHd,SNDCTL_DSP_GETOSPACE,&myAudInfo) == (-1))
+ {
++ perror(AUDIODEVICE);
+ errorString = "AUDIO: Could not get audio_buf_info.";
+ return false;
+ }
+@@ -145,6 +215,15 @@
+ {
+ if (audioHd != (-1))
+ {
+- write(audioHd,pBuffer,bufferSize);
++ if (swapEndian)
++ {
++ for (int n=0; n<bufferSize; n+=2)
++ {
++ ubyte tmp = pBuffer[n+0];
++ pBuffer[n+0] = pBuffer[n+1];
++ pBuffer[n+1] = tmp;
++ }
++ }
++ write(audioHd,pBuffer,bufferSize);
+ }
+ }
diff --git a/audio/sidplay/patches/patch-ae b/audio/sidplay/patches/patch-ae
new file mode 100644
index 00000000000..33f0a5fde9c
--- /dev/null
+++ b/audio/sidplay/patches/patch-ae
@@ -0,0 +1,35 @@
+$NetBSD: patch-ae,v 1.3 1999/06/07 08:19:48 frueauf Exp $
+
+--- console/audio/linux/audiodrv.h.orig Sun Mar 7 08:38:58 1999
++++ console/audio/linux/audiodrv.h Wed Jun 2 20:06:29 1999
+@@ -1,14 +1,16 @@
+-//
+-// 1997/09/27 21:38:01
+-//
++// --------------------------------------------------------------------------
++// ``Open Sound System (OSS)'' specific audio driver interface.
++// --------------------------------------------------------------------------
+
+ #ifndef AUDIODRV_H
+ #define AUDIODRV_H
+
+
+-#include <unistd.h>
+-#include <fcntl.h>
+ #include <sys/ioctl.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <unistd.h>
+
+ #include "compconf.h"
+ #include "mytypes.h"
+@@ -107,6 +109,8 @@
+ int encoding;
+ int precision;
+ int channels;
++
++ bool swapEndian;
+ };
+
+
diff --git a/audio/sidplay/patches/patch-af b/audio/sidplay/patches/patch-af
new file mode 100644
index 00000000000..0567301fc29
--- /dev/null
+++ b/audio/sidplay/patches/patch-af
@@ -0,0 +1,16 @@
+$NetBSD: patch-af,v 1.4 1999/06/07 08:19:48 frueauf Exp $
+
+--- console/sidplay.cpp.orig Sat Feb 20 14:54:00 1999
++++ console/sidplay.cpp Wed Jun 2 20:06:29 1999
+@@ -339,7 +339,10 @@
+ // Print the relevant settings.
+ if (verboseOutput)
+ {
+- cout << "Frequency : " << dec << myEmuConfig.frequency << " Hz" << endl;
++ cout << "Frequency : " << dec << myEmuConfig.frequency << " Hz"
++ << " (" << ((myEmuConfig.bitsPerSample==SIDEMU_8BIT) ? "8" : "16")
++ << "-bit " << ((myEmuConfig.channels==SIDEMU_MONO) ? "mono" : "stereo")
++ << ")" << endl;
+ cout << "SID Filter : " << ((myEmuConfig.emulateFilter == true) ? "Yes" : "No") << endl;
+ if (myEmuConfig.memoryMode == MPU_PLAYSID_ENVIRONMENT)
+ {