title: @synthesize-ing a C array of structs in Objective-C 2.0
body: <p>I'm trying to follow a tutorial for a C++ interface in the Mac OS X API (Audio Queue Services), but in a Cocoa (well, actually just Foundation) application (well, actually just a 'tool'). It has a struct that looks like this:</p>
  
  <pre><code>static const int kNumberBuffers = 3;                              // 1
  struct AQPlayerState {
      AudioStreamBasicDescription   mDataFormat;                    // 2
      AudioQueueRef                 mQueue;                         // 3
      AudioQueueBufferRef           mBuffers[kNumberBuffers];       // 4
      AudioFileID                   mAudioFile;                     // 5
      UInt32                        bufferByteSize;                 // 6
      SInt64                        mCurrentPacket;                 // 7
      UInt32                        mNumPacketsToRead;              // 8
      AudioStreamPacketDescription  *mPacketDescs;                  // 9
      bool                          mIsRunning;                     // 10
  };
  </code></pre>
  
  <p>I'm having a lot of trouble with translating item 4 into Objective-C, because I can't figure out how to <code>@synthesize</code> a C array. Specifically, this is what I have so far:</p>
  
  <h3>PlayerState.h</h3>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;AudioToolbox/AudioQueue.h&gt;
  
  @interface PlayerState : NSObject {
    AudioStreamBasicDescription   dataFormat;
    AudioQueueRef                 queue;
    AudioQueueBufferRef           _buffers[3];
    int                           audioFile; // make this an actual type?
    UInt32                        bufferByteSize;
    SInt64                        currentPacket;
    UInt32                        numPacketsToRead;
    AudioStreamPacketDescription* packetDescs;
    bool                          isRunning;
  }
  
  @property(assign) AudioStreamBasicDescription   dataFormat;
  @property(assign) AudioQueueRef                 queue;
  @property(assign) AudioQueueBufferRef           buffers;
  @property(assign) int                           audioFile;
  @property(assign) UInt32                        bufferByteSize;
  @property(assign) SInt64                        currentPacket;
  @property(assign) UInt32                        numPacketsToRead;
  @property(assign) AudioStreamPacketDescription* packetDescs;
  @property(assign) bool                          isRunning;
  
  @end
  </code></pre>
  
  <h2>PlayerState.m</h2>
  
  <pre><code>#import "PlayerState.h"
  
  @implementation PlayerState
  
  @synthesize dataFormat;
  @synthesize queue;
  @synthesize buffers;
  @synthesize audioFile;
  @synthesize bufferByteSize;
  @synthesize currentPacket;
  @synthesize numPacketsToRead;
  @synthesize packetDescs;
  @synthesize isRunning;
  
  @end
  </code></pre>
  
  <p><code>@synthesize buffers</code> fails to compile as follows: "error: synthesized property 'buffers' must either be named the same as a compatible ivar or must explicitly name an ivar"</p>
  
  <p>This is obviously because the corresponding ivar is named <code>_buffers</code> and not <code>buffers</code> - but this is necessary, because I can't define a property as an array (can I? <code>@property(assign) *AudioQueueBufferRef buffers</code> is a syntax error)</p>
  
  <p>What can I do to either define the ivar as an array of <code>AudioQueueBufferRef</code> structs, or synthesize the property such that it refers to the <code>_buffers</code> array?</p>