Categories
Articles C++11 Coders Codex GNU C++ Languages Linux Development Programming Science & Technology

Coders Codex::Best Online Compiler for C++11 Programming

INTRODUCTION

This article briefly discusses Coding Ground from Tutorialspoint for which I feel is one of the best online compilers for C++11 Programming. An online text editor and compiler offers good opportunity to try out C++11 without needing to setup a compiler or IDE on your local computer, so this is great for going through tutorials and sharing snippets of code online.

Online C++ Compiler and Editor
C++ Codingground

DISCUSSION

The IDE features a syntax highlighted text editor which I find to be pleasant and clean to look at. I also like the code-collapse tooltips at the side of the window, allowing the close inspection of code which needs attention. Sadly though, it does not have anything like intellisense, code completion or basic debugging tools. I think it would be nice to see in an update some basic code autocomplete and some break points, step-through, step into and continue debugging features.

FINDINGS

The ability to import GitHub projects looks like a nifty feature however I have yet to try this out. The Bash terminal at the bottom of the window in addition to compiling with gcc allows for the use of makefiles and with make and vi to edit. I am sure a few other features are available although these are out of scope for this article. A quick launch sidebar allows the quick reference to C++ Tutorials which open in a separate tab, all good stuff.

LINKS

Below are a few other links and online IDE’s and articles to check out. Happy Coding!

RexTester IDE
Collection of Online Compilers Article
MSVC and C++11 Compatible online compiler
Compile and Execute C++ Code Online on Coding Ground

Categories
API Articles Blog Coders Codex Development JUCE Linux Development Portfolio Programming

Coders Codex::Command Line Arguments Example for JUCE C++

INTRODUCTION

I base this article around the need to pass command line parameters to a running program. Please note this does not seem to work with Windows yet (working in Linux and OSX not tested).

DISCUSSION

The idea is to use a set of command line parameters to execute a set of built in software tests between two or more instances of a given software and then automatically generate unit test reports. The whole thing can be automated via the sequencing of various tests in a bash script or batch file.

//============================================================================
// Name        : Command Line Arguments
// Author      : Divide To Infinity
// Version     : V1.0
// Copyleft    : Divide To Infinity 2015 - GNU GPL v2
// Description : JUCE Command Line Arguments Demo C++11, Ansi-style
//============================================================================

#include "../JuceLibraryCode/JuceHeader.h"

class CommandLineArguments : public JUCEApplication
{
    public:
        CommandLineArguments(){}
        ~CommandLineArguments(){}

        void initialise(const String& commandLine) override
        {
            Logger * log = Logger::getCurrentLogger();
            log->writeToLog(getApplicationName());

            // Now list the command line arguments
            log->writeToLog("See the entered command line parameters below: ");
            log->writeToLog(JUCEApplicationBase::getCommandLineParameters());
        }

        void shutdown() override {}

        const String getApplicationName() override
        {
            return "CommandLineArguments";
        }

        const String getApplicationVersion() override
        {
            return "1.0";
        }

    private:

};

START_JUCE_APPLICATION(CommandLineArguments);

FINDINGS

//============================================================================
// Name        : CommandLineArguments
// Author      : Divide To Infinity
// Version     : V1.0
// Copyleft    : Divide To Infinity 2015 - GNU GPL v2
// Description : JUCE Command Line Arguments Demo C++11, Ansi-style
//============================================================================

#include "../JuceLibraryCode/JuceHeader.h"

using namespace std;

class CommandLineArguments : public JUCEApplication
{
    public:
        CommandLineArguments(){}
        ~CommandLineArguments(){}

