main.m 949 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // main.m
  3. // DHSendMIDI
  4. //
  5. // Created by Douglas Heriot on 23/01/13.
  6. // Copyright (c) 2013 Douglas Heriot. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <SnoizeMIDI/SnoizeMIDI.h>
  10. int main(int argc, const char * argv[])
  11. {
  12. @autoreleasepool
  13. {
  14. if(argc != 3)
  15. {
  16. fprintf(stderr, "Must have 2 arguments - MIDI CC Controller and Value\n");
  17. return 1;
  18. }
  19. SMPortOutputStream *os = [[SMPortOutputStream alloc] init];
  20. [os setEndpoints:[NSSet setWithArray:[SMDestinationEndpoint destinationEndpoints]]];
  21. uint8_t byte1 = atoi(argv[1]);
  22. uint8_t byte2 = atoi(argv[2]);
  23. SMVoiceMessage *message = [[SMVoiceMessage alloc] initWithTimeStamp:0 statusByte:SMVoiceMessageStatusControl];
  24. [message setTimeStampToNow];
  25. [message setDataByte1:byte1];
  26. [message setDataByte2:byte2];
  27. [message setChannel:1];
  28. [os takeMIDIMessages:@[message]];
  29. printf("Sent CC %u %u\n", byte1, byte2);
  30. }
  31. return 0;
  32. }