5.2-CURRENT a prehravani wav souboru

Tomas Pluskal plusik at pohoda.cz
Thu Aug 19 11:48:15 CEST 2004


On Thu, 19 Aug 2004, Divacky Roman wrote:

> tak jsem se na to dival (mimochodem, proc vsichni Cckari pisou jako prasata?
> tihle navic jako tezce lame prasata ;)) a tendle patch by mohl pomoct
> (ale bacha - je to uz po aplikace nejakeho jineho patche takze si s tim budete
> muset pohrat) - pokdu to pofunguje tak nekdo poslete PR... (ja jsem desne linej
> v tomdle vedru) thnx

v tom patchi je neco navic, ale v tehle podobe to funguje a play prehrava 
(staci placnout do /usr/ports/audio/play/files):


--- encode_riff.c	Tue Mar 25 16:25:07 1997
+++ encode_riff.c	Thu Aug 19 11:32:30 2004
@@ -11,7 +11,7 @@
  #include <signal.h>
  #include <err.h>

-#include <machine/soundcard.h>
+#include <sys/soundcard.h>

  #include "play.h"
  #include "encode_riff.h"
@@ -74,7 +74,7 @@
      char *bufp;
      char *device;
      int devfd, filefd;
-    int stat, len, buf_size, format, data_length;
+    int stat, len, buf_size, format = 0, data_length;

      if (!f_hasdsp) {
  	fprintf(stderr, "%s: %s: needs DSP for play\n", myname, audio_file);
@@ -109,7 +109,12 @@
  	warn("%s", device);
  	stat = FAIL; goto failplay0;
      }
+#if YOU_ARE_FUCKING_IDIOT
+    /* this (at least under fbsd) means that you want to set play format
+     * to headerp->sample_size which is a nonsense */
      if (ioctl(devfd, SNDCTL_DSP_SAMPLESIZE, &headerp->sample_size) < 0) {
+#endif
+    if (ioctl(devfd, SNDCTL_DSP_SAMPLESIZE, &format) < 0) {
  	warn("%s", device);
  	stat = FAIL; goto failplay0;
      }
@@ -121,11 +126,6 @@
  	warn("%s", device);
  	stat = FAIL; goto failplay0;
      }
-    /* XXX */
-    if (ioctl(devfd, SNDCTL_DSP_SETFMT, &format) < 0) {
-	warn("%s", device);
-	stat = FAIL; goto failplay0;
-    }
      if (headerp->channels > 1) {
  	int ch = headerp->channels;
  	if (ioctl(devfd, SNDCTL_DSP_STEREO, &ch) < 0) {



Tomas



More information about the Users-l mailing list