[sdiy] OT (but very synthy): C question

Tom Wiltshire tom at electricdruid.net
Mon Mar 28 18:13:19 CEST 2011


Hi all,

Sorry to bother you with a C question, but I'm starting to get frustrated 'cos I can't get this straight in my head.

Here's the situation:

I've got four files LFO.h, LFO.c, MIDI.h, and MIDI.c

Now, my LFO header file includes the following:

	void LFOCalculate(LFO *this, MIDIHandler *midi);

"this" is a reference to an LFO structure, basically OO by the back door. "midi" is a reference to my MIDI handler which I need to be able to send MIDI clock pulses from the LFO.

The problem I've hit is putting the following in my MIDI.h:

	void MIDIParse(MIDIHandler *this, LFO *lfo);

The reference to "lfo" here is so that received MIDI CC messages can set LFO parameters.

Currently I have the LFO structure defined in LFO.h and the MIDIHandler structure defined in MIDI.h. But I can't include MIDI.h in LFO.h *and* also include LFO.h in MIDI.h.
Where should I put things to avoid this problem?

I should also mention that I'm being paid for this, so if it bothers you to help me out for free, please don't feel you have to. Personally, I don't much mind helping folk with their work if I can, but I know some people feel differently.

Thanks,
Tom





More information about the Synth-diy mailing list