kyleneideck / BackgroundMusic
- понедельник, 18 апреля 2016 г. в 03:11:51
C++
Background Music, an OS X audio utility
Version 0.1.0, first release. Probably very buggy. Pretty much only tested on one system (a MacBook running OS X 10.11 using the built-in audio device).
Requires OS X 10.10+. Might work on 10.9, but I haven't tried it.
Background Music can pause your music player app when other audio starts playing and unpause it afterwards. The idea is that when I'm listening to music and pause it to watch a video or something I always forget to unpause it afterwards. So this keeps me from wearing headphones for hours listening to nothing.
So far iTunes, Spotify, VLC and
VOX are supported, but adding support for a music player should only take a few minutes
(see BGMMusicPlayer.h
). If you don't know how to program, or just don't feel like it, create an issue and I'll try to
add it for you.
Background Music has a volume slider for each app running on the system. I mostly use this to boost quiet apps above their normal maximum volume.
With Background Music running, open QuickTime Player and go File > New Audio Recording...
(or movie/screen). Then
click the arrow next to the record button that looks like ⌄
and select Background Music Device
as the input device.
You should be able to record system audio and a microphone together by creating an aggregate
device that combines your input device (usually Built-in Input) with
Background Music Device. You can create the aggregate device using the Audio MIDI Setup utility from
/Applications/Utilities
.
No binaries yet, but building should take less than a minute. To build and install everything, clone/download the
project and run the build_and_install.sh
script. Unfortunately, it won't build if you don't have Xcode installed
because xcodebuild doesn't work on its own anymore.
The script restarts the system audio process (coreaudiod) at the end of the installation, so you might want to pause any apps playing audio.
Background Music.app
from /Applications
.Background Music Device.driver
from /Library/Audio/Plug-Ins/HAL
.BGMXPCHelper.xpc
from /usr/local/libexec
or possibly /Library/Application Support/Background Music
.Unregister BGMXPCHelper, delete its user and group, and delete its launchd.plist:
sudo launchctl bootout system /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist
sudo rm /Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist
sudo dscl . -delete /Users/_BGMXPCHelper
sudo dscl . -delete /Groups/_BGMXPCHelper
Restart coreaudiod
:
sudo launchctl kill SIGTERM system/com.apple.audio.coreaudiod
Audio MIDI Setup.app
to create a temporary aggregate device, restart any audio apps that
have stopped working or just restart your system.)If Background Music crashes and system audio stops working, open the Sound panel in System Preferences and change your system's default output device to something other than Background Music Device. If it already is, it might help to change the default device and then change it back again. Failing that, you might have to uninstall.
VLC automatically pauses iTunes/Spotify when it starts playing something, but that stops Background Music from
unpausing your music afterwards. To workaround it, open VLC's preferences, click Show All
, go Interface
> Main
interfaces
> macosx
and change Control external music players
to either Do nothing
or Pause and resume
iTunes/Spotify
.
Similarly, Skype pauses iTunes during calls. If you want to disable that, uncheck Pause iTunes during calls
on the
General tab of Skype's preferences.
Plugging in or unplugging headphones when Background Music isn't running can silence system audio. To fix it, go to the Sound section in System Preferences, click the Output tab and change your default output device to something other than Background Music Device.
This happens when OS X remembers that Background Music Device was your default audio device the last time you last used (or didn't use) headphones.
GPLv2 or later