-2

みなさん、こんにちは。

まず、Delphi 7を使用しています。コンピューターは、USBポートを介して「Velleman部品番号VM116」に接続されており、コントローラーのDMX出力に2つのDMXLEDライトが接続されています。

K8062d.dllライブラリを実行可能ファイルと同じフォルダに配置しましたが、ライトを応答させることに近づいていません。難しいのは、24チャンネルの照明デスクで照明を制御するのに苦労したことを考えると、このコントローラーは図形をフォームにドロップするのと同じくらい簡単なはずです。

とにかく、ここにサンプルコードがあります...

unit chaser_control;

interface

type
  rgb=(
    c_red,
    c_green,
    c_blue);

  dmx_offset:array[rgb] of integer=(
    1,
    2,
    3);

  dmx_class=class(tobject)

    constructor create;
    destructor demolish;

    procedure initialise;
    procedure finish;

    procedure set_channel(
      can_dmx:integer;
      channel:rgb;
      c:integer);

  end;

var
  can:dmx_class;

implementation

// these four external procedures are all that is necessary to address and
// write to any of the 512 DMX channels in the chain

procedure StartDevice; stdcall; external 'K8062d.dll';
procedure SetData(Channel: Longint ; Data: Longint); stdcall; external 'K8062d.dll';
procedure SetChannelCount(Count: Longint); stdcall; external 'K8062d.dll';
procedure StopDevice; stdcall; external 'K8062d.dll';

  //
  // dmx control
  //

constructor dmx_class.create;
begin
  inherited;

  // the dmx controller is started once when this class is instantiated
  initialise;
end;

destructor dmx_class.demolish;
begin
  // the dmx controller is closed down when this class is destroyed
  finish;

  inherited;
end;

procedure dmx_class.initialise;
begin
  // call the device DLL
  StartDevice;

  // allocate 5 channels for led can [two channels are not used]
  SetChannelCount(5);

  // make sure that channel 1 is set to zero [i never use this channel, 
  // on the lighting desk it is set to zero]
  SetData(1,0);
end;

procedure dmx_class.finish;
begin
  // this procedure is called once

  StopDevice;
end;

  //
  // can control
  //

procedure dmx_class.set_channel(
  can_dmx:integer;
  channel:rgb;
  c:integer);
var
  l1,l2:longint;
begin
  // l1 and l2 are longint variables as the arguments passed to the 
  // DLL are longint even though the data is actually 8 bit

  l1:=can_dmx+dmx_offset[channel];
  l2:=c;
  SetData(l1,l2);
end;

begin
  // example call to change the green channel on a can with dmx address 1
  // simply assume that 'can' is not created automatically at startup
  can:=dmx_class.create;
  can.set_channel(1,c_green,240);
  // and so on
  can.free;
end.

緑のチャンネルが240に設定されている場合、何も起こりません。照明デスクから制御できるため、ライトは正常です。また、MIDIショーコントロールを使用して作成した他のソフトウェアでも言ったように。ただし、show controlの問題は、7ビットに制限されていることです。そのため、この新しいデバイスを機能させる必要があります。

TIA

アンドリュー

4

2 に答える 2

3
  1. (を呼び出すことができるようにするために)Destroy; override;の代わりに使用する必要があります。demolishcan.Free

  2. cdecl代わりに試してみましたstdcallか?

  3. 呼び出しdmx_class.finish = StopDeviceによってデバイスが停止する可能性があります。そのため、アプリケーションを終了する前に、何かが発生するのを待つ必要があります。おそらく、デバイスが非常に速く閉じられて、動作していないことがわかります。

于 2012-01-20T15:22:38.263 に答える
0

OK、Vellemanから回答を得ました。また、K8062e.exeとFASTTime32.dllの両方、およびK8062D.dllをアプリケーションと同じフォルダーに含める必要があります。アンドリュー

于 2014-02-24T18:24:52.743 に答える