Thanks for the link Rich!<div><br></div><div>I had a look at your code and I could get the tone patch to work with input disabled, but enabling input caused an error:</div><div>







<p><b> *** ERROR *** -[PdAudioUnit initAudioUnitWithSampleRate:numberChannels:inputEnabled:][159] status code =  kAudioUnitErr_InvalidPropertyValue</b></p><p>I think this is due to the fact that with kAudioUnitSubType_HALOutput you need to set up two callbacks for input/output processing:</p>


<p>







</p><p><b>kAudioOutputUnitProperty_SetInputCallback</b> for retrieving the input samples by calling the AudioUnitRender() method, processing the samples and storing them into a ring buffer.</p><p>







</p>







<p><b>kAudioUnitProperty_SetRenderCallback</b> for retrieving the samples stored in the ring buffer to output.</p><p><br></p><p>I have a HAL Output Unit working with AUGraph in a controller class. I&#39;ll try and wrap it up this week and share it.</p>


<p>However for this purpose I didn&#39;t need audio input so I opted for the Default Output unit. As you can see in the link from the previous email this simplifies the code A LOT :) Maybe it&#39;d be useful to have two projects for output only and input/output. With the former being a very quick way for people new to libpd to get a project up and running. </p>


<p>Regarding my issue with libpd not processing audio, as Dan pointed out, it <i>should </i>be working. However, thinking about it more it could be due to how I built the libpd library. I noticed Rich added the whole source code into his project so I&#39;ll try that and see if it makes any difference. Weird!</p>


<p>Thanks for the help guys,</p><p>Joe</p><p>On 7 July 2013 03:02, Rich E <span dir="ltr">&lt;<a href="mailto:reakinator@gmail.com" target="_blank">reakinator@gmail.com</a>&gt;</span> wrote:</p>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I started adding support for using PdAudioUnit in a Cocoa / OS X app (PdAudioController is too iOS-specific) and checked my progress into the cocoa branch here:<div>


<br></div><div><a href="https://github.com/libpd/libpd/tree/cocoa" target="_blank">https://github.com/libpd/libpd/tree/cocoa</a><br>
</div><div><br></div><div>There is a (very basic) working app at:</div><div><br></div><div><a href="https://github.com/libpd/libpd/tree/cocoa/samples/cocoa_samples/CocoaPdBasic" target="_blank">https://github.com/libpd/libpd/tree/cocoa/samples/cocoa_samples/CocoaPdBasic</a><br>



</div><div><br></div><div>You can also find some experimentation I did with moving towards an AUGraph design but, in the end, I found it much more restrictive than just using Audio Units directly.  Apologies for not finding the time to finish this, I&#39;ve been working full-time on a different project for many months now... but hopefully once that is done I will finish off those samples, unless someone else already has.</div>



<div><br></div><div>In essence, there were only a few things that needed to be modified. Off the top of my head, they were:</div><div><br></div><div>- switch the audio unit to kAudioUnitSubType_HALOutput</div>
<div>- enable an input audio device (required on OS X, not on iOS)</div><div>- fix some Obj-C syntax issues that are different on OS X (property synthesis generation I believe)</div><div><br></div><div>
By the way, you can use the C++ wrapper quite readily with any other existing audio framework that provides OS X support - I use it in cinder apps and of course Dan provides ofxPd.  I know others who have used portaudio or FMOD directly.</div>



<div><br></div><div>cheers,</div><div>Rich</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sat, Jul 6, 2013 at 9:04 AM, Dan Wilcox <span dir="ltr">&lt;<a href="mailto:danomatika@gmail.com" target="_blank">danomatika@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="word-wrap:break-word">Sorry. I assumed you were using the existing Obj-C PdAudioUnit and PdAudioController classes included with libpd which were written mainly for iOS. We should get around to tweaking it so it works on OSX. Did you try it?<div>



<br></div><div>In skimming your code, it looks like you&#39;re doing everything the PAudioUnit does, so I don&#39;t see any obvious problems.<div><div><br><div><br><div><div>On Jul 6, 2013, at 8:52 AM, Joe White &lt;<a href="mailto:white.joe4@gmail.com" target="_blank">white.joe4@gmail.com</a>&gt; wrote:</div>



<br><blockquote type="cite">Sorry that previous code had some test stuff in it, here&#39;s a slightly cleaner version (ARC&#39;d)<div><br></div><div><a href="http://pastebin.com/index/1bR2Ftqn" target="_blank">http://pastebin.com/index/1bR2Ftqn</a><br>



<br><div class="gmail_quote">

