Anders Knive Lassen a5e224713a contrib: add .net bindings
DotRocket is a C++/CLI assembly that binds the C-api to Managed
objects for .NET.
2011-04-16 13:47:31 +02:00

53 lines
1.2 KiB
C++

// DotRocket.h
#pragma once
struct sync_device;
struct sync_track;
using namespace System;
using namespace System::Collections::Generic;
namespace DotRocket
{
public ref class Track abstract
{
public:
virtual float GetValue(double time) = 0;
};
public delegate void PauseEventHandler(bool flag);
public delegate void SetRowEventHandler(int row);
public delegate bool IsPlayingEventHandler();
public ref class Device abstract
{
public:
virtual bool Update(int row) { return true; }
virtual bool Connect(System::String ^host, unsigned short port)
{
throw gcnew Exception("Connect() not valid on this type of DotRocket.Device");
}
virtual Track^ GetTrack(String ^name) = 0;
event PauseEventHandler ^OnPause;
event SetRowEventHandler ^OnSetRow;
event IsPlayingEventHandler ^OnIsPlaying;
void Pause(bool flag) { OnPause(flag); }
void SetRow(int row) { OnSetRow(row); }
bool IsPlaying() { return OnIsPlaying(); }
};
// Player-specific implementation
public ref class PlayerDevice: public Device
{
sync_device *device;
Dictionary<String ^, Track ^> ^tracks;
public:
PlayerDevice(System::String ^name);
~PlayerDevice() { this->!PlayerDevice(); }
!PlayerDevice();
virtual Track^ GetTrack(String ^name) override;
};
}