        void initialise(const String& commandLine) override
        {
            Logger * log = Logger::getCurrentLogger();
            log->writeToLog(getApplicationName());

            // To get the parameters as an array, you can call JUCEApplication::getCommandLineParameters()

            // Now list the command line arguments
            log->writeToLog("See the entered command line parameters below: ");
            log->writeToLog(JUCEApplicationBase::getCommandLineParameters());
            cout << endl; // Empty line : 0

            // Now lets try and do something with the arguments
            // First use the getCommandLineParameterArray which returns a tokenised array
            // of Command Line args separated by whitespace
            StringArray argTokens = StringArray(JUCEApplicationBase::getCommandLineParameterArray());

            for(int i = 0; i < argTokens.size(); ++i)
            {
                // Print out each arg line by line
                log->writeToLog(argTokens[i]);

                // We can use these args to call methods
                if (argTokens[i] == "-i")
                {
                    cmdTest();
                }
                // Then use args with parameters and error messages
            }

        }

        void cmdTest()
        {
            cout << "cmdTest called" << endl;
        }

        void shutdown() override {}

        const String getApplicationName() override
        {
            return "CommandLineArguments";
        }

        const String getApplicationVersion() override
        {
            return "1.0";
        }

        void unhandledException(const std::exception *, const String &sourceFilename, int lineNumber) override
        {
            // Here we can use this method to catch exceptions and generate reports
        }

    private:

};

START_JUCE_APPLICATION(CommandLineArguments);

LINKS
Command Line Arguments discussion on the JUCE forum
JUCEApplicationBase Class docs

Categories
Articles Blog C++11 Coders Codex Design Patterns Development Featured GNU C++ Languages Linux Development Programming Science & Technology Solution Technology UML

Coders Codex::How to Generate C++ Code from a UML Class Diagram in Linux

INTRODUCTION

UML Class Generated in Dia

DISCUSSION

sudo apt-get install dia dia2code

FINDINGS

LINKS
C++ Code Generation from UML on Stack Overflow

Categories
API Articles Blog C# Coders Codex Creative Computing Development Featured Games Development Graphic Displays IDE Installation Interactive Installation Languages Library London Network OpenGL OpenGL Programming Portfolio Programming Science & Technology Solution Technology Video Visual Studio 2012 Visuals

Coders Codex::Decoding Video Streams to Textures in Unity 3d

INTRODUCTION

Here we will decode an Ogg Theora file streaming from the internet onto a plane surface scripted in Unity 3d.

DISCUSSION

The fastest method to do this as of writing is to look here and then attach this to the camera in a new unity 3d scene.

FINDINGS

The Unity docs do not seem to show a C# source example, so in full Blue Peter (UK) style: Here is one I made earlier.

//============================================================================
// Name        : WWWVideoTexture (Unity 3d)
// Author      : Divide To Infinity
// Version     : V1.0
// Copyright   : GNU GPL v2
// Description : C# Monobehaviour Script for Decoding Video Streams to Texture
//============================================================================

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(GUITexture))]
[RequireComponent(typeof(AudioSource))]
public class WWWVideoTexture : MonoBehaviour
{
    public string url = "http://playground.html5rocks.com/samples/html5_misc/chrome_japan.ogv";
    IEnumerator Start()
    {
        WWW www = new WWW(url);
        MovieTexture movieTexture = www.movie;
        while (!movieTexture.isReadyToPlay)
        {
            yield return null;
        }
        
        GUITexture gt = GetComponent();
        gt.texture = movieTexture;
        transform.localScale = new Vector3(0, 0, 0);
        transform.position = new Vector3(0.1f, 0.25f, 0);

        gt.pixelInset = new Rect(0, 0, movieTexture.width / 2, movieTexture.height / 2);

        AudioSource aud = GetComponent();
        aud.clip = movieTexture.audioClip;
        movieTexture.Play();
        aud.Play();
    }
}

And the screenshot:

WWWVideoTexture.cs in Unity 3d

LINKS

WWW.movie in Unity 3d Scripting API
Video Streaming solutions for Unity3d on Stack Overflow
C# pixelInset problem on UnityAnswers
Streaming Textures in Unity3d
Video Playback Speed Discussion on Unity 3d Forums

