Tag: c

Get image pixels using mask

So i have some original image. I need to get and display some part of this image using specific mask. Mask is not a rectangle or a shape. It contains different polygons and shapes. Are there any methods or tutorials how to implement that? Or from where to start to make this? Shall i write […]

CoreMIDI: rock solid midi sync

I’m having troubles with midi synchronization. Following posts in the syntheticbits.com, I use a PGMidi class. Sync works, but is constantly shifting to 1-2 bpm. Here is the code that I use: – (void)sendMidiClockInMidiThread { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [lock lock]; const int64_t kOneMillion = 1000 * 1000; const UInt8 tick[] = { […]

function that returns value from dlsym()?

Stupid question that I’m sure is some bit of syntax that’s not right. How do I get dlsym to work with a function that returns a value? I’m getting the error ‘invalid conversion of void* to LSError (*)()’ in the following code – trying to get the compile the linux lightscribe sample program hoping that […]

Another Speed Boost Possible?

Thanks to the respondents on this question (This loop is very slow, I think because I create a lot of intermediate strings. How can I speed it up?) I was able to speed up my code many orders of magnitude. I think I can probably do a bit better though. Is it possible to avoid […]

Measure time between library call and callback

Hi: In an iPhone application I use a library(C++) which asynchronously makes a callback when computation is finished. Now I want to measure the time which is spent -including the method which calls the library- until the callback is made. Are there any possibilities to do this with the Instruments application from Apple? What are […]

Confusion with Macro expansion

Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…) What problems might the following macro bring to the application? I wrote a sample application with macro expansion for implementing it in my iOS (Objective C code). It is something like: #define SQUARE(x) ( x * x […]

Objective-c : Accessing variadic arguments in method

Possible Duplicate: How to create variable argument methods in Objective-C Variable number of method parameters in Objective C – Need an example Following is an example of a method having variadic arguments. – (void)numberOfParameters:group,… { NSLog(@”%@”,group); } In above method, I know to access the first one of the variadic arguments. Would you please help […]

A macro highlighted as keyword: pascal

While looking in the sample code for FunkyOverlayWindow, I just found a pretty interesting declaration: pascal OSStatus MyHotKeyHandler( EventHandlerCallRef nextHandler, EventRef theEvent, void *userData ); Here, pascal is highlighted as a keyword (pink in standard Xcode color scheme). But I just found it’s a macro, interestingly enough defined in file CarbonCore/ConditionalMacros.h as: #define pascal So, […]

Objective-C @protocol equivalent in C++

Class A has an instance of class B as a member. Sometimes the instance of class B wants to talk to class A. In Objective-C I can do: // A.h @interface A : NSObject <BDelegate> @property (nonatomic, retain) B *b; @end // A.m – (void) classBsays { } // B.h @protocol BDelegate – (void) classBsays; […]

There is really something like Objective C++?

I’m reading a post about iPhone programming and I’ve noticed that the talk about Objective C++, the code shown in the post looks mainly like Objective-C but there also are several snippets in C++. Is it really possible to program Cocoa from C++?