On 6 July 2013 13:47, Joe White <span dir="ltr">&lt;<a href="mailto:white.joe4@gmail.com" target="_blank">white.joe4@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





How do you mean the CoreAudio backend? I would have thought I should just be able to call the process function in my render callback. Did you check out the code I posted? I happy to provide that as an AudioController for libpd on OSX. Messages and print objects work correctly but libpd is not processing any audio. <div>






<br></div><div><a href="http://pastebin.com/1bR2Ftqn" target="_blank">http://pastebin.com/1bR2Ftqn</a></div><div><br></div><div>Cheers,</div><div>Joe<div><div><br><br><div class="gmail_quote">On 5 July 2013 23:33, Dan Wilcox <span dir="ltr">&lt;<a href="mailto:danomatika@gmail.com" target="_blank">danomatika@gmail.com</a>&gt;</span> wrote:<br>






<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">As far as I know, the OSX port isn&#39;t finished and the CoreAudio backend isn&#39;t hooked up. Anyone wanna help out there or sponsor us? :D<div>






<br><div><div>On Jul 5, 2013, at 7:56 AM, <a href="mailto:pd-list-request@iem.at" target="_blank">pd-list-request@iem.at</a> wrote:</div><br><blockquote type="cite"><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">






<span style="font-family:Helvetica;font-size:medium;color:rgb(127,127,127)"><b>From:<span> </span></b></span><span style="font-family:Helvetica;font-size:medium">Joe White &lt;<a href="mailto:white.joe4@gmail.com" target="_blank">white.joe4@gmail.com</a>&gt;<br>






</span></div><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">






<span style="font-family:Helvetica;font-size:medium;color:rgb(127,127,127)"><b>Subject:<span> </span></b></span><span style="font-family:Helvetica;font-size:medium"><b>[PD] Libpd running in OS X app</b><br></span></div><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">






<span style="font-family:Helvetica;font-size:medium;color:rgb(127,127,127)"><b>Date:<span> </span></b></span><span style="font-family:Helvetica;font-size:medium">July 5, 2013 7:34:47 AM EDT<br></span></div><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">






<span style="font-family:Helvetica;font-size:medium;color:rgb(127,127,127)"><b>To:<span> </span></b></span><span style="font-family:Helvetica;font-size:medium">pd-list &lt;<a href="mailto:pd-list@iem.at" target="_blank">pd-list@iem.at</a>&gt;<br>






</span></div><div><br style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">






<br style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">






<span style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">Hi guys,</span><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">






<br></div><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">






Does anyone have any experience running libpd in an OS X app, using CoreAudio. </div><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">






<br></div><div style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">






I&#39;m able to run a patch and receive print statements but I&#39;m not getting any audio output and DSP doesn&#39;t seem to be processing. I created a quick test tone in code to see if it was my audio unit but that works. My main problem it seems is that after calling <div>






<br></div><p><span>  [</span><span>PdBase</span><span> </span>processFloatWithInputBuffer<span>:leftBuffer<span> </span></span>outputBuffer<span>:leftBuffer<span> </span></span>ticks<span>:ticks];</span></p><p><span>...the buffer is still empty. Anyone have any ideas?</span></p>



<p><span>I&#39;m calling [PdBase computeAudio:] just before I start the AudioUnit. Here&#39;s the whole controller class if that helps:<a href="http://pastebin.com/eYf1Facp" target="_blank">http://pastebin.com/eYf1Facp</a></span></p>



<p><span>Any help would be much appreciated!</span></p><p>Many thanks,</p><p>Joe</p></div></div></blockquote></div><br><div>
<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">






<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">






<div>--------</div><div>Dan Wilcox</div><div>@danomatika</div><div><a href="http://danomatika.com/" target="_blank">danomatika.com</a></div><div><a href="http://robotcowboy.com/" target="_blank">robotcowboy.com</a></div>



<div>


<br></div></div></span><br></div></span><br><br>
</div>
<br></div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><div>-- <br>Follow me on Twitter @diplojocus
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Follow me on Twitter @diplojocus
</div>
</blockquote></div><br><div>
<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">



<span style="border-spacing:0px;text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">



<div>--------</div><div>Dan Wilcox</div><div>@danomatika</div><div><a href="http://danomatika.com" target="_blank">danomatika.com</a></div><div><a href="http://robotcowboy.com" target="_blank">robotcowboy.com</a></div><div>



<br></div></div></span><br></div></span><br><br>
</div>
<br></div></div></div></div></div><br></div></div>_______________________________________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Follow me on Twitter @diplojocus
</div>