Using AudioComponentCount in OSX CoreAudio - macos

There were changes between 10.5 and 10.6 in the way AudioUnits are handled. One of them (at least according to Apple's documentation) was the addition of Audio Component Services. Among other places it is documented at:
http://developer.apple.com/library/mac/documentation/AudioUnit/Reference/AudioComponentServicesReference/AudioComponentServicesReference.pdf
I'm putting together some code to handle input and output units, and am having trouble figuring out how to use these calls. As a starting point I put in a call to AudioComponentCount, and the linker can't find it. I've added CoreAudio.Framework and CoreAudioKit.Framework, but that does not help. It is declared in AudioComponent.h.
Any suggestions on how to get this code to link properly?
Thanks for any help you can bring to bear on this!

When I look up AudioComponentCount in Xcode's documentation, it shows me a page entitled "Audio Component Services Reference". When I scroll to the top, it says it's from the AudioUnit framework. So, try linking against that.

Related

Any way to view doc for c API in Xcode?

I suddenly found Xcode have very poo support for view the C API docs.
Suppose if you want to find the definition for fopen, you can't find any meaningful info for this function expected the declare.
So any workaround for this?
Edit according to Mark Szymczyk's suggestion.
My problem is when I Option click the function, it just show this function is declare in stdio.h, no more explanation to this function like other cocoa APIs.
And when I search in the documentation viewer, it shows something like this, this will cost a little time to figure out it.
There is no solution for you with Xcode. Apple's top priority with Xcode is developers of apps on Apple's platforms using Apple's technologies. That priority also applies to documentation. For standard C language APIs, Apple supplies man pages. If that is not good enough, you're out of luck.
A possible solution is to use Dash, a documentation viewer app. If you can find a comprehensive documentation set for the C language APIs, you could import it into Dash and read it from there.

Where is the Swift CocoaTouch documentation?

I imagine the Swift language has gotten the attention of a boatload of iOS programmers - many of whom never wrote a single line of Objective-C in their life.
For example I have dozens of apps on the app store, written in Titanium.
In the Titanium world every property and event available is documented, for example like this for UILabel:
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.Label
Is there an Apple equivalent? I read the Apple iBook on Swift - it discusses the core language, it doesn't list out the methods available in the Cocoa touch framework, and leaves it to the programmer to intuitively guess based on their Objective-C experience.
Is that a fair assessment, that that you have to learn Objective-C first and then use that as a bridge language to Swift - or is Swift intended to be stand-alone? If so, where is the documentation of Cocoa Touch, in swift?
The documentation is included in Xcode6 (or can be downloaded). You can currently access it by going to Window -> Documentation and API Reference. (or by pressing shift, command & 0)
You will then have full access to search and find resources here. You can also option click on something in Xcode to pull up the docs for that specific thing.
As you will see it shows you the declarations for Obj-C and Swift together. This technically isn't Swift documentation (it is the iOS8 library documentation) but it should be similar to what you were looking for.
Note: this post originally included screen shots but I removed them as developers are not supposed to post screen shots of pre-released software.
The Cocoa Touch APIs and frameworks are the same between Swift and Objective-C. There are only minor syntax differences used when you call the APIs. The framework documentation is currently pre-release, so if you aren't a registered developer then you can't see it yet.

Is it possible to view the source of a mac app?

Would be usefull to see how things work but not sure on the legality of it
Most Mac apps are written using Cocoa in Objective-C; which, while it is a compiled language, means that there is a fair bit of information left over that could be used by a decompiler.
I'm not sure if there are a lot of decompilers out there that leverages this information, at least I haven't heard of any.
However, there are also another option; F-Script.
F-Script can be used to attach to an executable and explore its interfaces, while not as good as source, it can give you a pretty clear idea of how the executable is built, and how it operates.
As for the legality issue:
IANAL, but as far as I know, reverse-engineering for the purposes of compatibility is legal in many jurisdictions, and I can't imagine that decompiling an executable to look at its code is illegal, unless the specific EULA specifically prohibits it.
Edit: WRT Steam specifically, it is probably NOT written in Cocoa, but C# with some manner of .NET compatibility layer; and it's probably not a good place to start if you want to learn how to make applications for Mac OS X.
By far, the best Mac OS X disassembler I've used is Hopper available here:
http://www.hopperapp.com/
It will also convert the assembly to C pseudo code as best it can. It will generate code flow diagrams with blue lines (true blue, love it) for true and red for false paths.
It's The Mac OS reverse engineering tool. There are even Youtube videos that will show you how to use it.
If it's an open-source app, yes. Otherwise it's possible through decompilation but the output will be a real pain in the ass to look at. If you just want the protocols and the interfaces of categories and classes, have a look at class-dump.
I'm not aware of a nib decompiler.
Whether decompilation is legal: ask a lawyer. This may (and probably does) differ per jurisdiction.
Is it possible to view the source of a mac app?
Realistically, no. Sure, you might be a able to use a decompiler to get a peek, but the kind of output you'll get won't be easy to read. If you're asking this question, this route probably isn't going to be helpful to you.
Specifically interested in GUI and how the steam app for mac works
It's a good bet that it works about the same way that most other applications work. It might use custom controls to look different from a typical application that mostly uses the standard Cocoa controls. But underneath, just about any GUI application written for MacOS X will use the run loops, responder chain, and view hierarchy that Cocoa provide. The main exceptions would be applications that are built mostly using an alternate framework like OpenGL or WebKit.
Figure out what, specifically, the Steam application does that you'd like to do. Take a look at the tools that Cocoa provides to see if you can figure it out yourself; if not, ask about it here.

Capturing Audio buffer in Cocoa

Hello All
In my application , i need to enable voice communication over IP,i.e. need to capture the Audio buffer and send it over the Internet, through secure socket,
In the Lower layer everything is ready, I need the entry point to start Voice Communication, but not getting any pointer in the Apple documentation, so far i have done following,
1 -- In the Apple documentation going through CoreAudio programming guide, is this right place to start,
2 -- if yes, somewhere it says, i need to download CoreAudio SDK, will it not come along with standard XCOde and Cocoa framework,
Kind Regards
Rohan
1: CoreAudio programming guide is the right place to start.
Also there are very good samples in Mac Dev Center and perhaps some iPhone examples are portable/useful as well (since CoreAudio in the iPhone is basically a sub-set of CoreAudio for the Mac)
2: You don't need to download anything else. If you have Xcode then just add CoreAudio.framework to your project and add #import <CoreAudio/CoreAudio.h>
Nacho4d is right. You don't need to download anything. The CoreAudio.framework is included in XCode.
As for learning how to work with Core-Audio in general Apple's documentation may be painful to use if you are not a seasoned programmer. Only one book has been written on the subject so far: It's called Core Audio (Rough Cuts) and it's written by Kevin Avila and Chris Adamson on Addison-Wesley Professional. It should help you with the basics.

how to detect network event in cocoa osx

Is it possible to make sure my thread reacts on whenever there is network available ? Basically my thread should automatically get event that network is available and perform certain task.
Any help will be appreciated.
Yes you can, use Reachability APIs in SystemConfiguration.framework. See here. A sample code (for iphone) is available here. The parts concerning the reachability APIs should be usable for OS X, too.
To use the APIs, you need to understand an OS X specific concept of "run loops." See here.
I found a way of getting network change event using growl framework.
Added code on top of it to receive network change event.
Growl framework can be found at http://growl.info/documentation/developer/

Resources