I am Magnus Lidström. I write code. Lots of it. Some of it ends up in soniccharge.com products. Some of it ends up here. Most of it ends up in ~/Trash.

Symbiosis

June 01, 2014comments
What Is Symbiosis? Symbiosis is a developer tool for adapting Mac OS X VST plug-ins to the Audio Unit (AU) standard. It essentially consists of a single C++ file that you can compile into your VST project to make the plug-in compatible with the Audio Unit protocol. Optionally, you may choose to use a pre-built "wrapper plug-in" for adapting your existing VST plug-in to the AU standard without even having to recompile any source code. How Does It Work? Although the VST and Audio Unit SDKs differ greatly in implementation, the purpose and functions of the two standards are virtually identic

DOS-Like Wildcard Matching

June 01, 2014comments
Here is a short recursive function to perform string matching with DOS-like wildcard support. bool wildcardMatch(const char* p, const char* s) { while (*p != '\0') { if (*p == '*') { if (wildcardMatch(p + 1, s)) { return true; } } else if (*p == '?' || tolower(*p) == tolower(*s)) { ++p; } else { return false; } ++s; } return (*s == '\0'); } p is pattern to match (? matches any character, * matches any substring, any other letter is compared with disregard for case). s is stri

Priyome Chess Computer

June 01, 2014comments
Priyome is a complete chess computer in single plain C source code file. It was written to be easily ported to other even more primitive languages. E.g. it uses only integers and does not require structures. The AI is implemented using standard chess computer techniques such as alpha beta pruning search with iterative deepening, quiescence optimization (only checking for captures beyond a specific depth) and a memory efficient solution for transposition table lookup. A B C D E F G H +-----------------+ 8 | r n b q k b n r | 8 7 | p p p p p p p p | 7 6 | . . . . | 6 5 | . . .