# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

github.setup        briankendall proxy-audio-device 1.0.7 v
revision            0
checksums           rmd160  bacfe8ac4cb21dccd3b87dd94d32db956deb0a24 \
                    sha256  5ba226d22388791aff1385d9804167c33704938f02052c640ab0bfbcb2f4189e \
                    size    1741709

categories          audio
maintainers         nomaintainer
license             public-domain

description         A HAL virtual audio driver for macOS that sends all output to another audio device.

long_description    A HAL virtual audio driver for macOS that sends all output to another audio device. \
                    It's main purpose is to make it possible to use macOS's system volume controls such \
                    as the volume menu bar icon or volume keyboard keys to change the volume of external \
                    audio interfaces that don't allow it. It might be useful for something else too.

github.tarball_from archive

xcode.scheme            {Proxy Audio Device Settings}
xcode.configuration     Release
xcode.destroot.settings CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO
xcode.destroot.type     application

# Skip build phase because building is also done in destroot phase
build {}

# Xcode defaults to a derivedDataPath that is not writable
if {[vercmp ${xcodeversion} >= 5.0]} {
    destroot.pre_args-append  -derivedDataPath ./DerivedData
}

# Install audio driver
post-destroot {
    xinstall -d ${destroot}/Library/Audio/Plug-Ins/HAL
    move ${destroot}${applications_dir}/ProxyAudioDevice.driver ${destroot}/Library/Audio/Plug-Ins/HAL
}

# proxy-audio-device violates the mtree layout by placing the driver in
# /Library/Audio/Plug-Ins/HAL
destroot.violate_mtree yes

post-activate {
    system "sudo killall coreaudiod"
}

post-deactivate {
    system "sudo killall coreaudiod"
}
