Skip to content

Commit

Permalink
update to link 3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO committed Mar 6, 2018
1 parent 6b8b6c3 commit 7c7b996
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "link"]
path = AbletonLink-vvvv/link
url = git://github.com/Ableton/link.git
25 changes: 25 additions & 0 deletions AbletonLinkDLL/AbletonLinkDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,31 @@ extern "C" {
link->enable(bEnable);
}


void startPlaying(void* ptr)
{
MyAbletonLink* link = static_cast<MyAbletonLink*>(ptr);
link->startPlaying();
}

void stopPlaying(void* ptr)
{
MyAbletonLink* link = static_cast<MyAbletonLink*>(ptr);
link->stopPlaying();
}

bool isPlaying(void* ptr)
{
MyAbletonLink* link = static_cast<MyAbletonLink*>(ptr);
return link->isPlaying();
}

void enableStartStopSync(void* ptr, bool bEnable)
{
MyAbletonLink* link = static_cast<MyAbletonLink*>(ptr);
link->enableStartStopSync(bEnable);
}

int numPeers(void* ptr)
{
MyAbletonLink* link = static_cast<MyAbletonLink*>(ptr);
Expand Down
8 changes: 5 additions & 3 deletions AbletonLinkDLL/AbletonLinkDLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@






extern "C" {


Expand All @@ -34,6 +31,11 @@ extern "C" {
bool ABLETONLINKDLL_API isEnabled(void* ptr);
void ABLETONLINKDLL_API enable(void* ptr, bool bEnable);

void ABLETONLINKDLL_API startPlaying(void* ptr);
void ABLETONLINKDLL_API stopPlaying(void* ptr);
bool ABLETONLINKDLL_API isPlaying(void* ptr);
void ABLETONLINKDLL_API enableStartStopSync(void* ptr, bool bEnable);

int ABLETONLINKDLL_API numPeers(void* ptr);
void ABLETONLINKDLL_API update(void* ptr, double* rbeat, double* rphase);

Expand Down
4 changes: 3 additions & 1 deletion AbletonLinkDLL/AbletonLinkDLL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ProjectGuid>{7AE17C11-1B9A-4773-89B7-48637DB8D55F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>AbletonLinkDLL</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down Expand Up @@ -75,12 +75,14 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>C:\Users\Lukas\Documents\vvvv\AbletonLink-vvvv\AbletonLinkDLL\link\modules\asio-standalone\asio\include;C:\Users\Lukas\Documents\vvvv\AbletonLink-vvvv\AbletonLinkDLL\link\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>C:\Users\Lukas\Documents\vvvv\AbletonLink-vvvv\AbletonLinkDLL\link\modules\asio-standalone\asio\include;C:\Users\Lukas\Documents\vvvv\AbletonLink-vvvv\AbletonLinkDLL\link\include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down
51 changes: 46 additions & 5 deletions AbletonLinkDLL/MyAbletonLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ void MyAbletonLink::setTempo(double bpm){
if (link == nullptr){
return;
}
auto timeline = link->captureAppTimeline();
auto state = link->captureAppSessionState();

const auto time = link->clock().micros();
timeline.setTempo(bpm, time);
link->commitAppTimeline(timeline);
state.setTempo(bpm, time);
link->commitAppSessionState(state);

}

double MyAbletonLink::tempo(){
if(link == nullptr){
return 0.0;
}
return link->captureAppTimeline().tempo();
return link->captureAppSessionState().tempo();
}

void MyAbletonLink::setQuantum(double quantum){
Expand All @@ -85,8 +86,48 @@ void MyAbletonLink::enable(bool bEnable){
return;
}
link->enable(bEnable);

}



void MyAbletonLink::enableStartStopSync(bool bEnable) {
if (link == nullptr) {
return;
}
link->enableStartStopSync(bEnable);

}

void MyAbletonLink::startPlaying() {
if (link == nullptr) {
return;
}
auto state = link->captureAppSessionState();

state.setIsPlaying(true, link->clock().micros());
link->commitAppSessionState(state);

}

void MyAbletonLink::stopPlaying() {
if (link == nullptr) {
return;
}
auto state = link->captureAppSessionState();

state.setIsPlaying(false, link->clock().micros());
link->commitAppSessionState(state);

}

bool MyAbletonLink::isPlaying()
{
return link->captureAppSessionState().isPlaying();
}



std::size_t MyAbletonLink::numPeers(){
if(link == nullptr){
return 0;
Expand All @@ -100,7 +141,7 @@ MyAbletonLink::Status MyAbletonLink::update(){
return status;
}
const auto time = link->clock().micros();
auto timeline = link->captureAppTimeline();
auto timeline = link->captureAppSessionState();
status.beat = timeline.beatAtTime(time, quantum_);
status.phase = timeline.phaseAtTime(time, quantum_);
return status;
Expand Down
4 changes: 4 additions & 0 deletions AbletonLinkDLL/MyAbletonLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class MyAbletonLink {

bool isEnabled() const;
void enable(bool bEnable);
void startPlaying();
void stopPlaying();
bool isPlaying();
void enableStartStopSync(bool bEnable);

std::size_t numPeers();

Expand Down
2 changes: 1 addition & 1 deletion AbletonLinkDLL/link
Submodule link updated from 754460 to 15024b
23 changes: 15 additions & 8 deletions Sync,AbletonValueLink.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="SlimDX" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition.CodePlex, Version=4.1.2.0, Culture=neutral, PublicKeyToken=13e5ffd4e05db186, processorArchitecture=MSIL">
<HintPath>packages\VVVV.System.ComponentModel.Composition.Codeplex.2.5.0\lib\net40\System.ComponentModel.Composition.CodePlex.dll</HintPath>
Expand All @@ -67,12 +66,12 @@
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="VVVV.Core, Version=35.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\VVVV.Core.35.8.0-develop-2695\lib\net46\VVVV.Core.dll</HintPath>
<HintPath>packages\VVVV.Core.35.8.0\lib\net46\VVVV.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VVVV.PluginInterfaces" />
<Reference Include="VVVV.Utils, Version=35.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\VVVV.Utils.35.8.0-develop-2695\lib\net46\VVVV.Utils.dll</HintPath>
<HintPath>packages\VVVV.Utils.35.8.0\lib\net46\VVVV.Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VVVV.Utils3rdParty" />
Expand All @@ -82,7 +81,15 @@
<Compile Include="SyncAbletonLinkValueNode.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="AbletonLinkDLL\AbletonLinkDLL.vcxproj">
<Project>{7ae17c11-1b9a-4773-89b7-48637db8d55f}</Project>
<Name>AbletonLinkDLL</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand All @@ -91,10 +98,10 @@
</PropertyGroup>
<Error Condition="!Exists('packages\VVVV.SlimDX.1.0.2\build\net40\VVVV.SlimDX.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\VVVV.SlimDX.1.0.2\build\net40\VVVV.SlimDX.props'))" />
<Error Condition="!Exists('packages\VVVV.SlimDX.1.0.2\build\net40\VVVV.SlimDX.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\VVVV.SlimDX.1.0.2\build\net40\VVVV.SlimDX.targets'))" />
<Error Condition="!Exists('packages\VVVV.Utils3rdParty.35.8.0-develop-2695\build\net46\VVVV.Utils3rdParty.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\VVVV.Utils3rdParty.35.8.0-develop-2695\build\net46\VVVV.Utils3rdParty.targets'))" />
<Error Condition="!Exists('packages\VVVV.PluginInterfaces.35.8.0-develop-2695\build\net46\VVVV.PluginInterfaces.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\VVVV.PluginInterfaces.35.8.0-develop-2695\build\net46\VVVV.PluginInterfaces.targets'))" />
<Error Condition="!Exists('packages\VVVV.Utils3rdParty.35.8.0\build\net46\VVVV.Utils3rdParty.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\VVVV.Utils3rdParty.35.8.0\build\net46\VVVV.Utils3rdParty.targets'))" />
<Error Condition="!Exists('packages\VVVV.PluginInterfaces.35.8.0\build\net46\VVVV.PluginInterfaces.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\VVVV.PluginInterfaces.35.8.0\build\net46\VVVV.PluginInterfaces.targets'))" />
</Target>
<Import Project="packages\VVVV.SlimDX.1.0.2\build\net40\VVVV.SlimDX.targets" Condition="Exists('packages\VVVV.SlimDX.1.0.2\build\net40\VVVV.SlimDX.targets')" />
<Import Project="packages\VVVV.Utils3rdParty.35.8.0-develop-2695\build\net46\VVVV.Utils3rdParty.targets" Condition="Exists('packages\VVVV.Utils3rdParty.35.8.0-develop-2695\build\net46\VVVV.Utils3rdParty.targets')" />
<Import Project="packages\VVVV.PluginInterfaces.35.8.0-develop-2695\build\net46\VVVV.PluginInterfaces.targets" Condition="Exists('packages\VVVV.PluginInterfaces.35.8.0-develop-2695\build\net46\VVVV.PluginInterfaces.targets')" />
<Import Project="packages\VVVV.Utils3rdParty.35.8.0\build\net46\VVVV.Utils3rdParty.targets" Condition="Exists('packages\VVVV.Utils3rdParty.35.8.0\build\net46\VVVV.Utils3rdParty.targets')" />
<Import Project="packages\VVVV.PluginInterfaces.35.8.0\build\net46\VVVV.PluginInterfaces.targets" Condition="Exists('packages\VVVV.PluginInterfaces.35.8.0\build\net46\VVVV.PluginInterfaces.targets')" />
</Project>
56 changes: 55 additions & 1 deletion SyncAbletonLinkValueNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ public class SyncAbletonLinkValueNode : IPluginEvaluate, IDisposable
[Input("Set Tempo", IsBang = true)]
public IDiffSpread<bool> FSetTempoIn;

[Input("Start Playing", IsBang = true)]
public IDiffSpread<bool> FStartPlay;

[Input("Stop Playing", IsBang = true)]
public IDiffSpread<bool> FStopPlay;

[Input("StartStopSync")]
public IDiffSpread<bool> FEnableStartStopSync;

[Input("Reset", IsBang = true)]
public IDiffSpread<bool> FResetIn;

Expand All @@ -44,6 +53,9 @@ public class SyncAbletonLinkValueNode : IPluginEvaluate, IDisposable
[Output("Peers")]
public ISpread<int> FPeersOut;

[Output("IsPlaying")]
public ISpread<bool> FIsPlayingOut;


[Import()]
public ILogger FLogger;
Expand Down Expand Up @@ -75,6 +87,19 @@ public void Evaluate(int SpreadMax)
if (FSetTempoIn[0])
AbletonLink.Instance.setTempo(FbpmIn[0]);

if (FEnableStartStopSync.IsChanged)
{
AbletonLink.Instance.enableStartStopSync(FEnableStartStopSync[0]);
}

if(FEnableStartStopSync[0])
{
if (FStartPlay[0])
AbletonLink.Instance.startPlaying();
if (FStopPlay[0])
AbletonLink.Instance.stopPlaying();
}

double beat;
double phase;
AbletonLink.Instance.update(out beat, out phase);
Expand All @@ -84,6 +109,7 @@ public void Evaluate(int SpreadMax)

FPeersOut[0] = AbletonLink.Instance.numPeers();
FbpmOut[0] = AbletonLink.Instance.tempo();
FIsPlayingOut[0] = AbletonLink.Instance.isPlaying();
}


Expand Down Expand Up @@ -192,7 +218,35 @@ public void enable(bool bEnable)
enable(nativeInstance, bEnable);
}

[DllImport ("AbletonLinkDLL")]
[DllImport("AbletonLinkDLL")]
private static extern void enableStartStopSync(IntPtr ptr, bool bEnable);
public void enableStartStopSync(bool bEnable)
{
enableStartStopSync(nativeInstance, bEnable);
}

[DllImport("AbletonLinkDLL")]
private static extern void startPlaying(IntPtr ptr);
public void startPlaying()
{
startPlaying(nativeInstance);
}

[DllImport("AbletonLinkDLL")]
private static extern void stopPlaying(IntPtr ptr);
public void stopPlaying()
{
stopPlaying(nativeInstance);
}

[DllImport("AbletonLinkDLL")]
private static extern bool isPlaying(IntPtr ptr);
public bool isPlaying()
{
return isPlaying(nativeInstance);
}

[DllImport ("AbletonLinkDLL")]
private static extern int numPeers(IntPtr ptr);
public int numPeers()
{
Expand Down
Binary file modified obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file modified obj/Debug/Sync,AdobeValueLink.dll
Binary file not shown.
Binary file modified obj/Debug/Sync,AdobeValueLink.pdb
Binary file not shown.
8 changes: 4 additions & 4 deletions packages.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="VVVV.Core" version="35.8.0-develop-2695" targetFramework="net46" />
<package id="VVVV.PluginInterfaces" version="35.8.0-develop-2695" targetFramework="net46" />
<package id="VVVV.Core" version="35.8.0" targetFramework="net46" />
<package id="VVVV.PluginInterfaces" version="35.8.0" targetFramework="net46" />
<package id="VVVV.SlimDX" version="1.0.2" targetFramework="net46" />
<package id="VVVV.System.ComponentModel.Composition.Codeplex" version="2.5.0" targetFramework="net46" />
<package id="VVVV.Utils" version="35.8.0-develop-2695" targetFramework="net46" />
<package id="VVVV.Utils3rdParty" version="35.8.0-develop-2695" targetFramework="net46" />
<package id="VVVV.Utils" version="35.8.0" targetFramework="net46" />
<package id="VVVV.Utils3rdParty" version="35.8.0" targetFramework="net46" />
</packages>

0 comments on commit 7c7b996

Please sign in to comment.