Categories
Articles Assembly audio-programming C++11 Coders Codex computer-music Creative Computing Development GNU C++ Languages Mixing Programming

Coders Codex::Reverse Engineering and Binary Auditing Tools

INTRODUCTION

DISCUSSION

This Needs a 64 bit Debugger/Diassembler (Hex Rays IDA Pro)

FINDINGS

LINKS

Binary Auditing Training Material
Detect it Easy Packer Identifier
Cheat Engine Debugger / Disassembler
IDA Pro Disassembler / Debugger 32 and 64 Bit

Categories
Articles Coders Codex GNU C++ Languages Linux Development OpenGL Programming

Coders Codex::Linux GLX Server Side Computation using X Window protocol

441

442

443

Computer Graphics Cover

Contents

ISBN

pg439

pg440

Links

OpenGL programming for X Window

Categories
Creative Computing Development Digital Shamanism DMX Electronics Featured Hardware Installation Interactive Installation Lighting Lighting Trusses Live London Max/MSP MIDI Mind Control Mixing Music Neuroscience NUI Open Sound Control Physical computing Podcast Processing Programming Rear Projection Resolume SK Pang Solution Synthesis Technology Video Visuals

Divide To Infinity Incorporates ‘Mind Biorhythm Dataspace’ with Daksyba Arts Collective

ABOUT
Daksyba are a collective of audio and visual artists from a range
of creative disciplines, combining voice, percussion, strings, didgeridoo, digital sound and video.

Daksyba Performance @ OV London Festival 2013

“Art is mostly experienced as the aftermath of the creative process. It may be composed, rehearsed, performed or recorded and as such it is but a reflection of that process. Improvisation, as a premise, invites the artist and spectator to share a moment and witness art as a unique event as it emerges, truly in the here and now” – Illi Adato, Artistic Director, Art of the Moment.

Art of The Moment is a 2 day event integrating music, dance and visual arts in fresh new ways and re-examining the relationship between the different medium. It is a celebration of art created in the glorious uncertainty of the here and now, deep in the heart of spontaneous composition.

The festival will feature contributions from the likes of the amazing Oren Marshall (collaborations include Radiohead and Charlie Haden), Maggie Nicols, Anton Mobin, Phil Minton, The Irrepressibles, Matt Black (Ninja Tune, Coldcut), h2dance, Mixmaster Morris and many other leading artists in the field.

It takes place in one of London’s most fascinating art hubs, The Albert in Queen’s Park, and is open to everyone to come and enjoy, explore, experience and get involved.
Live stream here

Daksyba - OV London Festival 2013 Interactive Multisensory Playground @ The Albert

LINKS
http://www.thealbert.org.uk/
http://ovlondon.weebly.com/art-of-the-moment.html
http://ovlondon.weebly.com/
Daksyba blog here.
http://video.twicsy.com/i/zrfDf videohackspace
http://ktokradio.com/?p=1082

Categories
Blog Creative Computing Development Downloads DSP Electronics FAQ Featured Filters Graphic Displays Hardware Installation Interactive Installation Lectures Library Lighting London MIDI Music Network Open Sound Control Physical computing Podcast Portfolio Programming Science & Technology SK Pang Synthesis Technology Tutorial Visuals

Divide To Infinity – Advanced Audiovisual Processing with OpenFrameWorks C++ Libraries

MIDI Maximilian Scope Synth

This program requires the use of a MIDI controller to work – compiled example can be found in the /bin folder. This requires .NET framework 4 (not 4.5) and Visual Studio 2010 libraries to be installed if you are on Windows. The program features a scope adapted from the ofxMaxim example in OpenFrameWorks and comprises of a mono legato triggering synthesizer. Filter cutoff is controlled by momentary on velocity switching and oscillator gate is permanantely on due to having no ADSR and quick and dirty MIDI triggering logic.

Bubblesort:

This program fills an array with random values based on the screen height and iterates through sending the value to a sawtooth oscillator. This implements switch cases – pressing 1 will Bubblesort the array to give a saw glissandi – while pressing 2 will randomise the array data again.

