aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2018-10-24 18:03:38 +0100
committerAlastair Poole <netstar@gmail.com>2018-10-24 18:03:38 +0100
commit11832c587a4cf48484f9d6eb6f4e48ca2907da86 (patch)
tree4b1e5a9696761715c752d3fbb7efe8199a1988c3
parentui: remove duplicate code. (diff)
downloadevisum-11832c587a4cf48484f9d6eb6f4e48ca2907da86.tar.gz
macos: use newer audio API for 10.11.
-rw-r--r--src/tingle/README3
-rw-r--r--src/tingle/makefile2
-rw-r--r--src/tingle/tingle.c10
3 files changed, 6 insertions, 9 deletions
diff --git a/src/tingle/README b/src/tingle/README
index f32a5f2..0a00a57 100644
--- a/src/tingle/README
+++ b/src/tingle/README
@@ -13,9 +13,6 @@ This can be used with pipes by other processes to
query the hardware. Or just to display a status
line in screen or tmux or some Xorg program.
-If I'd thought more about it I'd have made it modular, so
-apologies for the crust!
-
Install:
make (or gmake)
diff --git a/src/tingle/makefile b/src/tingle/makefile
index ef6f905..8b07bc1 100644
--- a/src/tingle/makefile
+++ b/src/tingle/makefile
@@ -10,7 +10,7 @@ HAVE_ALSA := $(shell if [ $(ALSA_TEST) -eq 0 ]; then echo "true"; else echo "fal
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
- CFLAGS += -framework AudioToolBox
+ CFLAGS += -framework CoreAudio
else ifeq ($(UNAME),Linux)
ifeq ($(HAVE_ALSA),true)
CFLAGS += -lasound -DHAVE_ALSA=1
diff --git a/src/tingle/tingle.c b/src/tingle/tingle.c
index 1fe1603..be1bc00 100644
--- a/src/tingle/tingle.c
+++ b/src/tingle/tingle.c
@@ -182,7 +182,7 @@ Fcontents(const char *path)
int n = 1024;
buf = malloc(n * sizeof(byte) + 1);
- if (!buf) exit(0 << 1);
+ if (!buf) return NULL;
while ((count = (fread(byte, sizeof(byte), 1, f))) > 0)
{
@@ -191,13 +191,13 @@ Fcontents(const char *path)
{
n *= 2;
char *tmp = realloc(buf, n * sizeof(byte) + 1);
- if (!tmp) exit(1 << 1);
+ if (!tmp) return NULL;
buf = tmp;
}
memcpy(&buf[bytes - sizeof(byte)], byte, sizeof(byte));
}
- if (!feof(f)) exit(2 << 1);
+ if (!feof(f)) return NULL;
fclose(f);
buf[bytes] = 0;
@@ -848,14 +848,14 @@ out:
prop.mScope = kAudioObjectPropertyScopeGlobal;
prop.mElement = kAudioObjectPropertyElementMaster;
- if (AudioHardwareServiceGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &id_size, &id))
+ if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &prop, 0, NULL, &id_size, &id))
return (0);
prop.mSelector = kAudioDevicePropertyVolumeScalar;
prop.mScope = kAudioDevicePropertyScopeOutput;
prop.mElement = 0;
- if (AudioHardwareServiceGetPropertyData(id, &prop, 0, NULL, &vol_size, &volume))
+ if (AudioObjectGetPropertyData(id, &prop, 0, NULL, &vol_size, &volume))
return (0);
mixer->volume_left = mixer->volume_right = volume * 100;