82 lines
No EOL
1.3 KiB
C#
82 lines
No EOL
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
|
|
namespace DMX2
|
|
{
|
|
public class UniversDMX
|
|
{
|
|
|
|
static int nb=1;
|
|
|
|
public UniversDMX()
|
|
{
|
|
Nom = "Univers DMX n°"+ nb++.ToString();
|
|
}
|
|
|
|
Dimmer[] _dimmers = new Dimmer[512];
|
|
|
|
bool[] allumageForce = new bool[512];
|
|
|
|
public bool[] AllumageForce {
|
|
get {
|
|
return allumageForce;
|
|
}
|
|
}
|
|
public string Nom;
|
|
public enum FTransfer {
|
|
lineaire,
|
|
log,
|
|
exp
|
|
}
|
|
public struct Dimmer {
|
|
public Circuit circuitAssocié;
|
|
public FTransfer fonctionTransfert;
|
|
public float param1; // Paramètres pour fonction de transfert
|
|
public float param2;
|
|
}
|
|
|
|
public Dimmer[] Dimmers {
|
|
get
|
|
{
|
|
return _dimmers;
|
|
}
|
|
}
|
|
|
|
public void Save ()
|
|
{
|
|
}
|
|
public void Load ()
|
|
{
|
|
}
|
|
|
|
public void CalculUnivers(int[] valeurs)
|
|
{
|
|
Dimmer g;
|
|
Debug.Assert(valeurs.Length == _dimmers.Length);
|
|
for(int i = 0 ; i<512; i++)
|
|
{
|
|
if(allumageForce[i]) {
|
|
valeurs[i] = 128;
|
|
break;
|
|
}
|
|
|
|
g= _dimmers[i];
|
|
|
|
switch (g.fonctionTransfert) {
|
|
case FTransfer.lineaire:
|
|
valeurs[i] = g.circuitAssocié.ValeurCourante;
|
|
break;
|
|
case FTransfer.log:
|
|
break;
|
|
case FTransfer.exp:
|
|
break;
|
|
default:
|
|
throw new ArgumentOutOfRangeException ();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
} |