von win nach mac osx mit iowarrior40 für puredata

Dies ist das deutsche Forum für alle Themen um den IO-Warrior. Beiträge bitte nur in Deutsch.

Moderator: Guido Körber

Post Reply
kalleplom
Posts: 20
Joined: Sun Mar 05, 2006 11:17 am
Location: Berlin

von win nach mac osx mit iowarrior40 für puredata

Post by kalleplom »

hallo!
ich hatte ein pure data object programmiert, mit dem ich ein 7segment display über einen IOWarrior40 ansteuern konnte.

btw: nach pure data wurde hier auch schon mal gefragt.

und weil ja hier alles so verdammt eilig ist, und ich schon rotiere frage ich ein paar grundsätzliche dinge, die die portation nach macosx betreffen.

soweit ich das bis jetzt verstanden habe, kann ich nicht einfach den sourcecode von windows auf dem mac benutzen.

Code: Select all


#include "m_pd.h"
#include "IOWarriorLib.h"

static t_class *jason_class;
int value, port;

typedef struct _jason {
        t_object      x_obj;
        t_float       valueIO;
        t_float       portIO;
} t_jason;


int put_digit(value,port){
	
IOWarriorInit (); 	
	
IOWarriorHIDDeviceInterface** iow;
iow = IOWarriorFirstInterfaceOfType (0);
	
IOWKIT_HANDLE     ioHandle;
IOWKIT40_IO_REPORT report;
int                digit;
    
ioHandle = IowKitOpenDevice();     //open connection to IO warrior
   
report.ReportID =   0;
report.Value    =   0xFFFFFFFF;

switch(value){
               
               case   0     :   digit   =   17;    break;    // '0'
               case   1     :   digit   =   159;    break;   // '1'
               case   2     :   digit   =   50;    break;    // '2'
               case   3     :   digit   =   22;    break;    // '3'
               case   4     :   digit   =   156;    break;   // '4'
               case   5     :   digit   =   84;    break;    // '5'
               case   6     :   digit   =   80;    break;    // '6'
               case   7     :   digit   =   31;    break;    // '7'
               case   8     :   digit   =   16;    break;    // '8'
               case   9     :   digit   =   20;    break;    // '9'   
               case   10    :   digit   =   254;    break;    // '-'   
               default   :   digit   =   17; 
    }
report.Bytes[port] = digit;
IowKitWrite(ioHandle, IOW_PIPE_IO_PINS, (PCHAR)&report, IOWKIT40_IO_REPORT_SIZE);
IowKitCloseDevice(ioHandle);
    return digit;
} 

static void jason_float(t_jason *x, t_float f){ 
    int value   =   (int)x->valueIO;
    int port   =   (int)x->portIO;
    post("value %d : digit %d : port %d",value, put_digit(value, port), port);
}

void *jason_new(t_symbol *s, int argc, t_atom *argv){ 
    t_jason *x   =    (t_jason *)pd_new(jason_class);
    
    floatinlet_new(&x->x_obj, &x->portIO);           // port of IO Warrior (0-4)
    floatinlet_new(&x->x_obj, &x->valueIO);          // value for the output
    return (void *)x;
}

//__declspec(dllexport) void jason_setup(void);

void jason_setup(void) {
    jason_class = class_new(gensym("jason"), (t_newmethod)jason_new, 0, sizeof(t_jason),CLASS_DEFAULT, A_GIMME, (t_atomtype) 0);
    class_addfloat(jason_class, jason_float);
}

wenn ich den code mit xcode zu kompilieren versuche, endet die sache mit 8 fehlern, weil er mit den type wie zB IOWKIT_HANDLE nichts anfangen kann.

ich habe keine ahnung, wie ich das umschreiben kann, damit es auch auf dem mac zu Kompilieren ist.

kann mir jemand helfen?
:cry:
Guido Körber
Site Admin
Posts: 2876
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

Das API ist auf MacOS X völlig anders als auf Windows. In der nächsten Version wollen wir das vereinheitlichen, das dauert aber noch etwas.
Post Reply