From: Ulf Carlsson <ulfc@bun.falkenberg.se>
To: Linux SGI <linux@cthulhu.engr.sgi.com>
Subject: mpg123 hack
Date: Mon, 5 Apr 1999 22:33:16 -0400 [thread overview]
Message-ID: <19990405223315.A9898@bun.falkenberg.se> (raw)
Hi,
I know this is silly and you don't care about it, but I've patched mpg123 so
that I can play mp3's without generating wav files in between :-). Maybe you say
that I should fix my poor HAL2 driver instead - I will...
About the noise:
I have done some testing with mpg123. The HAL2 is, to say the least, acting
weird. I found that only every other sample is played, and the other ones are
dumped.
Ok now to the really really weird part: If I play audio on the samples which are
dumped and zeros on the ones which are played I can hear this silly noise in the
speakers. If I do not play anything, zeros in both channels, it's death quiet
(although the DMA is acting and the HAL2 is playing the zeros). If I play zeros
on the dumped channel and audio on the other one I can hear this noise again.
Hum, I have been looking at this noise problem for nearly two days now without
any progress. Testing one thing the other with no effect. Quite boring, I'll
hack something else tomorrow..
- Ulf
diff -ur mpg123-0.59q-orig/Makefile mpg123-0.59q/Makefile
--- mpg123-0.59q-orig/Makefile Tue Jan 26 14:35:18 1999
+++ mpg123-0.59q/Makefile Tue Jan 18 03:26:46 2000
@@ -56,7 +56,7 @@
@echo "make linux-nas Linux, output to Network Audio System"
@echo "make linux-sparc Linux/Sparc"
@echo "make linux-sajber Linux, build binary for Sajber Jukebox frontend"
- @echo "make linux-alsa Linux with ALSA sound driver"
+ @echo "make linux-mips-alsa Linux/MIPS with ALSA sound driver"
@echo ""
@echo "make linux-esd Linux, output to EsounD"
@echo "make linux-alpha-esd Linux/Alpha, output to EsounD"
@@ -148,6 +148,17 @@
CFLAGS='-DI386_ASSEM -DREAL_IS_FLOAT -DPENTIUM_OPT -DLINUX \
-DREAD_MMAP -DALSA \
-Wall \
+ -fomit-frame-pointer -funroll-all-loops \
+ -finline-functions -ffast-math \
+ $(RPM_OPT_FLAGS)' \
+ mpg123-make
+
+linux-mips-alsa:
+ $(MAKE) CC=gcc LDFLAGS= \
+ AUDIO_LIB='-lasound' \
+ OBJECTS='decode.o dct64.o audio_alsa.o' \
+ CFLAGS='-DLINUX -DREAD_MMAP -DSWAP_BYTES -DREAL_IS_FLOAT \
+ -DALSA -Wall -O2 \
-fomit-frame-pointer -funroll-all-loops \
-finline-functions -ffast-math \
$(RPM_OPT_FLAGS)' \
diff -ur mpg123-0.59q-orig/audio_alsa.c mpg123-0.59q/audio_alsa.c
--- mpg123-0.59q-orig/audio_alsa.c Fri Nov 27 11:16:58 1998
+++ mpg123-0.59q/audio_alsa.c Tue Jan 18 03:24:40 2000
@@ -182,8 +182,24 @@
int audio_play_samples(struct audio_info_struct *ai,unsigned char *buf,int len)
{
ssize_t ret;
+#ifdef SWAP_BYTES
+ int samples = len >> 1; /* will only work in 16 bit mode .. */
+ unsigned short *sample = (unsigned short *) buf;
+ static unsigned short *swap_buf = NULL;
+ if (!swap_buf)
+ swap_buf = (unsigned short *) malloc(len);
+
+ while (samples--) {
+ swap_buf[samples] =
+ (((sample[samples] & 0x00ff) << 8) |
+ ((sample[samples] & 0xff00) >> 8));
+ }
+
+ ret=snd_pcm_write(ai->handle, swap_buf, len);
+#else
ret=snd_pcm_write(ai->handle, buf, len);
+#endif
return ret;
}
next reply other threads:[~1999-04-05 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-06 2:33 Ulf Carlsson [this message]
[not found] ` <37096F0C.64AE42F2@foo.tho.org>
1999-04-06 12:28 ` mpg123 hack Ulf Carlsson
1999-04-06 12:47 ` Ulf Carlsson
1999-04-06 12:05 ` Alan Cox
1999-04-06 12:05 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19990405223315.A9898@bun.falkenberg.se \
--to=ulfc@bun.falkenberg.se \
--cc=linux@cthulhu.engr.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.