9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: clueelf@tonymendoza.us
To: "9fans" <9fans@9fans.net>
Subject: Re: [9fans] macOS drawterm audio
Date: Sat, 11 Apr 2020 22:20:26 -0500	[thread overview]
Message-ID: <20200412032026.614ACC0152@smtp.hushmail.com> (raw)
In-Reply-To: <20200331193229.BB74EC0214@smtp.hushmail.com>

So I got this working.  My work is in a forked repo on github.  I created a new branch named macos-audio

https://github.com/tmendoza/drawterm-macos-audio/tree/macos-audio

As of right now, it builds on my machine just fine:

macOS Mojave
Version 10.14.6

(base) apollo:drawterm-macos-audio tmendoza$ clang -v
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0

Darwin apollo.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Audio playback is done using PortAudio.  Sorry, but I didn't have the desire to dig thru Apple's AUHAL API's.  Nope.  

To build properly, you can use Homebrew to install portaudio.  I am using VSCode for an IDE and it appears to have picked up libs and header
dirs.  Make.osx-cocoa was an easy update.

Note, I am by no means an expert Apple Developer, but it seems to be working pretty well.   Been playing WAV files all weekend.

I have also added volume control thru /dev/volume.  Any 'audio source' commands written to /dev/volume will modify the master volume on the OS.
Apple doesn't seem to have an API for per-application volume control, so whatever you write to /dev/volume (1-100) changes the entire system volume
for the machine.    Also, any changes made to the volume controls using standard OS tools or volume buttons on your laptop will be reflected when reading
/dev/volume.

If anyone tries this out and has issues let me know and I will try and resolve.  This was a weekend hack so your mileage may vary.

I am thinking about creating an official build for macOS.  If anyone is interested let me know and I can make it a priority.

Tony


On 3/31/2020 at 2:34 PM, clueelf@tonymendoza.us wrote:
>
>All,
>
>Wanted to reach out before I started doing any work on this, but 
>does anyone have existing code for a devaudio-macos.c for 
>drawterm? I see win32 and unix have working audio.  
>
>If anyone has something out there they have started that I can 
>use, would be greatly appreciated.   I am willing to take a stab 
>at it, but just wanted to check before I went down this rabbit 
>hole.  If not... I think I can bang it out.  Doesn't seem too 
>difficult. 
>
>I need audio!
>
>Tony
>
>
>------------------------------------------
>9fans: 9fans
>Permalink: 
>https://9fans.topicbox.com/groups/9fans/Tfe03295f479d4dad-
>M6ff0f0be4cf446bf5cd301fb
>Delivery options: 
>https://9fans.topicbox.com/groups/9fans/subscription


      reply	other threads:[~2020-04-12  3:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 19:32 clueelf
2020-04-12  3:20 ` clueelf [this message]

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=20200412032026.614ACC0152@smtp.hushmail.com \
    --to=clueelf@tonymendoza.us \
    --cc=9fans@9fans.net \
    /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 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).