Merge branch 'work/dot-rocket'

This commit is contained in:
Erik Faye-Lund 2011-04-18 22:14:38 +02:00
commit 65c5c62e89
24 changed files with 1399 additions and 0 deletions

View File

@ -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

View File

@ -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)];

View File

@ -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);
}

View File

@ -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;
};
}

View File

@ -0,0 +1,229 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="DotRocket"
ProjectGUID="{C982166A-686F-4BAD-9370-62DADC1DCCD0}"
RootNamespace="rocket"
Keyword="ManagedCProj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
ManagedExtensions="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\Release\sync_player.lib"
GenerateDebugInformation="true"
AssemblyDebug="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
ManagedExtensions="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\..\..\Release\sync_player.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\AssemblyInfo.cpp"
>
</File>
<File
RelativePath=".\DotRocket.cpp"
>
</File>
<File
RelativePath=".\Stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\DotRocket.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\Stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// DotRocket.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@ -0,0 +1,7 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once

View File

@ -0,0 +1,3 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

View File

@ -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("DotRocketClient")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("Microsoft")];
[assembly:AssemblyProductAttribute("DotRocketClient")];
[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)];

View File

@ -0,0 +1,88 @@
// This is the main DLL file.
#include "stdafx.h"
#include "../../../sync/sync.h"
#include "../../../sync/track.h"
using System::Runtime::InteropServices::Marshal;
#include "DotRocketClient.h"
using DotRocket::Track;
using DotRocket::Device;
using DotRocket::ClientDevice;
private ref class ClientTrack: public Track {
const sync_track *track;
public:
ClientTrack(const sync_track *track) : track(track) {}
virtual float GetValue(double time) override
{
return sync_get_val(track, time);
};
};
ref class Callbacks {
public:
static Device ^DeviceCurrenltyBeingProcessed = nullptr;
};
void cb_pause(void *arg, int row)
{
Callbacks::DeviceCurrenltyBeingProcessed->Pause(row);
}
void cb_set_row(void *arg, int row)
{
Callbacks::DeviceCurrenltyBeingProcessed->SetRow(row);
}
int cb_is_playing(void *arg)
{
return !!Callbacks::DeviceCurrenltyBeingProcessed->IsPlaying();
}
sync_cb callbacks[] = {
cb_pause,
cb_set_row,
cb_is_playing
};
ClientDevice::ClientDevice(System::String^ name)
{
char *cname = (char *)(void *)Marshal::StringToHGlobalAnsi(name);
device = sync_create_device(cname);
tracks = gcnew Dictionary<String^, Track^>();
}
Track ^ClientDevice::GetTrack(String^ name)
{
Track ^track;
if (!tracks->TryGetValue(name, track)) {
char *ctrackName = (char *)(void *)Marshal::StringToHGlobalAnsi(name);
track = gcnew ClientTrack(sync_get_track(device, ctrackName));
Marshal::FreeHGlobal((System::IntPtr)ctrackName);
tracks->Add(name, track);
}
return track;
}
ClientDevice::!ClientDevice()
{
sync_destroy_device(device);
}
bool ClientDevice::Connect(System::String^ host, unsigned short port)
{
char *chost = (char *)(void *)Marshal::StringToHGlobalAnsi(host);
int result = sync_connect((sync_device *)device, chost, port);
Marshal::FreeHGlobal((System::IntPtr)chost);
return !result;
}
bool ClientDevice::Update(int row)
{
Callbacks::DeviceCurrenltyBeingProcessed = this;
return !sync_update(device, row, callbacks, device);
}

View File

@ -0,0 +1,24 @@
// DotRocketClient.h
#pragma once
struct sync_device;
struct sync_track;
using namespace System;
using namespace System::Collections::Generic;
namespace DotRocket {
public ref class ClientDevice: public Device {
protected:
sync_device *device;
Dictionary<System::String ^, Track ^> ^tracks;
public:
ClientDevice(System::String ^name);
~ClientDevice() { this->!ClientDevice(); }
!ClientDevice();
virtual Track^ GetTrack(String ^name) override;
virtual bool Connect(System::String ^host, unsigned short port) override;
virtual bool Update(int row) override;
};
}

