Compare commits
2 Commits
f85551ae02
...
main
Author | SHA1 | Date | |
---|---|---|---|
d44af63511 | |||
9aea138a5c |
@ -4,7 +4,7 @@ INSTALLDIR = ~/Library/Application\ Support/com.elgato.StreamDeck/Plugins/com.dl
|
|||||||
#SDPLUGINDIR = "./com.dlprows.macvolumecontrol.sdPlugin"
|
#SDPLUGINDIR = "./com.dlprows.macvolumecontrol.sdPlugin"
|
||||||
|
|
||||||
update:
|
update:
|
||||||
killall Stream\ Deck.app || true
|
killall Stream\ Deck || true
|
||||||
go build -o $(INSTALLDIR) .
|
go build -o $(INSTALLDIR) .
|
||||||
open -a Elgato\ Stream\ Deck
|
open -a Elgato\ Stream\ Deck
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@ package volume
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -x objective-c
|
#cgo CFLAGS: -x objective-c
|
||||||
#cgo LDFLAGS: -framework CoreAudio
|
#cgo LDFLAGS: -framework CoreAudio -framework AudioToolbox
|
||||||
#include <CoreAudio/CoreAudio.h>
|
#include <CoreAudio/CoreAudio.h>
|
||||||
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
@ -42,11 +43,18 @@ func GetDefaultOutputDevice() (AudioObjectID, OSStatus) {
|
|||||||
|
|
||||||
func GetVolume(objectID AudioObjectID) (float32, OSStatus) {
|
func GetVolume(objectID AudioObjectID) (float32, OSStatus) {
|
||||||
|
|
||||||
|
properties := C.AudioObjectPropertyAddress{
|
||||||
|
C.kAudioHardwareServiceDeviceProperty_VirtualMainVolume,
|
||||||
|
C.kAudioDevicePropertyScopeOutput,
|
||||||
|
C.kAudioObjectPropertyElementMain,
|
||||||
|
}
|
||||||
|
/*
|
||||||
properties := C.AudioObjectPropertyAddress{
|
properties := C.AudioObjectPropertyAddress{
|
||||||
C.kAudioDevicePropertyVolumeScalar,
|
C.kAudioDevicePropertyVolumeScalar,
|
||||||
C.kAudioDevicePropertyScopeOutput,
|
C.kAudioDevicePropertyScopeOutput,
|
||||||
0, //main channel
|
0, //main channel
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
var data C.Float32
|
var data C.Float32
|
||||||
dataSize := C.UInt32(unsafe.Sizeof(data))
|
dataSize := C.UInt32(unsafe.Sizeof(data))
|
||||||
@ -65,11 +73,18 @@ func GetVolume(objectID AudioObjectID) (float32, OSStatus) {
|
|||||||
|
|
||||||
func SetVolume(objectID AudioObjectID, volume float32) OSStatus {
|
func SetVolume(objectID AudioObjectID, volume float32) OSStatus {
|
||||||
|
|
||||||
|
properties := C.AudioObjectPropertyAddress{
|
||||||
|
C.kAudioHardwareServiceDeviceProperty_VirtualMainVolume,
|
||||||
|
C.kAudioDevicePropertyScopeOutput,
|
||||||
|
C.kAudioObjectPropertyElementMain,
|
||||||
|
}
|
||||||
|
/*
|
||||||
properties := C.AudioObjectPropertyAddress{
|
properties := C.AudioObjectPropertyAddress{
|
||||||
C.kAudioDevicePropertyVolumeScalar,
|
C.kAudioDevicePropertyVolumeScalar,
|
||||||
C.kAudioDevicePropertyScopeOutput,
|
C.kAudioDevicePropertyScopeOutput,
|
||||||
0, //main channel
|
0, //main channel
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
data := C.Float32(volume)
|
data := C.Float32(volume)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user