AVplayer Audio routing to speakers and headphones - objective-c

i am trying to route the audio to headphone when headphone is plugged in and and play it via iPhone speakers when there is no headphones connected.
i have tried the the following
AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, audioRouteChangeListenerCallback, nil);
void audioRouteChangeListenerCallback (
void *inUserData,
AudioSessionPropertyID inPropertyID,
UInt32 inPropertyValueSize,
const void *inPropertyValue
) {
DetailViewController *controller = (__bridge_transfer DetailViewController *) inUserData;
if (inPropertyID != kAudioSessionProperty_AudioRouteChange) return;
CFDictionaryRef routeChangeDictionary = (CFDictionaryRef)inPropertyValue;
CFNumberRef routeChangeReasonRef = (CFNumberRef)CFDictionaryGetValue (routeChangeDictionary, CFSTR (kAudioSession_AudioRouteChangeKey_Reason) );
SInt32 routeChangeReason;
CFNumberGetValue (routeChangeReasonRef, kCFNumberSInt32Type, &routeChangeReason);
if (routeChangeReason == kAudioSessionRouteChangeReason_OldDeviceUnavailable) {
NSLog(#"UnPlugged");
[controller headphoneIsPlugged];
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute, sizeof (audioRouteOverride),&audioRouteOverride);
} else if (routeChangeReason == kAudioSessionRouteChangeReason_NewDeviceAvailable) {
NSLog(#"Plugged in");
}
}
the function headphone is not being called at all. the program is not even going to that part of the section.
now when i plug out the headphone the audio just stops and nothing its not being played via the speaker.
inside the audiolister i tried to put the following
[controller.avplayer play];
but still nothing is happening.
Please help

You need to pass the instance of DetailViewController when you are adding the listener. This will be passed in as user data. Without this (__bridge_transfer DetailViewController *) inUserData; would return nil.
Your code would be something like this if you call it from within your DetailViewController:
AudioSessionAddPropertyListener (
kAudioSessionProperty_AudioRouteChange,
audioRouteChangeListenerCallback,
(__bridge void *)(self)
);

Related

Setting media playback info in MacOs not working

I'm a newbie in ObjC and MacOs development.
My final goal is understand how setting playback info works from ObjC to try to implement that later on Rust (using generated ObjC runtime bindings).
So right now I'm trying to write small piece of code on ObjC that would set playback info (without actually playing anything).
I have found https://github.com/MarshallOfSound/electron-media-service/blob/master/src/darwin/service.mm and used it as a base.
Here's code I have right now:
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <objc/runtime.h>
#include "MediaPlayer/MPNowPlayingInfoCenter.h"
#include "MediaPlayer/MPRemoteCommandCenter.h"
#include "MediaPlayer/MPRemoteCommand.h"
#include "MediaPlayer/MPMediaItem.h"
#include "MediaPlayer/MPRemoteCommandEvent.h"
#interface NativeMediaController : NSObject { }
#end
#implementation NativeMediaController
- (MPRemoteCommandHandlerStatus)remotePlay {
NSLog(#"Play");
return MPRemoteCommandHandlerStatusSuccess;
}
- (MPRemoteCommandHandlerStatus)remotePause {
NSLog(#"Pause");
return MPRemoteCommandHandlerStatusSuccess;
}
- (MPRemoteCommandHandlerStatus)remoteTogglePlayPause {
NSLog(#"PlayPause");
return MPRemoteCommandHandlerStatusSuccess;
}
- (MPRemoteCommandHandlerStatus)remoteNext {
NSLog(#"Next");
return MPRemoteCommandHandlerStatusSuccess;
}
- (MPRemoteCommandHandlerStatus)remotePrev {
NSLog(#"Previous");
return MPRemoteCommandHandlerStatusSuccess;
}
- (MPRemoteCommandHandlerStatus)remoteChangePlaybackPosition:(MPChangePlaybackPositionCommandEvent*)event {
NSLog(#"ChangePlaybackPosition");
return MPRemoteCommandHandlerStatusSuccess;
}
- (MPRemoteCommandHandlerStatus)move:(MPChangePlaybackPositionCommandEvent*)event {
NSLog(#"Move");
return MPRemoteCommandHandlerStatusSuccess;
}
#end
int main(int argc, const char * argv[]) {
#autoreleasepool {
// insert code here...
NSLog(#"Hello, World!");
NativeMediaController* controller = [[NativeMediaController alloc] init];
MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[remoteCommandCenter playCommand].enabled = true;
[remoteCommandCenter pauseCommand].enabled = true;
[remoteCommandCenter togglePlayPauseCommand].enabled = true;
[remoteCommandCenter changePlaybackPositionCommand].enabled = true;
[remoteCommandCenter nextTrackCommand].enabled = true;
[remoteCommandCenter previousTrackCommand].enabled = true;
[[remoteCommandCenter playCommand] addTarget:controller action:#selector(remotePlay)];
[[remoteCommandCenter pauseCommand] addTarget:controller action:#selector(remotePause)];
[[remoteCommandCenter togglePlayPauseCommand] addTarget:controller action:#selector(remoteTogglePlayPause)];
[[remoteCommandCenter changePlaybackPositionCommand] addTarget:controller action:#selector(remoteChangePlaybackPosition:)];
[[remoteCommandCenter nextTrackCommand] addTarget:controller action:#selector(remoteNext)];
[[remoteCommandCenter previousTrackCommand] addTarget:controller action:#selector(remotePrev)];
NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];
[songInfo setObject:[NSString stringWithUTF8String:"Test title"] forKey:MPMediaItemPropertyTitle];
[songInfo setObject:[NSString stringWithUTF8String:"Test artist"] forKey:MPMediaItemPropertyArtist];
[songInfo setObject:[NSString stringWithUTF8String:"Test albumtitle"] forKey:MPMediaItemPropertyAlbumTitle];
[songInfo setObject:[NSNumber numberWithFloat:60.0] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
[songInfo setObject:[NSNumber numberWithFloat:360.0] forKey:MPMediaItemPropertyPlaybackDuration];
[songInfo setObject:[NSNumber numberWithFloat:112233] forKey:MPMediaItemPropertyPersistentID];
[MPNowPlayingInfoCenter defaultCenter].playbackState = MPNowPlayingPlaybackStatePlaying;
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];
NSLog(#"End!");
char input[50] = {0};
printf("Enter anything to quit: ");
scanf("%s", input);
}
return 0;
}
When this code is executed I see no effect in MacOs playing info widget.
Unfortunately right now I have no idea how to debug this or where can I find better ObjC example.
Finally, I found the reason that caused my problem playing with Apple Swift example.
There're two requirements to show playback widget (i didn't find them documented anywhere) that have been missing:
You should register a callback for at least one action (play, pause)
You should build your application as an App, not as Console. If your program is not shown in the dock as a running app - the playback widget wouldn't work.

Notification when wifi connected (OS X)

I need a notification from the system when airport is connecting to an ap. Is there any possibility to do that with the SystemConfiguration framework? I have problems to understand the systemconfigurations api documentation.
You are on the right track with the SystemConfiguration network, which offers the SCNetworkReachability set of functions. You could try using
SCNetworkReachabilitySetCallback
to set a callback which will be called when the reachability changes; and
SCNetworkReachabilityScheduleWithRunLoop
to schedule the reachability check within the run loop
Or you might try using a reachability framework (both for MacOS and iOS) which is built on top of the SystemConfiguration framework to make things even easier (higher-level).
If you want to go the SystemConfiguration way, this is how you check for present reachability and install the callback to be notified of changes (source):
- (void)checkReachability {
NSString *server = [[NSUserDefaults standardUserDefaults] stringForKey:#"NCIDServer"];
if (server == nil) {
ncid_message_callback(self, [NSLocalizedString(#"No caller ID server was specified.", nil) UTF8String]);
return;
}
const char *serverName = [[[server componentsSeparatedByString:#":"] objectAtIndex:0] UTF8String];
SCNetworkReachabilityContext context = {0, (void *)self, NULL, NULL, NULL};
networkReachability = SCNetworkReachabilityCreateWithName(NULL, serverName);
if (networkReachability == NULL)
goto fail;
// If reachability information is available now, we don't get a callback later
SCNetworkConnectionFlags flags;
if (SCNetworkReachabilityGetFlags(networkReachability, &flags))
networkReachabilityCallback(networkReachability, flags, self);
if (!SCNetworkReachabilitySetCallback(networkReachability, networkReachabilityCallback, &context))
goto fail;
if (!SCNetworkReachabilityScheduleWithRunLoop(networkReachability, [[NSRunLoop currentRunLoop] getCFRunLoop], kCFRunLoopCommonModes))
goto fail;
return;
fail:
if (networkReachability != NULL)
CFRelease(networkReachability);
networkReachability = NULL; //-- ivar representing current reachability
}
And this is a sample of the callback:
static void networkReachabilityCallback(SCNetworkReachabilityRef target,
SCNetworkConnectionFlags flags,
void *object) {
// Observed flags:
// - nearly gone: kSCNetworkFlagsReachable alone (ignored)
// - gone: kSCNetworkFlagsTransientConnection | kSCNetworkFlagsReachable | kSCNetworkFlagsConnectionRequired
// - connected: kSCNetworkFlagsIsDirect | kSCNetworkFlagsReachable
if (networkReachability == NULL)
return;
if ((flags & kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired)) {
if (isReachable) // typically receive a reachable message ~20ms before the unreachable one
return;
isReachable = YES;
ncid_network_kill();
[NSThread detachNewThreadSelector:#selector(runThread:) toTarget:object withObject:nil];
} else {
isReachable = NO;
ncid_network_kill();
}
}
You need to use Apple's Reachability class for this. http://developer.apple.com/library/ios/#samplecode/Reachability/Listings/Classes_Reachability_m.html#//apple_ref/doc/uid/DTS40007324-Classes_Reachability_m-DontLinkElementID_6
You can check this thread for how to use this class-
How do I receive notifications that the connection has changed type (3G, Edge, Wifi, GPRS)

Is possible to play audio from AudioQueue in real time?

I need to get audio from microphone and pass to other device using tcp connection.
I not sure if is possible to play an AudioBuffer from the AudioQueue.
Currently I'm get the buffer with the code below:
void AudioInputCallback(
void *inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp *inStartTime,
UInt32 inNumberPacketDescriptions,
const AudioStreamPacketDescription *inPacketDescs)
{
AudioRecorder *self = (AudioRecorder *)inUserData;
if(!self.recordState.recording)
{
NSLog(#"[ AudioRecorder ] AudioInputCallback not recording");
return;
}
if(inNumberPacketDescriptions > 0)
{
NSData *data = [[NSData alloc] initWithBytes:inBuffer->mAudioData length:inBuffer->mAudioDataByteSize * 2];
[self.delegate didReceivedAudioData:data];
[data release];
}
}
This block just push mAudioData to NSData, the NSData is the key data type to transfer data between devices.
Now I don't know how to run this mAudioData in other device. Other thing is how to get audio continuously, when all buffers are full, I not receive data anymore, just need to clean the buffer I guess.
Any idea are welcome, thanks!

KeyOff without effect

I'm using FMod for first time, and I don't understand why my code doesn't trigger Sound Designer's keyoff.
Working env
iOS
Xcode
Verified
.fev and event's keyoff tested with fmod_eventPlayer
all FOD_RESULT are OK
Here the code processed chronologically
-(void) initFmod
{
...
//init
result = _eventSystem->init(32, FMOD_INIT_NORMAL | FMOD_INIT_ENABLE_PROFILE, NULL, FMOD_EVENT_INIT_NORMAL);
...
//load music bank settings
result = FMOD_OK;
[[NSString stringWithFormat:#"%#/_music.fev", [[NSBundle mainBundle] resourcePath]] getCString:buffer maxLength:200 encoding:NSASCIIStringEncoding];
result = _eventSystem->load(buffer, NULL, NULL);
...
}
-(void) onMusicGameStart
{
///////////// LOAD Game Music ////////////
//Build Event name
FMOD_RESULT result = FMOD_OK;
NSString *musicGameEvent = #"music/music/music_sample_with_keyOff";
const char *eventGame = [musicGameEvent UTF8String];
//Get event from Fmod
result = _eventSystem->getEvent(eventGame, FMOD_EVENT_DEFAULT, &_musicGame);
result = _musicGame->start();
...
}
-(void) stopMusic
{
//Stop current Music
[self triggerEventKeyoff:_musicGame];
}
-(void) triggerEventKeyoff:(FMOD::Event*)event
{
if(event)
{
FMOD_RESULT result = FMOD_OK;
//Get Event's Parameter
FMOD::EventParameter *param;
result = event->getParameterByIndex(0, &param);
//Check error message
[self checkResult:result even:nil];
//trigger KeyOff
if(result == FMOD_OK)
{
result = param->keyOff();
//Check error message
[self checkResult:result even:nil];
}
}
}
The music associated to _musicGame doesn't play its KeyOff and just continue playing.
_musicGame is only set in onMusicGameStart().
I don't know what to test from this point.
By the way, I'm not able to launch fmod_profiler (crash at launch).
Thanks for your replies.
There is a bug with the current fmod_profiler, it's simple to fix though:
Open the terminal and navigate to the location of fmod_profiler.app
Navigate into fmod_profiler.app/Contents/MacOS
Type: "chmod u+x fmod_profiler
Now you can run the app properly from the finder.
Regarding keyoff, I would contact FMOD support.

Trying to send a mouse click to a game window, mac

So I've been trying to use CGPostMouseEvent, and CGEventPostToPSN to send a mouse click to a mac game, and unfortunately have been very unsuccessful.
I was hoping someone may be able to help me think of this differently, or realize what I'm missing. Google hasn't been much help.
My guess is that it's because I'm trying to send a click event to a game window (openGL), vs. a normal window.
Here is another example of what I'm trying to send:
CGEventRef CGEvent;
NSEvent *customEvent;
NSPoint location;
location.x = 746;
location.y = 509;
customEvent = [NSEvent mouseEventWithType: NSLeftMouseDown
location: location
modifierFlags: NSLeftMouseDownMask
timestamp: time(NULL)
windowNumber: windowID
context: NULL
eventNumber: 0
clickCount: 1
pressure: 0];
CGEvent = [customEvent CGEvent];
CGEventPostToPSN(&psn, CGEvent);
Interestingly enough, I can move the mouse fine (CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, clickPt);), I just can't send any clicks :/
Any help would be greatly appreciated.
Edit: Here is what is strange, once I move the mouse using CGDisplayMoveCursorToPoint, I actually have to physically move my mouse up or down a hair before I can even click, which is odd. The game doesn't accept any input unless I move it up/down (and the pointer then changes).
Thanks!
Well what you are try to build is "bot" or "robot" which basically sends commands in an orderly fashion to a game. Basically it will play for you as you are afk. This is great for games that force you to play to harvest minerals, commodities or whatever gives you money to advance in the game. Which is really kind of boring. I have successfully done this for a popular game, although i cannot mention the game as it breaks the user agreements which all these type of games have against "bots". So beware of what you are doing, as it may break your user agreement for many MMPG. But i post this successfully here because, the Mac has less bots available, none that i have been able to research, vs the PC which i have found many. So to level the playing field.. here is the code. I recommend to compile it as command line, and execute the macro in AppleScript (were the logic will reside on how to mimic the games click mouses, movements and send keys, basically your AI.
1.- First you need to run class that will get your psn "process serial number" which all games have. Basically what Thread it is running at. You can find out the name of the process in the utility in the Mac called "Activity Monitor". This can also be done easily in AppleScript.
Once you have the name, this class will locate and give you back its psn.
#import <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>
#include <stdio.h>
#interface gamePSN : NSObject
{
ProcessSerialNumber gamePSN;
ProcessInfoRec gameProcessInfo;
pid_t gameUnixPID;
}
- (ProcessSerialNumber) gamePSN;
- (ProcessInfoRec) gameProcessInfo;
- (pid_t) gameUnixPID;
- (void) getPSN;
#end
#implementation gameSN
- (ProcessSerialNumber) gamePSN { return gamePSN; }
- (ProcessInfoRec) gameProcessInfo { return gameProcessInfo; }
- (pid_t) gameUnixPID; { return gameUnixPID; }
- (void) getPSN
{
auto OSErr osErr = noErr;
auto OSErr otherErr = noErr;
auto ProcessSerialNumber process;
auto ProcessInfoRec procInfo;
auto Str255 procName;
auto FSSpec appFSSpec;
auto char cstrProcName[34];
auto char one ='G'; // FIRST CHARCTER OF GAME PROCESS NAME THESE NEED TO BE CHANGED AS I PUT IN FAKES
auto char two ='A'; // SECOND CHARACTER OF GAME PROCESS NAME THESE NEED TO BE CHANGED AS I PUT IN FAKES
auto char three = 'M'; // THIRD CHARACTER OF GAME PROCESS NAME THESE NEED TO BE CHANGED AS I PUT IN FAKES
auto unsigned int size;
process.highLongOfPSN = kNoProcess;
process.lowLongOfPSN = kNoProcess;
procInfo.processInfoLength = sizeof(ProcessInfoRec);
procInfo.processName = procName;
procInfo.processAppSpec = &appFSSpec;
while (procNotFound != (osErr = GetNextProcess(&process))) {
if (noErr == (osErr = GetProcessInformation(&process, &procInfo))) {
size = (unsigned int) procName[0];
memcpy(cstrProcName, procName + 1, size);
cstrProcName[size] = '\0';
// NEEDS TO MATCH THE SIGNATURE OF THE GAME..FIRST THREE LETTERS
// IF YOU CANT FIND IT WITH THE ACTIVITY MONITOR UTILITY OF APPLE MAC OS
// THEN RUN THIS SAME CLASS WITH AN NSLOG AND IT WILL LIST ALL YOUR RUNNING PROCESSES.
if ( (((char *) &procInfo.processSignature)[0]==one) &&
(((char *) &procInfo.processSignature)[1]==two) &&
(((char *) &procInfo.processSignature)[2]==three) &&
(((char *) &procInfo.processSignature)[3]==two))
{
gamePSN = process;
otherErr = GetProcessInformation(&gamePSN, &gameProcessInfo);
otherErr = GetProcessPID(&process, &gameUnixPID);
}
}
}
}
Once you have this process number it is easy to send key events as well as mouse events. Here is the mouse event clicks to send.
// mouseClicks.h
// ClickDep
// Created by AnonymousPlayer on 9/9/11.
#import <Foundation/Foundation.h>
#interface mouseClicks : NSObject
- (void) PostMouseEvent:(CGMouseButton) button eventType:(CGEventType) type fromPoint:(const CGPoint) point;
- (void) LeftClick:(const CGPoint) point;
- (void) RightClick:(const CGPoint) point;
- (void) doubleLeftClick:(const CGPoint) point;
- (void) doubleRightClick:(const CGPoint) point;
#end
/
// mouseClicks.m
// ClickDep
// Created by AnonymousPlayer on 9/9/11.v
#import "mouseClicks.h"
#implementation mouseClicks
- (id)init
{
self = [super init];
if (self) {
// Initialization code here if you need any.
}
return self;
}
- (void) PostMouseEvent:(CGMouseButton) button eventType:(CGEventType) type fromPoint:(const CGPoint) point;
{
CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, point, button);
CGEventSetType(theEvent, type);
CGEventPost(kCGHIDEventTap, theEvent);
CFRelease(theEvent);
}
- (void) LeftClick:(const CGPoint) point;
{
[self PostMouseEvent:kCGMouseButtonLeft eventType:kCGEventMouseMoved fromPoint:point];
NSLog(#"Click!");
[self PostMouseEvent:kCGMouseButtonLeft eventType:kCGEventLeftMouseDown fromPoint:point];
sleep(2);
[self PostMouseEvent:kCGMouseButtonLeft eventType:kCGEventLeftMouseUp fromPoint:point];
}
- (void) RightClick:(const CGPoint) point;
{
[self PostMouseEvent:kCGMouseButtonRight eventType:kCGEventMouseMoved fromPoint:point];
NSLog(#"Click Right");
[self PostMouseEvent:kCGMouseButtonRight eventType: kCGEventRightMouseDown fromPoint:point];
sleep(2);
[self PostMouseEvent:kCGMouseButtonRight eventType: kCGEventRightMouseUp fromPoint:point];
}
- (void) doubleLeftClick:(const CGPoint) point;
{
[self PostMouseEvent:kCGMouseButtonRight eventType:kCGEventMouseMoved fromPoint:point];
CGEventRef theEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, point, kCGMouseButtonLeft);
CGEventPost(kCGHIDEventTap, theEvent);
sleep(2);
CGEventSetType(theEvent, kCGEventLeftMouseUp);
CGEventPost(kCGHIDEventTap, theEvent);
CGEventSetIntegerValueField(theEvent, kCGMouseEventClickState, 2);
CGEventSetType(theEvent, kCGEventLeftMouseDown);
CGEventPost(kCGHIDEventTap, theEvent);
sleep(2);
CGEventSetType(theEvent, kCGEventLeftMouseUp);
CGEventPost(kCGHIDEventTap, theEvent);
CFRelease(theEvent);
}
- (void) doubleRightClick:(const CGPoint) point;
{
[self PostMouseEvent:kCGMouseButtonRight eventType:kCGEventMouseMoved fromPoint:point];
CGEventRef theEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, point, kCGMouseButtonRight);
CGEventPost(kCGHIDEventTap, theEvent);
sleep(2);
CGEventSetType(theEvent, kCGEventRightMouseUp);
CGEventPost(kCGHIDEventTap, theEvent);
CGEventSetIntegerValueField(theEvent, kCGMouseEventClickState, 2);
CGEventSetType(theEvent, kCGEventRightMouseDown);
CGEventPost(kCGHIDEventTap, theEvent);
sleep(2);
CGEventSetType(theEvent, kCGEventRightMouseUp);
CGEventPost(kCGHIDEventTap, theEvent);
CFRelease(theEvent);
}
#end
You may need to play with the sleep which is the time interval between pushing the mouse button and releasing it. I have found that using 1 second sometimes it does not do it. Putting 2 seconds make it work all the time.
So your main would to the following.
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];
// Grabs command line arguments -x, -y, -clicks, -button
// and 1 for the click count and interval, 0 for button ie left.
int x = [args integerForKey:#"x"];
int y = [args integerForKey:#"y"];
int clicks = [args integerForKey:#"clicks"];
int button = [args integerForKey:#"button"];
//int interval= [args integerForKey:#"interval"];
int resultcode;
// PUT DEFAULT VALUES HERE WHEN SENT WITH EMPTY VALUES
/*if (x==0) {
x= 1728+66;
y= 89+80;
clicks=2;
button=0;
}
*/
// The data structure CGPoint represents a point in a two-dimensional
// coordinate system. Here, X and Y distance from upper left, in pixels.
CGPoint pt;
pt.x = x;
pt.y = y;
// Check CGEventPostToPSN Posts a Quartz event into the event stream for a specific application.
// only added the front lines plus changed null in Create Events to kCGHIDEventTap
gamePSN *gameData = [[gamePSN alloc] init];
[gameData getPSN];
ProcessSerialNumber psn = [gameData gamePSN];
resultcode = SetFrontProcess(&psn);
mouseClicks *mouseEvent =[[mouseClicks alloc] init];
if (button == 0)
{
if (clicks==1) {
[mouseEvent LeftClick:pt];
} else {
[mouseEvent doubleLeftClick:pt];
}
}
if (button == 1)
{
if (clicks==1) {
[mouseEvent RightClick:pt];
} else {
[mouseEvent doubleRightClick:pt];
}
}
[gameData release];
[mouseEvent release];
[pool drain];
return 0;
}
Hope this is helpful.... remember you can execute this in the terminal or in AppleScript by sending the following command.
do shell script "/...Path to Compiled Program.../ClickDep" & " -x " & someX & " -y " & someY & " -clicks 1 -button 1"
HAPPY GAMING!!!!