EEG Maximilian:

This was intended to be the main project however due to the nature of how the Emotiv headset examples are organised, I was sadly unable to suitably map the functionality to the way that OpenFrameWorks operates – this code is provided only as a means to see where I am with implementing this. The majority of the code is cut up examples from the emotiv library mixed in with MIDI and Maximilian.

MIDI Example:

I have modified this code slightly from the original supplied by the ofxMidi author Chris O’Shea. I added to the example by listing all MIDI ports by pressing ‘l’ for list and changing midi ports on the fly using a switch case with numeric input for easy testing.

videoPlayerTestModified:

This is a simple test to see how well the Quicktime library works on windows 7 x64, I simply looked into the API and set up a few cases by pressing 1,2,3 and 4 – video play speed, pause and play direction. Sadly this not work with my original video which had a higher bandwidth (had an error code -50 – I could not find the solution anywhere) so this uses the standard ‘fingers’ video.

The link to all of the above source code and materials can be found here.

Unzip these archives into your ‘myApps’ directory in OpenFrameworks.

For more info on OpenFrameWorks and creative coding as an art form, go here.

If you are on Windows, you can execute the debug app in the ‘bin’ folder provided you have all the correct Microsoft C++ Redistributable installed.

Precomplied versions of all projects can be found in their associated /bin folder for easy testing.

Categories
Arduino Creative Computing DMX Electronics Interactive Installation Physical computing SK Pang Termination

Howto: Build a DMX Terminator

DMX512 terminators are easy to build; you need no more than a 5 pin XLR plug, a 120 ohm resistor, and a little time. Holding on to them once you’ve built them is the hard part. Get down to the local DIY store and buy a engraving tool, and engrave the fact that this plug is a terminator, and that it belongs to you clearly on it. You’ll still “lose” them, but at least after a few years you’ll be seeing your terminators around the place, and be able to grab them back!

The only outstanding question is what power the 120R resistor should be? In the photo below, the resistor shown is a quarter watt jobbie, chosen primarily because it looked nice for the photo. Human nature being what it is, the previous set of instructions said use a quarter watt resistor, cos that is what I was looking at whilst writing up the page.

Categories
HTML5 Video

HTML5 Video

Until now, there has not been a standard for showing a video/movie on a web page.

Today, most videos are shown through a plug-in (like flash). However, different browsers may have different plug-ins.

HTML5 defines a new element which specifies a standard way to embed a video/movie on a web page: the element.

Categories
Ableton Live 9 Hardware Kore 2 Live MIDI Mixing Solution Synthesis Tutorial

Mix Codex::Kore 2 User pages ‘jumping’ / changing when moving knobs to adjust sound parameters

I have been delving ‘under the hood’ with Native Instruments Kore 2 lately and I am having a problem with the hardware. Quite frequently I will be editing a parameter with the knobs and the user page switches to a different page. Obviously this is annoying as I am then editing the wrong parameter!

I am guessing you may have found this page as you are having the same problem? Well, you are in luck! Check out the solution below.

 

 

 

 

 

Solution/Workaround: This is definitely an electrical interference problem which is not alone solved with good earth as discussed in this thread (I checked with a multimeter). When touching and/or moving encoders be sure to make contact with the aluminium housing (I usually just rest my hand on the base of the controller) and this will dissipate the interference.

Alternatively, you could also make something to fit the kensington lock on the controller which conducts to the computer case or similar. Also worth noting is the quality of cables used and are any of them close to higher voltage wires (shielding issues).

On a similar note here is a video discussing the use of footswitches:

Categories
Articles Blog DAW Software Downloads MIDI Mix Codex Mixing Music Native Instruments Maschine

FXpansion BFD2 template for Native Instruments Maschine

Native Instruments Maschine has excellent drum pads, so here is a simple ‘drummer perspective’ Maschine template for BFD2.