GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
osx_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006, 2013-2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio.
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_AUDIO_OSX_IMPL_H
24 #define INCLUDED_AUDIO_OSX_IMPL_H
25 
26 #include <gnuradio/audio/api.h>
27 
28 #include <iostream>
29 #include <vector>
30 
31 #include <string.h>
32 
33 #include <AudioToolbox/AudioToolbox.h>
34 #include <AudioUnit/AudioUnit.h>
35 
36 namespace gr {
37 namespace audio {
38 namespace osx {
39 
40 // Check the version of MacOSX being used
41 #ifdef __APPLE_CC__
42 #include <AvailabilityMacros.h>
43 #ifndef MAC_OS_X_VERSION_10_6
44 #define MAC_OS_X_VERSION_10_6 1060
45 #endif
46 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
47 #define GR_USE_OLD_AUDIO_UNIT
48 #endif
49 #endif
50 
51 // helper function to print an ASBD
52 
53 extern std::ostream& GR_AUDIO_API
54 operator<<
55 (std::ostream& s,
56  const AudioStreamBasicDescription& asbd);
57 
58 // returns the number of channels for the provided AudioDeviceID,
59 // input and/or output depending on if the pointer is valid.
60 
61 extern void GR_AUDIO_API
63 (AudioDeviceID ad_id,
64  UInt32* n_input,
65  UInt32* n_output);
66 
67 // search all known audio devices, input or output, for all that
68 // match the provided device_name string (in part or in whole).
69 // Returns a vector of all matching IDs, and another of all
70 // matching names. If the device name is empty, then match all
71 // input or output devices.
72 
73 extern void GR_AUDIO_API
75 (const std::string& device_name,
76  bool is_input,
77  std::vector < AudioDeviceID >* all_ad_ids,
78  std::vector < std::string >* all_names);
79 
80 } /* namespace osx */
81 } /* namespace audio */
82 } /* namespace gr */
83 
84 #endif /* INCLUDED_AUDIO_OSX_IMPL_H */
#define GR_AUDIO_API
Definition: gr-audio/include/gnuradio/audio/api.h:30
void GR_AUDIO_API get_num_channels_for_audio_device_id(AudioDeviceID ad_id, UInt32 *n_input, UInt32 *n_output)
Include this header to use the message passing features.
Definition: logger.h:131
void GR_AUDIO_API find_audio_devices(const std::string &device_name, bool is_input, std::vector< AudioDeviceID > *all_ad_ids, std::vector< std::string > *all_names)