Permalink
Browse files

Merge branch 'work/dot-rocket'

  • Loading branch information...
2 parents d8081fd + 3f7a4a7 commit 65c5c62e89649e71356bc50ca066447db67e29f6 @kusma committed Apr 18, 2011
@@ -0,0 +1,63 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DotRocket", "DotRocket\DotRocket.vcproj", "{C982166A-686F-4BAD-9370-62DADC1DCCD0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DotRocketClient", "DotRocketClient\DotRocketClient.vcproj", "{711C0884-4DCF-47AA-87D6-B643F15A6727}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example", "example\example.csproj", "{B0E542E8-D483-40EE-995D-BCF58C0793B7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|Win32 = Debug|Win32
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|Win32 = Release|Win32
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Debug|Win32.Build.0 = Debug|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Debug|x86.ActiveCfg = Debug|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Release|Any CPU.ActiveCfg = Release|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Release|Win32.ActiveCfg = Release|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Release|Win32.Build.0 = Release|Win32
+ {C982166A-686F-4BAD-9370-62DADC1DCCD0}.Release|x86.ActiveCfg = Release|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Debug|Win32.ActiveCfg = Debug|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Debug|Win32.Build.0 = Debug|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Debug|x86.ActiveCfg = Debug|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Release|Any CPU.ActiveCfg = Release|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Release|Mixed Platforms.Build.0 = Release|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Release|Win32.ActiveCfg = Release|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Release|Win32.Build.0 = Release|Win32
+ {711C0884-4DCF-47AA-87D6-B643F15A6727}.Release|x86.ActiveCfg = Release|Win32
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|Any CPU.Build.0 = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|Win32.ActiveCfg = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|x86.ActiveCfg = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Debug|x86.Build.0 = Debug|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Release|Any CPU.ActiveCfg = Release|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Release|Mixed Platforms.Build.0 = Release|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Release|Win32.ActiveCfg = Release|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Release|x86.ActiveCfg = Release|x86
+ {B0E542E8-D483-40EE-995D-BCF58C0793B7}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,40 @@
+#include "stdafx.h"
+
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute("DotRocket")];
+[assembly:AssemblyDescriptionAttribute("")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("Microsoft")];
+[assembly:AssemblyProductAttribute("DotRocket")];
+[assembly:AssemblyCopyrightAttribute("Copyright (c) GNU Rocket Foundation 2011")];
+[assembly:AssemblyTrademarkAttribute("")];
+[assembly:AssemblyCultureAttribute("")];
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the value or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
+
+[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
@@ -0,0 +1,46 @@
+// This is the main DLL file.
+
+#include "stdafx.h"
+
+#include "DotRocket.h"
+
+#include "../../../sync/sync.h"
+#include "../../../sync/track.h"
+
+using System::Runtime::InteropServices::Marshal;
+using DotRocket::Track;
+using DotRocket::PlayerDevice;
+
+private ref class PlayerTrack: public Track {
+ const sync_track *track;
+public:
+ PlayerTrack(const sync_track *track): track(track) {}
+ virtual float GetValue(double time) override
+ {
+ return sync_get_val(track, time);
+ };
+};
+
+PlayerDevice::PlayerDevice(System::String ^name)
+{
+ char *cname = (char *)(void *)Marshal::StringToHGlobalAnsi(name);
+ device = sync_create_device(cname);
+ tracks = gcnew Dictionary<String ^, Track ^>();
+}
+
+Track ^PlayerDevice::GetTrack(String^ name)
+{
+ Track ^track;
+ if (!tracks->TryGetValue(name, track)) {
+ char *ctrackName = (char *)(void *)Marshal::StringToHGlobalAnsi(name);
+ track = gcnew PlayerTrack(sync_get_track(device, ctrackName));
+ Marshal::FreeHGlobal((System::IntPtr)ctrackName);
+ tracks->Add(name, track);
+ }
+ return track;
+}
+
+PlayerDevice::!PlayerDevice()
+{
+ sync_destroy_device(device);
+}
@@ -0,0 +1,52 @@
+// 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;
+ };
+}
Oops, something went wrong.

0 comments on commit 65c5c62

Please sign in to comment.