Topic: Teeworlds oss linux
ive findout howto make teeworlds running at linux using oss
here is patch - working as good as with alsa
diff -Naur --strip default.bam default.bam
--- default.bam 2008-08-31 15:30:59.000000000 +0200
+++ default.bam 2008-09-25 20:23:35.797531399 +0200
@@ -226,9 +226,9 @@
pa_platform = "unix"
if platform == "linux" then
- pa_hostapi = "alsa"
- else
pa_hostapi = "oss"
+ else
+ pa_hostapi = "alsa"
end
settings.linker.libs:add("pthread")
diff -Naur --strip src/engine/external/portaudio/src/hostapi/oss/pa_unix_oss.c src/engine/external/portaudio/src/hostapi/oss/pa_unix_oss.c
--- src/engine/external/portaudio/src/hostapi/oss/pa_unix_oss.c 2008-08-31 15:30:58.000000000 +0200
+++ src/engine/external/portaudio/src/hostapi/oss/pa_unix_oss.c 2008-09-25 20:24:13.941521555 +0200
@@ -62,23 +62,9 @@
#include <sys/poll.h>
#include <limits.h>
#include <semaphore.h>
+#include <linux/soundcard.h>
+#define DEVICE_NAME_BASE "/dev/dsp"
-#ifdef HAVE_SYS_SOUNDCARD_H
-# include <sys/soundcard.h>
-# ifdef __NetBSD__
-# define DEVICE_NAME_BASE "/dev/audio"
-# else
-# define DEVICE_NAME_BASE "/dev/dsp"
-# endif
-#elif defined(HAVE_LINUX_SOUNDCARD_H)
-# include <linux/soundcard.h>
-# define DEVICE_NAME_BASE "/dev/dsp"
-#elif defined(HAVE_MACHINE_SOUNDCARD_H)
-# include <machine/soundcard.h> /* JH20010905 */
-# define DEVICE_NAME_BASE "/dev/audio"
-#else
-# error No sound card header file
-#endif
#include "portaudio.h"
#include "pa_util.h"
diff -Naur --strip src/engine/external/portaudio/src/hostapi/oss/recplay.c src/engine/external/portaudio/src/hostapi/oss/recplay.c
--- src/engine/external/portaudio/src/hostapi/oss/recplay.c 2008-08-31 15:30:58.000000000 +0200
+++ src/engine/external/portaudio/src/hostapi/oss/recplay.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,114 +0,0 @@
-/*
- * recplay.c
- * Phil Burk
- * Minimal record and playback test.
- *
- */
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#ifndef __STDC__
-/* #include <getopt.h> */
-#endif /* __STDC__ */
-#include <fcntl.h>
-#ifdef __STDC__
-#include <string.h>
-#else /* __STDC__ */
-#include <strings.h>
-#endif /* __STDC__ */
-#include <sys/soundcard.h>
-
-#define NUM_BYTES (64*1024)
-#define BLOCK_SIZE (4*1024)
-
-#define AUDIO "/dev/dsp"
-
-char buffer[NUM_BYTES];
-
-int audioDev = 0;
-
-main (int argc, char *argv[])
-{
- int numLeft;
- char *ptr;
- int num;
- int samplesize;
-
- /********** RECORD ********************/
- /* Open audio device. */
- audioDev = open (AUDIO, O_RDONLY, 0);
- if (audioDev == -1)
- {
- perror (AUDIO);
- exit (-1);
- }
-
- /* Set to 16 bit samples. */
- samplesize = 16;
- ioctl(audioDev, SNDCTL_DSP_SAMPLESIZE, &samplesize);
- if (samplesize != 16)
- {
- perror("Unable to set the sample size.");
- exit(-1);
- }
-
- /* Record in blocks */
- printf("Begin recording.\n");
- numLeft = NUM_BYTES;
- ptr = buffer;
- while( numLeft >= BLOCK_SIZE )
- {
- if ( (num = read (audioDev, ptr, BLOCK_SIZE)) < 0 )
- {
- perror (AUDIO);
- exit (-1);
- }
- else
- {
- printf("Read %d bytes\n", num);
- ptr += num;
- numLeft -= num;
- }
- }
-
- close( audioDev );
-
- /********** PLAYBACK ********************/
- /* Open audio device for writing. */
- audioDev = open (AUDIO, O_WRONLY, 0);
- if (audioDev == -1)
- {
- perror (AUDIO);
- exit (-1);
- }
-
- /* Set to 16 bit samples. */
- samplesize = 16;
- ioctl(audioDev, SNDCTL_DSP_SAMPLESIZE, &samplesize);
- if (samplesize != 16)
- {
- perror("Unable to set the sample size.");
- exit(-1);
- }
-
- /* Play in blocks */
- printf("Begin playing.\n");
- numLeft = NUM_BYTES;
- ptr = buffer;
- while( numLeft >= BLOCK_SIZE )
- {
- if ( (num = write (audioDev, ptr, BLOCK_SIZE)) < 0 )
- {
- perror (AUDIO);
- exit (-1);
- }
- else
- {
- printf("Wrote %d bytes\n", num);
- ptr += num;
- numLeft -= num;
- }
- }
-
- close( audioDev );
-}