Skip to content

Commit 8058998

Browse files
committed
Address deprecated call warnings in CoreAudio driver
Signed-off-by: Claudio Matsuoka <[email protected]>
1 parent 2bb8e71 commit 8058998

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

Changelog

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Stable versions
22
---------------
33

4+
4.0.10 ():
5+
- Update deprecated calls in CoreAudio driver
6+
47
4.0.9 (20140926):
58
- Add option '-p' to set the default pan amplitude
69
- Add parameter 'default_pan' to configuration file

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ amigaos*|aros)
137137
AM_CONDITIONAL([SOUND_AHI], [true])
138138
;;
139139
darwin*)
140-
AC_CHECK_HEADER(CoreAudio/CoreAudio.h)
140+
AC_CHECK_HEADERS(AudioUnit/AudioComponent.h CoreAudio/CoreAudio.h)
141141
if test "${ac_cv_header_CoreAudio_CoreAudio_h}" = "yes"; then
142142
AC_DEFINE(SOUND_COREAUDIO)
143143
AM_CONDITIONAL([SOUND_COREAUDIO], [true])

src/sound_coreaudio.c

+13-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515

1616
static AudioUnit au;
1717

18+
#ifndef HAVE_AUDIOUNIT_AUDIOCOMPONENT_H
19+
#define AudioComponent Component
20+
#define AudioComponentDescription ComponentDescription
21+
#define AudioComponentFindNext FindNextComponent
22+
#define AudioComponentInstanceNew OpenAComponent
23+
#define AudioComponentInstanceDispose CloseComponent
24+
#endif
25+
1826
/*
1927
* CoreAudio helpers by Timothy J. Wood from mplayer/libao
2028
* The player fills a ring buffer, OSX retrieves data from the buffer
@@ -121,8 +129,8 @@ OSStatus render_proc(void *inRefCon,
121129
static int init(struct options *options)
122130
{
123131
AudioStreamBasicDescription ad;
124-
Component comp;
125-
ComponentDescription cd;
132+
AudioComponent comp;
133+
AudioComponentDescription cd;
126134
AURenderCallbackStruct rc;
127135
OSStatus err;
128136
UInt32 size, max_frames;
@@ -160,12 +168,12 @@ static int init(struct options *options)
160168
cd.componentFlags = 0;
161169
cd.componentFlagsMask = 0;
162170

163-
if ((comp = FindNextComponent(NULL, &cd)) == NULL) {
171+
if ((comp = AudioComponentFindNext(NULL, &cd)) == NULL) {
164172
fprintf(stderr, "error: FindNextComponent\n");
165173
return -1;
166174
}
167175

168-
if ((err = OpenAComponent(comp, &au))) {
176+
if ((err = AudioComponentInstanceNew(comp, &au))) {
169177
fprintf(stderr, "error: OpenAComponent (%d)\n", (int)err);
170178
return -1;
171179
}
@@ -250,7 +258,7 @@ static void deinit(void)
250258
{
251259
AudioOutputUnitStop(au);
252260
AudioUnitUninitialize(au);
253-
CloseComponent(au);
261+
AudioComponentInstanceDispose(au);
254262
free(buffer);
255263
}
256264

0 commit comments

Comments
 (0)