- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# Infinity API

### 1.0.1

## Licence

The Infinity API is licenced to you, the end user under the terms and conditions defined in the licence document found in the 'Documentation' folder.
If you did not recieve a copy of the licence with this source code, please refer to http://www.expdigital.co.uk

## Dedications / Thanks

The Infinity API would not exist without the help and support of several people:
First there are our long suffering other halves - Cathy and Jo. You are both absolute stars! Thanks for putting up with all the late nights, missed dinners and for reminding us to eat and sleep!
Secondly a big thank you has to go out to all the staff at FXpansion, and a specific mention for SKot McDonald, who has helped in so many ways that its impossible to list them all. He is a king amongst men.
Thanks also go to all the guys and gals who have supported us and given us kind words of encouragment. There are too many to list all of them but a couple deserve specific mention:
Quinn Capen (API beta tester extrordinaire!)
Mully and The Betabugs crew
The KVR Developers forum
And finally a big thanks to everyone who downloads and uses Infinity!

## Introduction

The Infinity API is a cross platform (OSX, Win32) toolkit
It is divided in to a series of libraries to enable easy maintainence and to ensure that projects can be built with the minimum amount of extra source code.
The foundation library, upon which all other libraries depend is ECore. The is the primary library and as such it provides those generic classes that are most required when developing applications.
Note that this does not include any Graphical-Interface classes. These are handled by a seperate library (EGUI).
Project structure
Each library is subdivided in to a set of namespaces. Each namespace is also contained within a corresponding folder. So, for example, if a class is contained inside the 'Host' namespace it will be found in a folder named 'Host' as-well.
For example, ECore contains the following namespace / folders:

- Basics - The highest level folder in the entire API. Defined within this namespace are high level of objects that handle class implementation issues, string handling, class managment and wrappers around the built in C++ types
- Collections - Templated object containers, as well as auto pointers and template deletion handlers
- Exceptions - Classes for handlign and throwing exceptions
- Host - Classes to enable interfacing within the host in a cross platform manner. This class enables the programmer to access host OS information as well as interogation of the file systems, graphics system (also see EGUI) etc
- IO - File and disk i/o streams
- MathTools - Mathematical routines
- Testing - Classes for quick and easy debugging and testing of code
- Threading - Threads, critical sections etc

The Infinity API is based around a class management system. This is one of the most important features of the API's. A good place to start when first learning the use of the API is to take a look at the Basics namespace
This namespace features several objects that should be fully understood before any other objects are looked at. They are:

See also:
  Exponent::Basics::ICountedObject

  Exponent::Basics::CClass

## Other Libraries in the Infinity API

There are several other parts to the Infinity API, that is:

- EGUI - This library provides the graphical sub system for the Infinity API and allows you to create windows, make controls, load images etc
  The EGUI library is based around the idea of multiple lightweight 'controls'. Each control is a simple class that extends the IControl interface. Every control has to sit inside an IControlRoot. This interface provides a 'hook' between the actual window
  that is hosting the application and the controls underneath. To group panels together you can use CControlPanel which inherits from both IControlRoot and IControl to give a control that can host other controls. Generally if you want to implement a special type of control grouping you will inherit from CControlPanel.
  Controls have a generic drawing function, that is passed a CGraphics object. This is the actual graphics context that doesnt the cross platform drawing. In the EGUI framework all drawing is done using the 'double buffering' technique, meaning that there is no flicking or glitching when performing multiple drawing calls.
  For most of the functionality of the framwork to function, we have implemented several types of 'listener'. A listener is a delegate object that is notified of an event having occurred, such as mouse movement, changes to the host window etc.
  Each of these events has its own specific type and its own corresponding listener. This design decision gives you the knowledge that you are handling one single case inside a delegate function.
- EMUSIC - This library provides routines for audio and midi load and save as well as computations around musical values
- EVST - The EVst library provides wrappers and helper classes around the Steinberg VST2.4 (!) plug-in specification.
  It expects the VST project files as supplied by Steinberg to be located in the "Third Party" folder. Simply follow the directions in the Source folder.
  Unlike other Infinity API libraries it is not split in to sub namespaces. This is because of the parsity of the classes

## Pointers and management in the Infinity API

It is worth pointing out that in the Infinity API all pointers to ICountedObjecteds are reference counted. You shouldnt ever directly delete a reference counted object
instead, use the macro FORGET_COUNTED_OBJECT. This has an important implication for the function headers:
If a function takes a pointer to a counted object you can assume that this object is being reference counted. In this case *never* pass is an address of a local variable

     // Say we have a function like this that takes a pointer to a counted object
     void foo(CCountedObject *object)

     // If you call it with the address of a local variable then potentially a non dynamic variable will be deleted
     CCountedObject myObject;
     foo(&myObject);                    // << NEVER, EVER, EVER do this!

     // The correct way to handle it is like this
     CCountedObject *myObject = new CCountedObject;
     myObject->referenced();            // << We want to remember this object for the time being
     foo(myObject);                 // << DO do this!
     // Do something else with myObject
     // ...
     // ...
     FORGET_COUNTED_OBJECT(myObject);

However, if a function takes the address of a variable, then you are safe to pass in a local variable:

     // Takes an address
     void foo(const CCountedObject &object);

     // Then you are safe to do both
     CCountedObject myObject;
     foo(myObject);

     // And
     CCountedObject *myObject = new CCountedObject;
     foo(*myObject);
     // Do something else with myObject
     // ...
     // ...
     FORGET_COUNTED_OBJECT(myObject);

When storing a counted object, always make sure that you reference the new copy and dereference the old pointer. We have a handy macro for this: EXCHANGE_COUNTED_OBJECTS

     void foo(CCountedObject *object)
     {
         EXCHANGE_COUNTED_OBJECTS(myObject, object);        // << Dereferences myObject, stores object in myObject pointer and references object
     }

See also:
  FORGET_COUNTED_OBJECT

  EXCHANGE_COUNTED_OBJECTS

## Support and Help

Please direct all comments about the code to our developers support forum on our website:
http://support.expdigital.co.uk
We hope that you enjoy using the Infinity API
Team Exponent

## Version History

Version 1.0.1 - Maintenance release, adding several new features and fixing a couple of small bugs

- Added VST 2.4 Support
- Added drawing support for Composted windows on OSX
- Added PNG Image support
- Updated CKnob::onDoubleClick to send action event
- Fixed several documentation bugs / typos
- Improved windows GDI+ startup and shutdown to only occur during graphics object startup and shutdown
- Improved windows menu drawing code (should be much quicker with sub menus now)
- Improved windows font sizing (they are now true typographic Postscript point sizes now!)

Version 1.0.0 - Initial release