summaryrefslogtreecommitdiff
path: root/test/blocks.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-03-10 22:56:56 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-03-10 22:56:56 +0000
commitd0c53ccedf030d96b809e1bd391acbf8486f9a3c (patch)
tree10cad24a91e7ed2aea8a9a43a4ee43729ca38893 /test/blocks.cxx
parent5c0f4f62f122a63554c1bb4e76bcb24b0123e755 (diff)
Removed remaining 'deprecated function' warnings for Xcode
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7241 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/blocks.cxx')
-rw-r--r--test/blocks.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/blocks.cxx b/test/blocks.cxx
index d221bed7d..8dcd71645 100644
--- a/test/blocks.cxx
+++ b/test/blocks.cxx
@@ -148,6 +148,9 @@ class BlockSound {
// Private, OS-specific data...
#ifdef __APPLE__
AudioDeviceID device;
+# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ AudioDeviceIOProcID audio_proc_id;
+# endif
AudioStreamBasicDescription format;
short *data;
int remaining;
@@ -216,11 +219,14 @@ BlockSound::BlockSound() {
// Check we got linear pcm - what to do if we did not ???
if (format.mFormatID != kAudioFormatLinearPCM) return;
- // Attach the callback
+ // Attach the callback and start the device
+# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ if (AudioDeviceCreateIOProcID(device, audio_cb, (void *)this, &audio_proc_id) != noErr) return;
+ AudioDeviceStart(device, audio_proc_id);
+# else
if (AudioDeviceAddIOProc(device, audio_cb, (void *)this) != noErr) return;
-
- // Start the device...
AudioDeviceStart(device, audio_cb);
+# endif
sample_size = (int)format.mSampleRate;
@@ -312,8 +318,13 @@ BlockSound::BlockSound() {
BlockSound::~BlockSound() {
#ifdef __APPLE__
if (sample_size) {
+# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ AudioDeviceStop(device, audio_proc_id);
+ AudioDeviceDestroyIOProcID(device, audio_proc_id);
+# else
AudioDeviceStop(device, audio_cb);
AudioDeviceRemoveIOProc(device, audio_cb);
+# endif
}
#elif defined(WIN32)