//
//  main.m
//  ArmorP3V1
//
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "Repository.h"

/*
#import <CoreMIDI/CoreMIDI.h>

NSString *getDisplayName(MIDIObjectRef object)
{
    // Returns the display name of a given MIDIObjectRef as an NSString
    CFStringRef name = nil;
    if (noErr != MIDIObjectGetStringProperty(object, kMIDIPropertyDisplayName, &name))
        return nil;
    return (NSString *)name;
}
 */

int main(int argc, char *argv[])
{
    /*
    NSLog(@"Iterate through destinations");
    ItemCount destCount = MIDIGetNumberOfDestinations();
    for (ItemCount i = 0 ; i < destCount ; ++i) {
        
        // Grab a reference to a destination endpoint
        MIDIEndpointRef dest = MIDIGetDestination(i);
        if (dest != NULL) {
            NSLog(@"  Destination: %@", getDisplayName(dest));
        }
    }
    
    NSLog(@"Iterate through sources");
    // Virtual sources and destinations don't have entities
    ItemCount sourceCount = MIDIGetNumberOfSources();
    for (ItemCount i = 0 ; i < sourceCount ; ++i) {
        
        MIDIEndpointRef source = MIDIGetSource(i);
        if (source != NULL) {
            NSLog(@"  Source: %@", getDisplayName(source));
        }
    }
     */

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    [[Repository mainRepository]loadAll];
    
    int retVal = 0;

    @try {
        retVal = UIApplicationMain(argc, argv, nil, @"ArmorP3V1AppDelegate");
    }
    @catch (NSException *exception) {
        NSLog(@"exception %@ %@", exception, [exception callStackSymbols]);
    }
    @finally {
    }
    [pool release];
    return retVal;
}
