How to generate single C++ header and code files from several files

Status
Not open for further replies.

C0d3man

Well-known member
Hi,

sorry, this is more of a general C++ topic, but my question is aimed at a Teensy project. So I hope it's ok if I ask the question here.

I am developing MicroDexed, a 6 OP FM synth (compatible with a famous synth from the 80ies). The sound generation code is taken from Dexed (a JUCE based implementation of the msfa engine). It's working fine.

But now I thought about to build a single audio object for Teensy. The current audio engine code is stable and is very rarely touched. Currently the code is splitted over several *.h and *.cpp files. My idea was to put the engine code into a single *.cpp and *.h file. But how to do this?

Simply merging the files will probably not work. Does anyone have an idea how to do this?

TIA, Holger
 
If they are poper c++ files
Using classes the merge should be possible without any issues, however if there is non classed functions with the same names in the CPP files then you get conflicts.
 
Can you explain why this would be advantageous to you?

The handling for me would be easier (in Arduino IDE) - not so much files.

But the main reason is that I can use it like a Teensy-Audio-Library object (e.g. as synth_dexed()). So others can use this object simply by adding the class and header file.
 
If they are poper c++ files
Using classes the merge should be possible without any issues, however if there is non classed functions with the same names in the CPP files then you get conflicts.

There are mainly classes. But it seems that there are nearly no conflicting function names if not class based.

I found a way by using https://github.com/dwd31415/single-c-file for the headers and cpp files. There were some small conflicts I had to resolve but now the compiler does not complain anymore... But I currently don't know if it works - I have to write some test code.
 
Status
Not open for further replies.
Back
Top