cleaner structchah!

This commit is contained in:
Erik Faye-Lund 2008-02-15 20:23:29 +00:00
parent 4196fc45d8
commit fcf160d917
22 changed files with 848 additions and 699 deletions

View File

@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="synctracker2"
Name="editor"
ProjectGUID="{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}"
RootNamespace="synctracker2"
Keyword="Win32Proj"
@ -180,27 +180,23 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\sync\data.cpp"
RelativePath="..\sync\data.cpp"
>
</File>
<File
RelativePath=".\sync\network.cpp"
RelativePath="..\sync\network.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp"
RelativePath=".\synctracker2.cpp"
>
</File>
<File
RelativePath=".\editor\synctracker2.cpp"
RelativePath="..\sync\track.cpp"
>
</File>
<File
RelativePath=".\sync\track.cpp"
>
</File>
<File
RelativePath=".\editor\trackview.cpp"
RelativePath=".\trackview.cpp"
>
</File>
</Filter>
@ -210,15 +206,15 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\sync\data.h"
RelativePath="..\sync\data.h"
>
</File>
<File
RelativePath=".\sync\device.h"
RelativePath="..\sync\device.h"
>
</File>
<File
RelativePath=".\sync\network.h"
RelativePath="..\sync\network.h"
>
</File>
<File
@ -226,11 +222,11 @@
>
</File>
<File
RelativePath=".\stdafx.h"
RelativePath="..\stdafx.h"
>
</File>
<File
RelativePath=".\sync\track.h"
RelativePath="..\sync\track.h"
>
</File>
</Filter>
@ -240,7 +236,7 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\synctracker2.rc"
RelativePath=".\editor.rc"
>
</File>
</Filter>

View File

@ -9,9 +9,6 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include "afxres.h"
#include "resource.h"
#include <stdio.h>
#include <tchar.h>
#include <assert.h>

View File

@ -37,6 +37,7 @@ public:
void sendSetRowCommand(int row)
{
if (INVALID_SOCKET == clientSocket) return;
printf("sending row pos\n");
unsigned char cmd = SET_ROW;
send(clientSocket, (char*)&cmd, 1, 0);

View File

@ -1,7 +1,9 @@
// synctracker2.cpp : Defines the entry point for the console application.
//
#include "../stdafx.h"
#include <afxres.h>
#include "resource.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -1,5 +1,3 @@
#include "../stdafx.h"
#include "trackview.h"
#include <vector>
@ -514,7 +512,10 @@ void TrackView::setEditRow(int newEditRow)
selectStartRow = selectStopRow = editRow;
selectStartTrack = selectStopTrack = editTrack;
}
getSyncData()->sendSetRowCommand(editRow);
if (getSyncData()->clientPaused)
{
getSyncData()->sendSetRowCommand(editRow);
}
}
invalidateRow(oldEditRow);

View File

@ -1,80 +0,0 @@
#include <stdio.h>
#include "sync/device.h"
#if 0
class BassTimer : public sync::Timer
{
public:
BassTimer(HSTREAM stream, float bpm) : stream(stream)
{
rowRate = bpm / 60;
}
// BASS hooks
void pause() { BASS_ChannelPause(stream); }
void play() { BASS_ChannelPlay(stream, false); }
float getTime() { return BASS_ChannelBytes2Seconds(stream, BASS_ChannelGetPosition(stream)); }
float getRow() { return getTime() * rowRate; }
void setRow(float pos) { BASS_ChannelSetPosition(stream, BASS_ChannelSeconds2Bytes(stream, row / rowRate)); }
bool isPlaying() { return (BASS_ChannelIsActive(stream) == BASS_ACTIVE_PLAYING); }
private:
HSTREAM stream;
float rowRate;
};
#else
#include <cmath>
class NullTimer : public sync::Timer
{
public:
NullTimer() : paused(true), row(0) {}
void pause() { paused = true; }
void play() { paused = false; }
float getRow()
{
float ret = row;
if (!paused) row += 0.5f;
return ret;
}
void setRow(float row) { this->row = int(floor(row)); }
bool isPlaying() { return !paused; }
private:
bool paused;
float row;
};
#endif
#include <windows.h>
#include <memory>
int main(int argc, char *argv[])
{
// BassTimer timer(stream, 120.0f);
NullTimer timer;
std::auto_ptr<sync::Device> syncDevice = std::auto_ptr<sync::Device>(sync::createDevice("sync", timer));
if (NULL == syncDevice.get())
{
printf("wft?!");
return -1;
}
sync::Track &track = syncDevice->getTrack("test");
timer.play();
while (1)
{
float row = float(timer.getRow());
if (!syncDevice->update(row)) break;
printf("%2.2f: %2.2f \n", row, track.getValue(row));
Sleep(10);
}
return 0;
}

