yet another max/msp-cocoa communication

14
Yet Another Max/MSP - Cocoa Integration cocoa-send / cocoa-receive external objects Nao Tokui 1

Upload: nao-tokui

Post on 15-May-2015

7.182 views

Category:

Technology


2 download

DESCRIPTION

This slide presents cocoa_send / receive external objects for Cycling'74 Max/MSP, which enables simple and stable communication between Max/MSP and Native OS X Cocoa programming environment.

TRANSCRIPT

Page 1: Yet Another Max/MSP-Cocoa Communication

Yet Another Max/MSP - Cocoa

Integrationcocoa-send / cocoa-receive external objects

Nao Tokui

1

Page 2: Yet Another Max/MSP-Cocoa Communication

Why Integrate?

• Max/MSP

○Useful for Audio / MIDI / Images .... !!

△ Scalability

×Hard to manage big data set.

2

Page 3: Yet Another Max/MSP-Cocoa Communication

Why Integrate?

• Cocoa - Native OS X Environment

○Lots of useful frameworks and easy-to-use tools for them.• Frameworks - CoreData, Bonjour, QuartzComposer...

• Tool - Xcode, InterfaceBuilder...

×Audio / MIDI API is very very complicated.• Core Audio / Core MIDI / Quick Time

3

Page 4: Yet Another Max/MSP-Cocoa Communication

Max/MSP Cocoa

CoreData

Bonjour

OpenGL

Audio

MIDI

4

Page 5: Yet Another Max/MSP-Cocoa Communication

Conventional Ways

• MIDI?

• CoreMIDI - Simply Overkill!

• Open Sound Control

• Very flexible, but clumsy implementation

• Not easy to use in Cocoa

5

Page 6: Yet Another Max/MSP-Cocoa Communication

cocoa_send / receiveexternal object

NEW

6

Page 7: Yet Another Max/MSP-Cocoa Communication

Features

○Simple to implement and Just works!

○No need to “connect” explicitly (Always Connected!!)

×Limited to local use

http://commons.wikimedia.org/w/index.php?title=Image:MacBook_Pro_transparency.png

CocoaMaxMax

Cocoa

OK NG!

7

Page 9: Yet Another Max/MSP-Cocoa Communication

How to Use #11. Download cocoa_send/receive objects and

sample application from www.naotokui.com

2. Set “Channel Names”

• These names will be used to identify communication channels. They must be shared between Max objects and Cocoa project.

Max → Cocoa Max ← Cocoa

9

Page 10: Yet Another Max/MSP-Cocoa Communication

How to Use #23. Open Cocoa_SR_Test folder

and include Cocoa_SR_Test.h/m in your own Cocoa Project.

4. Set the same Channel Names

5. Use -sendString: -sendFloat:/-sendInteger methods to send.

#define CH_NAME_FROM_COCOA @"FROM_Cocoa"#define CH_NAME_TO_COCOA @"TO_Cocoa"

10

Page 11: Yet Another Max/MSP-Cocoa Communication

Sending from Cocoa

• Use -send**: methods.

- (void) sendString: (NSString *) str;

- (void) sendFloat: (float) number;

- (void) sendInteger: (int) number;

11

Page 12: Yet Another Max/MSP-Cocoa Communication

Receiving in Cocoa

• Customize a callback function: - (void) callbackWithNotification:

- (void) callbackWithNotification:(NSNotification *)myNotification{ NSDictionary *dict = [myNotification userInfo];

// a string value received NSString *string = [dict valueForKey:SHARED_DICTIONARY_KEY_FOR_ANYTHING]; if (string) {

// Do something } .....

SHARED_DICTIONARY_KEY_FOR_FLOAT SHARED_DICTIONARY_KEY_FOR_INTSHARED_DICTIONARY_KEY_FOR_ANYTHING

• Dictionary Keys:

12

Page 14: Yet Another Max/MSP-Cocoa Communication

Links

• Download

• www.naotokui.com/home/Downloads.html

14