View File

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="DotRocketClient"
ProjectGUID="{711C0884-4DCF-47AA-87D6-B643F15A6727}"
RootNamespace="rocket"
Keyword="ManagedCProj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
ManagedExtensions="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;..\..\..\Release Client\sync_player.lib&quot;"
GenerateDebugInformation="true"
AssemblyDebug="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
ManagedExtensions="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;..\..\..\Release Client\sync_player.lib&quot;"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
<AssemblyReference
RelativePath="System.dll"
AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.Data.dll"
AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
MinFrameworkVersion="131072"
/>
<AssemblyReference
RelativePath="System.XML.dll"
AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
MinFrameworkVersion="131072"
/>
<ProjectReference
ReferencedProjectIdentifier="{C982166A-686F-4BAD-9370-62DADC1DCCD0}"
RelativePathToProject=".\DotRocket\DotRocket.vcproj"
/>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\AssemblyInfo.cpp"
>
</File>
<File
RelativePath=".\DotRocketClient.cpp"
>
</File>
<File
RelativePath=".\Stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\DotRocketClient.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
<File
RelativePath=".\Stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// DotRocketClient.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@ -0,0 +1,7 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once

View File

@ -0,0 +1,3 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

View File

@ -0,0 +1,161 @@
using SlimDX;
using SlimDX.Direct3D11;
using SlimDX.DXGI;
using SlimDX.Windows;
using SlimDX.XAudio2;
using SlimDX.Multimedia;
using DotRocket;
using Device = SlimDX.Direct3D11.Device;
using Resource = SlimDX.Direct3D11.Resource;
using XAudio2 = SlimDX.XAudio2.XAudio2;
using XWMAStream = SlimDX.Multimedia.XWMAStream;
namespace example
{
static class Program
{
const float bpm = 150.0f; // beats per minute
const int rpb = 8; // rows per beat
const double rowRate = (bpm / 60.0) * rpb;
static bool playing = true;
static SourceVoice sourceVoice;
static AudioBuffer audioBuffer;
static XWMAStream stream;
static long samplesBias = 0;
static void Pause(bool flag)
{
if (flag)
{
sourceVoice.Stop();
}
else
{
sourceVoice.Start();
}
playing = !flag;
}
static void SetRow(int row)
{
double time = row / rowRate;
// Stop and restart voice at different location. This is a bit nasty,
// but it seems to work.
sourceVoice.Stop();
sourceVoice.FlushSourceBuffers();
// Seek the stream back to start, and change PlayBegin. Seeking directly
// in the stream does not seem to work.
stream.Seek(0, System.IO.SeekOrigin.Begin);
audioBuffer.PlayBegin = (int)(time * stream.Format.SamplesPerSecond);
if (stream.Format.FormatTag == WaveFormatTag.WMAudio2)
{
// Ruond off play-position to the closest 128 samples. If we don't,
// the nice gentlemen gets upset or something. (AKA the documentation
// says so. It doesn't seem to cause any harm in reality, though)
audioBuffer.PlayBegin = (int)System.Math.Floor(audioBuffer.PlayBegin * 128 + 0.5) / 128;
}
// Ngh. Even though the documentation says that the voice counters should
// be reset if FlushSourceBuffers is called after Stop, guess what? They
// arent! So let's keep track of how far off it is.
samplesBias = sourceVoice.State.SamplesPlayed - audioBuffer.PlayBegin;
// Submit data, and restart if needed
sourceVoice.SubmitSourceBuffer(audioBuffer, stream.DecodedPacketsInfo);
if (playing)
{
sourceVoice.Start();
}
}
static bool IsPlaying()
{
return playing;
}
static void Main()
{
var form = new RenderForm("DotRocket/SlimDX example");
var description = new SwapChainDescription()
{
BufferCount = 1,
Usage = Usage.RenderTargetOutput,
OutputHandle = form.Handle,
IsWindowed = true,
ModeDescription = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm),
SampleDescription = new SampleDescription(1, 0),
Flags = SwapChainFlags.AllowModeSwitch,
SwapEffect = SwapEffect.Discard
};
// Setup rendering
Device device;
SwapChain swapChain;
Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.None, description, out device, out swapChain);
RenderTargetView renderTarget;
using (var resource = Resource.FromSwapChain<Texture2D>(swapChain, 0))
renderTarget = new RenderTargetView(device, resource);
var context = device.ImmediateContext;
var viewport = new Viewport(0.0f, 0.0f, form.ClientSize.Width, form.ClientSize.Height);
context.OutputMerger.SetTargets(renderTarget);
context.Rasterizer.SetViewports(viewport);
// Prevent alt+enter (broken on WinForms)
using (var factory = swapChain.GetParent<Factory>())
factory.SetWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAltEnter);
// Setup audio-streaming
XAudio2 xaudio2 = new XAudio2();
stream = new XWMAStream("tune.xwma");
MasteringVoice masteringVoice = new MasteringVoice(xaudio2);
sourceVoice = new SourceVoice(xaudio2, stream.Format);
audioBuffer = new AudioBuffer();
audioBuffer.AudioData = stream;
audioBuffer.AudioBytes = (int)stream.Length;
audioBuffer.Flags = BufferFlags.EndOfStream;
sourceVoice.SubmitSourceBuffer(audioBuffer, stream.DecodedPacketsInfo);
sourceVoice.Start();
// Setup DotRocket
#if DEBUG
DotRocket.Device rocket = new DotRocket.ClientDevice("sync");
rocket.OnPause += Pause;
rocket.OnSetRow += SetRow;
rocket.OnIsPlaying += IsPlaying;
rocket.Connect("localhost", 1338);
#else
DotRocket.Device rocket = new DotRocket.PlayerDevice("sync");
#endif
// Get our belowed tracks!
DotRocket.Track clear_r = rocket.GetTrack("clear.r");
DotRocket.Track clear_g = rocket.GetTrack("clear.g");
DotRocket.Track clear_b = rocket.GetTrack("clear.b");
MessagePump.Run(form, () =>
{
// Hammertime.
double row = ((double)(sourceVoice.State.SamplesPlayed - samplesBias) / stream.Format.SamplesPerSecond) * rowRate;
// Paint some stuff.
rocket.Update((int)System.Math.Floor(row));
context.ClearRenderTargetView(renderTarget, new Color4(
clear_r.GetValue(row),
clear_g.GetValue(row),
clear_b.GetValue(row)));
swapChain.Present(0, PresentFlags.None);
});
// clean up all resources
// anything we missed will show up in the debug output
renderTarget.Dispose();
swapChain.Dispose();
device.Dispose();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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: AssemblyTitle("DotRocket Example")]
[assembly: AssemblyDescription("GNU Rocket Example for DotNet")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GNU Rocket Foundation")]
[assembly: AssemblyProduct("GNU Rocket")]
[assembly: AssemblyCopyright("Copyright © GNU Rocket Foundation 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1e7bf32b-89ee-4e48-91ee-9008f83c7947")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4206
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace example.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("example.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4206
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace example.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B0E542E8-D483-40EE-995D-BCF58C0793B7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>example</RootNamespace>
<AssemblyName>example</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<StartupObject>example.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="SlimDX, Version=2.0.11.43, Culture=neutral, PublicKeyToken=b1b0c32fd1ffe4f9, processorArchitecture=x86" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DotRocketClient\DotRocketClient.vcproj">
<Project>{711C0884-4DCF-47AA-87D6-B643F15A6727}</Project>
<Name>DotRocketClient</Name>
</ProjectReference>
<ProjectReference Include="..\DotRocket\DotRocket.vcproj">
<Project>{C982166A-686F-4BAD-9370-62DADC1DCCD0}</Project>
<Name>DotRocket</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.