View File

@ -5,7 +5,7 @@
#include <memory>
#include <exception>
#include <cstdio>
#include "sync/device.h"
#include "../sync/device.h"
#include "bass.h"
class BassTimer : public sync::Timer
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
throw std::string("could not create device. you computer SUCKS!");
// init BASS
int soundDevice = -1;
int soundDevice = 1;
if (!BASS_Init(soundDevice, 44100, BASS_DEVICE_LATENCY, 0, 0)) throw std::string("failed to init bass");
// load tune
@ -120,6 +120,15 @@ int main(int argc, char *argv[])
#endif
ret = -1;
}
catch (const std::string &str)
{
#ifdef _CONSOLE
fprintf(stderr, "*** error: %s\n", str.c_str());
#else
MessageBox(NULL, e.what(), NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
#endif
ret = -1;
}
return ret;
}

View File

@ -0,0 +1,218 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="example_bass"
ProjectGUID="{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}"
RootNamespace="example_bass"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="d3dx9.lib d3d9.lib ws2_32.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</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="..\sync\data.cpp"
>
</File>
<File
RelativePath="..\sync\device_client.cpp"
>
</File>
<File
RelativePath=".\example_bass.cpp"
>
</File>
<File
RelativePath="..\sync\network.cpp"
>
</File>
<File
RelativePath="..\sync\track.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</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>
<File
RelativePath=".\bass.lib"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

BIN
example_bass/tune.mp3 Normal file

Binary file not shown.

View File

@ -50,7 +50,7 @@ Track &ClientDevice::getTrack(const std::string &trackName)
send(serverSocket, (char*)&name_len, sizeof(size_t), 0);
const char *name_str = trackName.c_str();
send(serverSocket, name_str, name_len, 0);
send(serverSocket, name_str, int(name_len), 0);
sync::Track *track = new sync::Track();

View File

@ -1,6 +1,6 @@
#include "device.h"
#include "data.h"
#include "../network.h"
#include "network.h"
using namespace sync;

View File

@ -1,4 +1,3 @@
#include "../stdafx.h"
#include "network.h"
#include <stdio.h>

View File

@ -1,20 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "synctracker2", "synctracker2.vcproj", "{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Debug|Win32.ActiveCfg = Debug|Win32
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Debug|Win32.Build.0 = Debug|Win32
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Release|Win32.ActiveCfg = Release|Win32
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "editor", "editor\editor.vcproj", "{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_bass", "example_bass\example_bass.vcproj", "{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Debug|Win32.ActiveCfg = Debug|Win32
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Debug|Win32.Build.0 = Debug|Win32
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Release|Win32.ActiveCfg = Release|Win32
{76B44BC8-8BB4-4B6E-B2FA-7738C9E7F80B}.Release|Win32.Build.0 = Release|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug|Win32.ActiveCfg = Debug|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Debug|Win32.Build.0 = Debug|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release|Win32.ActiveCfg = Release|Win32
{96D91AAD-2F45-4CC6-A923-96B80E1C3CE3}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal