GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
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 // Check the version of MacOSX being used
37 #ifdef __APPLE_CC__
38 #include <AvailabilityMacros.h>
39 #ifndef MAC_OS_X_VERSION_10_6
40 #define MAC_OS_X_VERSION_10_6 1060
41 #endif
42 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
43 #define GR_USE_OLD_AUDIO_UNIT
44 #endif
45 #endif
46 
47 // helper function to print an ASBD
48 
49 std::ostream& GR_AUDIO_API operator<<(std::ostream& s,
50  const AudioStreamBasicDescription& asbd);
51 
52 namespace gr {
53 namespace audio {
54 namespace osx {
55 
56 // returns the number of channels for the provided AudioDeviceID,
57 // input and/or output depending on if the pointer is valid.
58 
59 void GR_AUDIO_API get_num_channels_for_audio_device_id(AudioDeviceID ad_id,
60  UInt32* n_input,
61  UInt32* n_output);
62 
63 // search all known audio devices, input or output, for all that
64 // match the provided device_name string (in part or in whole).
65 // Returns a vector of all matching IDs, and another of all
66 // matching names. If the device name is empty, then match all
67 // input or output devices.
68 
69 void GR_AUDIO_API find_audio_devices(const std::string& device_name,
70  bool is_input,
71  std::vector<AudioDeviceID>* all_ad_ids,
72  std::vector<std::string>* all_names);
73 
74 } /* namespace osx */
75 } /* namespace audio */
76 } /* namespace gr */
77 
78 #endif /* INCLUDED_AUDIO_OSX_IMPL_H */
std::ostream &GR_AUDIO_API operator<<(std::ostream &s, const AudioStreamBasicDescription &asbd)
#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)
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
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)