3 * Copyright 2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio.
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)
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.
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.
23 #ifndef INCLUDED_AUDIO_OSX_SINK_H
24 #define INCLUDED_AUDIO_OSX_SINK_H
26 #include <gr_sync_block.h>
29 #include <AudioUnit/AudioUnit.h>
30 #include <circular_buffer.h>
33 typedef boost::shared_ptr<audio_osx_sink> audio_osx_sink_sptr;
36 audio_osx_make_sink (int sample_rate = 44100,
37 const std::string device_name = "2",
38 bool do_block = false,
39 int channel_config = -1,
40 int max_sample_count = -1);
43 * \brief audio sink using OSX
45 * input signature is one or two streams of floats.
46 * Input samples must be in the range [-1,1].
49 class audio_osx_sink : public gr_sync_block {
50 friend audio_osx_sink_sptr
51 audio_osx_make_sink (int sample_rate,
52 const std::string device_name,
55 int max_sample_count);
57 Float64 d_sample_rate;
60 UInt32 d_queueSampleCount, d_max_sample_count;
62 mld_mutex_ptr d_internal;
63 mld_condition_ptr d_cond_data;
64 circular_buffer<float>** d_buffers;
66 // AudioUnits and Such
70 audio_osx_sink (int sample_rate = 44100,
71 const std::string device_name = "2",
73 int channel_config = -1,
74 int max_sample_count = -1);
83 int work (int noutput_items,
84 gr_vector_const_void_star &input_items,
85 gr_vector_void_star &output_items);
88 static OSStatus AUOutputCallback (void *inRefCon,
89 AudioUnitRenderActionFlags *ioActionFlags,
90 const AudioTimeStamp *inTimeStamp,
92 UInt32 inNumberFrames,
93 AudioBufferList *ioData);
96 #endif /* INCLUDED_AUDIO_OSX_SINK_H */