9front - general discussion about 9front
 help / color / mirror / Atom feed
* [drawterm] Pulse audio support for Linux
@ 2019-11-05 20:07 Jacob Moody
  2020-09-22 11:34 ` [9front] " hiro
  0 siblings, 1 reply; 6+ messages in thread
From: Jacob Moody @ 2019-11-05 20:07 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

Hello all,

I've got a quick patch to add pulse audio support in for drawterm.
This allows for drawterm to show up as an application in pulse. I've
attached the diff file.


Thanks,

-- 
Jacob Moody

[-- Attachment #2: pulse.diff --]
[-- Type: text/x-patch, Size: 1819 bytes --]

diff -r a57ed3e919ca Make.pulse
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Make.pulse	Tue Nov 05 14:02:59 2019 -0600
@@ -0,0 +1,21 @@
+# Linux with pulse audio
+PTHREAD=-pthread
+AR=ar
+AS=as
+RANLIB=ranlib
+X11=/usr/X11R6
+CC=gcc
+CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
+O=o
+OS=posix
+GUI=x11
+LDADD=-L$(X11)/lib64 -L$(X11)/lib -lX11 -ggdb -lpulse-simple
+LDFLAGS=$(PTHREAD)
+TARG=drawterm
+AUDIO=pulse
+
+all: default
+
+libmachdep.a:
+	arch=`uname -m|sed 's/i.86/386/;s/Power Macintosh/power/; s/x86_64/amd64/; s/armv[567].*/arm/'`; \
+	(cd posix-$$arch &&  make)
diff -r a57ed3e919ca kern/devaudio-pulse.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kern/devaudio-pulse.c	Tue Nov 05 14:02:59 2019 -0600
@@ -0,0 +1,64 @@
+/*
+ * Linux pulse audio support
+ */
+#include <pulse/simple.h>
+
+#include	"u.h"
+#include	"lib.h"
+#include	"dat.h"
+#include	"fns.h"
+#include	"error.h"
+#include	"devaudio.h"
+
+
+pa_simple *s = nil;
+static const pa_sample_spec ss = {
+	.format = PA_SAMPLE_S16LE,
+	.rate = 44100,
+	.channels = 2
+};
+
+/* maybe this should return -1 instead of sysfatal */
+void
+audiodevopen(void)
+{
+	int err;
+	if (!(s = pa_simple_new(NULL, "drawterm", PA_STREAM_PLAYBACK, NULL, "playback", &ss, NULL, NULL, &err)))
+		oserror();
+}
+
+void
+audiodevclose(void)
+{
+	if(s)
+		pa_simple_free(s);
+}
+
+int
+audiodevread(void *a, int n)
+{
+	error("no read support");
+	return -1;
+}
+
+int
+audiodevwrite(void *a, int n)
+{
+	int err;
+	if(pa_simple_write(s, a, n, &err) < 0)
+		oserror();
+	return n;
+}
+
+void
+audiodevsetvol(int what, int left, int right)
+{
+	error("no volume support");
+}
+
+void
+audiodevgetvol(int what, int *left, int *right)
+{
+	error("no volume support");
+}
+

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [drawterm] Pulse audio support for Linux
  2019-11-05 20:07 [drawterm] Pulse audio support for Linux Jacob Moody
@ 2020-09-22 11:34 ` hiro
  2020-09-22 17:53   ` Jacob Moody
  0 siblings, 1 reply; 6+ messages in thread
From: hiro @ 2020-09-22 11:34 UTC (permalink / raw)
  To: 9front

i finally wasted some time on ubuntu:

aoss always worked
modern distros nowadays also ship with osspd, a userland oss
implementation with alsa and even pulseaudio backends.

as drawterm is a portable software that is supposed to run on multiple
unixes i see no benefit in cluttering our stuff with pulseaudio when
there are more portable interfaces like oss and sndio that work
flawlessly on most distributions.

On 11/5/19, Jacob Moody <jsmoody@iastate.edu> wrote:
> Hello all,
>
> I've got a quick patch to add pulse audio support in for drawterm.
> This allows for drawterm to show up as an application in pulse. I've
> attached the diff file.
>
>
> Thanks,
>
> --
> Jacob Moody
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [drawterm] Pulse audio support for Linux
  2020-09-22 11:34 ` [9front] " hiro
