• C Programming Tutorial
  • C Programming useful Resources

C-SPAN.org gives you access to C-SPAN's daily coverage of Washington and more than 200,000 hours of extensively indexed and archived C-SPAN video.

  • Selected Reading

C Single character: Reads the next character. If a width different from 1 is specified, the function reads width characters and stores them in the successive locations of the array passed as argument. If the Boolean expression evaluates to true, then the if block will be executed, otherwise, the else block will be executed. C programming language assumes any non-zero and non-null values as true, and if it is either zero or null, then it is assumed as false value. Use this powerful and intuitive sampler plugin to quickly find, chop, key shift, and time stretch samples or slice and dice them with a click of a button.


Sometimes, you may come across a situation, when you want to have a function, which can take variable number of arguments, i.e., parameters, instead of predefined number of parameters. The C programming language provides a solution for this situation and you are allowed to define a function which can accept variable number of parameters based on your requirement. The following example shows the definition of such a function.

It should be noted that the function func() has its last argument as ellipses, i.e. three dotes (..) and the one just before the ellipses is always an int which will represent the total number variable arguments passed. To use such functionality, you need to make use of stdarg.h header file which provides the functions and macros to implement the functionality of variable arguments and follow the given steps −

  • Define a function with its last parameter as ellipses and the one just before the ellipses is always an int which will represent the number of arguments.

  • Create a va_list type variable in the function definition. This type is defined in stdarg.h header file.

  • Use int parameter and va_start macro to initialize the va_list variable to an argument list. The macro va_start is defined in stdarg.h header file.

  • Use va_arg macro and va_list variable to access each item in argument list.

  • Use a macro va_end to clean up the memory assigned to va_list variable.

Now let us follow the above steps and write down a simple function which can take the variable number of parameters and return their average −

When the above code is compiled and executed, it produces the following result. It should be noted that the function average() has been called twice and each time the first argument represents the total number of variable arguments being passed. Only ellipses will be used to pass variable number of arguments.

For quick prototyping C# is a great language. For highly optimized real-time audio processing C++ is the better choice. Nevertheless I wanted C# as the language for my custom VST host (often called DAW) because of the relatively quick development time and the large number of libraries that I could use. C# offers support for unmanaged code with which you can still use pointers to process audio in a relatively efficient way.

VST plugins

I used VST.NET (https://github.com/obiwanjacobi/vst.net) to load the VST plugins, write midi messages to it and get the audio buffer. The guy who wrote this stuff has put some serious time and development effort in it for which I am very grateful. The only downside is that plugin processing runs from a single dispatched thread. That means that all simultaneous VST's that run in my host are processed from that single thread. I think that the bigger VST's handle their own threading and this is not a problem, but when you are using VST's that only run on the thread from which they are called, this is a serious downside. This problem is discussed in the forums and no solution exists.

I will keep my eye open for other VST host libraries written in C++, and am probably going to rewrite the whole audio processing in pure C++ and keep the GUI layer in C#. Nevertheless I am very pleased with the current performance of my software. I am able to run four heavy plugins simultaneously at a buffer size of 128 samples. Often I can use some more medium weight plugins and use all 8 channels. Effect plugins are also supported. I tested it briefly and it is basically working, but I consider it to be still under development.

ASIO

For Asio handling I tested both BlueWave.Interop.Asio (https://www.codeproject.com/Articles/24536/Low-Latency-Audio-using-ASIO-Drivers-in-NET?msg=4526889) and NAudio. Both work fine, but the BlueWave performed better to my opinion. I say this with care because it could very well be the same code base. I haven't looked into the code behind the NAudio asio handling. The BlueWave project had a small bug with did not terminate the ASIO driver correctly at shutdown. This resulted in having to reboot every single time after shutting down a debug session in order to get the audio to work again. After I got tired of doing so, I decided to fix the bug. The updated source is on my github.

C-diff Bacteria Infection

MIDI

For MIDI input from my Nord and an Arturia Beatstep, I tried to use midi-dot-net (https://code.google.com/archive/p/midi-dot-net/). Unfortunately the Juli@ does not support kernel32 winmm.dll midi! The only way I could get MIDI in and output was to use DirectMusic midi. For that I used DirectMidi.net (http://directmidinet.sourceforge.net).

UI controls

Most of the UI controls I have written myself. The ringslider above the physical encoder was one that was very specific. Also the scroll-list operated by the main menu encoder I build myself.

Hardware monitor

To monitor the CPU temperature I used OpenHardwareMonitor (https://openhardwaremonitor.org) which continuously displays the temperature in the main screen. When installing the CPU cooler I damaged the bearings and decided to just remove the power from the CPU cooler. Amazingly it always runs cool. Possibly beacuse of the airflow through the case. But because of this I wanted to see the CPU temperature at the main screen.

Vst routing plugin. PDF Viewer

Sheet music in PDF format can be added to a song (bank). I use PDFViewer from https://www.codeproject.com/Articles/37458/PDF-Viewer-Control-Without-Acrobat-Reader-Installe to to display it.

C&a Online Shop

Smooth instrument transition

C Program Files Vst Plugins

I personally find this the most interesting part to write, because I came up with a unique musical feature that I haven't found in other DAW software for live usage. When a channel is enabled, the button is illuminated blue. When the button is pressed the state of the channel goes to 'pending disable' . The sound does not directly go away but keeps on going as long as the keys or sustain pedal remain pressed. New keys will not play on the 'pending disabled' channel. Once all the active keys are released the channel state goes to 'Disabled'. In this way you can very fluently change between different sounds. I recently found out that the latest Nord Stage3 also has this feature, but hey it cannot run VST's :)

Other features

I'll just name a few other interesting features I implemented:

C# Plugin Interface

  • Synchronized backingtrack + clicktrack with bpm midi clock (2x additional stereo out). In this way I can play synth arpeggio’s when a backingtrack and clicktrack is running.
  • Midi active keyzone per channel.
  • Transpose per channel.
  • Foot controller selection per channel; volume, expression or none.
  • Midi channel per (instrument) channel. I needed this since I started using a 2nd keyboard.
  • Setlist editor.
  • Metronome based on high resolution media timer.
  • Recording & playback of audio output in MP3 format.