A struct for recording audio samples I am writing a program in c++ to record audio.
Here are my structure and code snippet.  

typedef struct _recorder {
    const uint32_t SAMPLE_RATE = 44100;
    const uint32_t FRAME_STEP = SAMPLE_RATE / 100;
    const uint32_t STEP_BUF_SIZE = sizeof(int16_t) * FRAME_STEP;
    int16_t *step_buf;

    const uint32_t RECORD_TIME = 10;
    const uint32_t NUM_SAMPLE = RECORD_TIME * SAMPLE_RATE;
    int16_t *total_buf;

    uint32_t sample_counter;
} recorder;

void recorder_init(recorder *r)
{
    r-&gt;step_buf = new int16_t[r-&gt;STEP_BUF_SIZE / sizeof(int16_t)];
    r-&gt;total_buf = new int16_t[r-&gt;NUM_SAMPLE];
}

void recorder_free(recorder *r)
{
    delete[] r-&gt;step_buf;
    delete[] r-&gt;total_buf;
}

void main(int argc, char *argv[])
{
    recorder rec;
    recorder_init(&amp;rec);

    // Do something to record audio

    recorder_free(&amp;rec);
}


Does using structures and functions make sense to you? Or should I use a class? Or there are better design patterns I can follow?  

EDIT -------------------------
I add a further question of this post here.
This is very much C-style code: the only thing that qualifies it as C++ is the fact that you use new and delete[] rather than malloc() and free().

I don't see why RECORD_TIME should be a constant. I would expect it to be a constructor parameter. Or, use std::vector to store the samples, and you won't even have to worry about the array capacity, or even new and delete[].

The recorder class should be responsible for initializing sample_counter to zero, which you never did in your recorder_init(). In addition, I would expect there to be a method for appending a sample, and that method would automatically increment sample_counter. Again, though, if you used a std::vector, you wouldn't need such a complication, since the vector's size would serve that purpose.