@ 2020-09-22 17:53   ` Jacob Moody
  2020-09-22 17:56     ` Kurt H Maier
  0 siblings, 1 reply; 6+ messages in thread
From: Jacob Moody @ 2020-09-22 17:53 UTC (permalink / raw)
  To: 9front

You're right, I admit that at the time of writing this patch I had 
little understanding of all the different UNIX sound systems.

After learning more I don't think this should be merged and I apologize 
for putting it forward.


Thanks,
Moody

On 9/22/20 6:34 AM, hiro wrote:
> i finally wasted some time on ubuntu:
> 
> aoss always worked
> modern distros nowadays also ship with osspd, a userland oss
> implementation with alsa and even pulseaudio backends.
> 
> as drawterm is a portable software that is supposed to run on multiple
> unixes i see no benefit in cluttering our stuff with pulseaudio when
> there are more portable interfaces like oss and sndio that work
> flawlessly on most distributions.
> 
> On 11/5/19, Jacob Moody <jsmoody@iastate.edu> wrote:
>> Hello all,
>>
>> I've got a quick patch to add pulse audio support in for drawterm.
>> This allows for drawterm to show up as an application in pulse. I've
>> attached the diff file.
>>
>>
>> Thanks,
>>
>> --
>> Jacob Moody
>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [drawterm] Pulse audio support for Linux
  2020-09-22 17:53   ` Jacob Moody
@ 2020-09-22 17:56     ` Kurt H Maier
  2020-09-22 18:17       ` ori
  0 siblings, 1 reply; 6+ messages in thread
From: Kurt H Maier @ 2020-09-22 17:56 UTC (permalink / raw)
  To: 9front

On Tue, Sep 22, 2020 at 12:53:47PM -0500, Jacob Moody wrote:
> You're right, I admit that at the time of writing this patch I had 
> little understanding of all the different UNIX sound systems.
> 
> After learning more I don't think this should be merged and I apologize 
> for putting it forward.

Never apologize for sending patches, even ones that don't land.  Thanks
for your help.

khm


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [drawterm] Pulse audio support for Linux
  2020-09-22 17:56     ` Kurt H Maier
@ 2020-09-22 18:17       ` ori
  2020-09-22 19:59         ` hiro
  0 siblings, 1 reply; 6+ messages in thread
From: ori @ 2020-09-22 18:17 UTC (permalink / raw)
  To: khm, 9front

> On Tue, Sep 22, 2020 at 12:53:47PM -0500, Jacob Moody wrote:
>> You're right, I admit that at the time of writing this patch I had 
>> little understanding of all the different UNIX sound systems.
>> 
>> After learning more I don't think this should be merged and I apologize 
>> for putting it forward.
> 
> Never apologize for sending patches, even ones that don't land.  Thanks
> for your help.

Agreed. Trying things is the best way to learn.

Also, I noticed how long ago this got posted -- please, ping if
you don't get a response.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9front] [drawterm] Pulse audio support for Linux
  2020-09-22 18:17       ` ori
@ 2020-09-22 19:59         ` hiro
  0 siblings, 0 replies; 6+ messages in thread
From: hiro @ 2020-09-22 19:59 UTC (permalink / raw)
  To: 9front

i felt like this one was in my (granted, small) competency area so i
took it onto my (long) todo list.

took a bit longer bec. i had no ubuntu at hand for verifying the
current state of linux audio.

it's purely incidental that we now all agree this patch is not the way to go. :D

please send some emoji to other threads we forgot, we need that social
touch sometimes.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-22 19:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 20:07 [drawterm] Pulse audio support for Linux Jacob Moody
2020-09-22 11:34 ` [9front] " hiro
2020-09-22 17:53   ` Jacob Moody
2020-09-22 17:56     ` Kurt H Maier
2020-09-22 18:17       ` ori
2020-09-22 19:59         ` hiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).