tags:

views:

47

answers:

2

Possible Duplicate:
Can an objective C method signature specify an enum type?

"VoiceName" is an enum, declared like this:

enum VoiceName {
    PAD_RHYTHM,
    PAD_RHYTHM2,
    PAD_RHYTHM3,
    PEEPERS,
    ATMOSPHERE,
    IMPULSE,
    FAST_PULSE,
    HAIRYBALLS_PADS,
    KICK
};

The compiler doesn't seem to like me using it in a method signature like this:

-(void)pulseFiredWithSamplePosition:(float)position from: (VoiceName) voiceName;

It tells me expected ')' before 'VoiceName'. What's going on here?

+2  A: 

You have to refer to it as enum VoiceName:

-(void)pulseFiredWithSamplePosition:(float)position from: (enum VoiceName) voiceName;

Or you can typedef it:

typedef enum {
    /* ... */
} VoiceName;

Then you can refer to it as VoiceName.

mipadi
We are cross answering the same question with what seems to be an identical answer. :)
quixoto
A: 

Remember this is Objective-C, it needs to be from: (enum VoiceName) voiceName.

If you don't want to say enum you can use a typedef.

Logan Capaldo