Digital Music Programming II: Making a Max/MSP CodeWarrior Project
These sets of directions are for creating a Max/MSP external object on
a Mac PPC OS 9 computer which has the following software installed:
- Max 4.0/MSP 2.0
- SDK for
Max 4.0/MSP 2.0 for MAC OS 9.
- CodeWarrior 6.0 with IDE 4.1.
Computers at Peabody which are know to work for this lab:
307 Prep Station, 311 Laptop, 314.
The following instructions are taken from Ichiro Fujinaga's
Max/MSP
Externals Tutorial, version 2.41 (Sep 2002), pages 1-2.
- Open CodeWarrior IDE
- select menu File --> New...
- In the New window that opens, do the following:
- project name: mybang.mcp
- Set the location where you want to save your project.
For example: Xenakis:Desktop Folder:Users:craig:mybang.
- In the Project tab subwindow, click on
"Mac OS C Stationery"
- Click the OK button to go to the next window.
- In the "New Project" window, do the following:
- Open "Standard Console".
- Then open "PPC".
- Then choose "Std C Console PPC".
- Click on the OK button to go to the next window.
- A windows called "mybang.mcp" should now appear on
the screen, do the following:
- Drag "Sources" folder to the trash.
- Drag "ANSI Library" folder to the trash.
- Open "MAC Libraries" folder and then drag
"MSLRuntime PPC.lib" and MathLib into the trash, leaving
only the file Interface.lib.
- Select menu File --> "New Text File" (or type
apple-N) to create a new text file.
- Copy these contents into the new file (explained in Ich's
Tutorial):
#include "ext.h"
typedef struct {
t_object max_data;
void* output;
} MyObject;
void *object_data;
void *create_object(void);
void InputBang(MyObject *mo);
void main(void) {
setup((t_messlist**)&object_data, (method)create_object,
NULL, (short)sizeof(MyObject), NULL, A_NOTHING);
addbang((method)InputBang);
}
void *create_object(void) {
MyObject *mo;
mo = (MyObject*)newobject(object_data);
mo->output = bangout(mo);
return mo;
}
void InputBang(MyObject* mo) {
outlet_bang(mo->output);
}
|
- Save the file to the project folder or wherever you want to
save your source code.
- select menu Project --> "Add mybang.c to
Project". Note that you must have the mybang.c window active when
you do this; otherwise, that option will be grayed out. Your source code should now be listed in the
"mybang.mcp" window.
- Add the Max/MSP libraries
- select menu Project --> "Add Files...". Locate
the file MaxLib file. For example:
Xenakis:Max4/MSP2:Max/MSP SDK:SDK Examples:Max includes:MaxLib.
- If you want to make a MSP object, select menu Project --> "Add Files...". Locate
the file MaxAudioLib file. For example:
Xenakis:Max4/MSP2:Max/MSP SDK:SDK Examples:MSP
includes:MaxAudioLib.
- Adjust the project settings for compiling a Max/MSP project.
- select menu Edit --> "PPC Std C Console Settings..."
- in the "Target Settings Panels" subwindow on the left, select
Target --> "PPC Target".
- in the "PPC Target" subwindow on the right, change the
project type from Application to "Shared
Library".
- change the Creator to be "max2.
- change the Type to be "iLaF" (I am sure you
do).
- in the "Target Settings Panels" subwindow on the left, select
Linker --> "PPC Linker".
- in the "PPC Linker" subwindow on the right, uncheck the
"Generate SYM File" option.
- in the "Entry Points" field, change __start to
main.
- in the "Target Settings Panels" subwindow on the left, select
Linker --> "PPC PEF".
- in the "PPC PEF" subwindow in the right, check the
option "Expand Uninitialized Data".
- in the "Target Settings Panels" subwindow on the left, select
"Language Settings" --> "C/C++ Language".
- uncheck the "ANSI Strict" option.
- in the "Prefix File" field enter MacHeaders.h
- click on the Save button, and then close "PPC Std C
Console Settings" window.
- Compile the object:
- select menu Project --> Make (or apple-M)
- if the compile is successful, then a Max object will be
written into your project folder. Go to the finder and look for it.
- Test your compiled object:
- Start Max/MSP as you normally do, or by clicking on your
new object.
- make a new patcher in Max/MSP and add the external object to
the patch.
|