Application Development Interface for Autogam


What is it ?

How I do ?

API Reference

Example

Download pluggam.zip

What is it ?

AutoGam can also help you add sound to your application, with it you can :

Some uses :

There are three main functions : AutoGamInit, AutoGamPlay, AutoGamKill. Actually the API is for C++, but you can adapt it for another langage.

 

How do I use it ?

  1. First download pluggam.zip.
  2. Unzip it in your development directory, you will find :
pluggam.lib Libraries for pluggam. Link with your application
pluggam.h Declaration for pluggam, include it in your source code (C or C++)
pluggam.dat This file contains declarations of all object. Don't modify it ! It must go in the directory with your GAM file. This file is read when you call AutoGamInit. You must distribute this file with your application.

 

 

 

API Reference

All functions returns 0 if error detected.

int AutoGamInit (char *path)

Initialisation of Autogam, one executable call.

path

directory for your GAM file. You must put all your GAM files in this directory and the file pluggam.dat.

Example : "." or ".\\Music" don't forget double \ if your langage is C or C++

 

int AutoGamKill()

Kill Autogam, one executable call.

If you want play another gam file you must call AutoGamInit

 

int AutoGamPlay(UINT hDevice, char *file)

Load and play music, call as you want but you must call AutoGamInit before

hDevice

Handle of midi device. If you don't to want select it, set this parameter to -1. Autogam will select the most interesting device for you.

file

Name of your GAM file.

GAM file must be constructed using Autogam. Download it !

Example : "ballade.gam"

 

int AutoGamVolume(long volglob, long volpercu)

Set volume for music and percussion

volglob

Volume of note, 0 to 100

volpercu

Volume for percussion

 

int AutoGamStop()

Stop the music

 

int AutoGamTempo(DWORD beat)

Modify the tempo of the music

beat

Value between 10 to 6000

 

int AutoGamSleep(DWORD sleep)

By default, all midi events are treated with a delta-time of 10 ms, but you can change this delay with this function. If you set a too big a value, music is distorted.

sleep

Value between 10 to 6000

 

HANDLE AutoGamFind(char *nomalgo, char *nomobjet)

This function is useful for modifying object properties in real-time. First you get handle of object with AutoGamFind function, then you use AutoGamValue to modify value of object. Returns 0 if the object is not found, verifies algo name and object name, which are case sensitive.

If you open another GAM file you must get a new handle

nomalgo

Algo name which contains the object :

Example : "Algo 1"

nomobjet

Object name you want to find

Example : "Sequ1"

 

 

int AutoGamValue(HANDLE objet, short entry, short value)

This function is useful for modifying object properties in real-time.

First you get handle of object with AutoGamFind function, then you use AutoGamValue to modify value of the object. If you modify an entry connected with another object, the connection is deleted and a static value is used.

If you open another GAM file you must get another handle

objet

Handle of object

entry

Number of entry, from 0 to max entry -1, run Autogam to see number of entry. First entry is 0.

value
Value to set, run Autogam to see value limit. Exceeding the value limit will cause unpredictable results !

 

Example

// Handle modif de la musique

HANDLE AGModif[3];

AutoGamInit(".\\musique");

AutoGamPlay(-1, "Balade.gam");

AGModif[0] = AutoGamFind("Algo 2", "Not1");

AGModif[1] = AutoGamFind("Algo 2", "Not2");

AGModif[2] = AutoGamFind("Algo 2", "Not3");

... treatment ...

AutoGamValue(AGModif[0], 3, x);

AutoGamValue(AGModif[1], 3, y);

AutoGamValue(AGModif[2], 3, z);

... treatment ...

AutoGamKill();

 

Go home