initial commit
This commit is contained in:
188
tools/tracker/stuff/NoteHelper/NoteHelper.vcproj
Normal file
188
tools/tracker/stuff/NoteHelper/NoteHelper.vcproj
Normal file
@@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="NoteHelper"
|
||||
ProjectGUID="{5032F8D6-2749-4D56-A909-7B7A9BC9BE72}"
|
||||
RootNamespace="NoteHelper"
|
||||
>
|
||||
<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"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
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="Fichiers sources"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\note.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Fichiers d'en-t<>te"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Fichiers de ressources"
|
||||
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>
|
||||
17
tools/tracker/stuff/header.py
Normal file
17
tools/tracker/stuff/header.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
import struct
|
||||
|
||||
if len(sys.argv) >= 2:
|
||||
file = open(sys.argv[1])
|
||||
buffer = file.read(164)
|
||||
file.close()
|
||||
header = struct.unpack("HHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII", buffer)
|
||||
print "Resolution : " + str(header[0])
|
||||
print "RPM : " + str(header[1])
|
||||
for c in range(8):
|
||||
print "> Channel " + str(c)
|
||||
print "Timer : " + str(header[2+c*5+0])
|
||||
print "Volume : " + str(header[2+c*5+1])
|
||||
print "Duty : " + str(header[2+c*5+2])
|
||||
print "Decay : " + str(header[2+c*5+3])
|
||||
print "Offset : " + str(header[2+c*5+4])
|
||||
BIN
tools/tracker/stuff/note
Normal file
BIN
tools/tracker/stuff/note
Normal file
Binary file not shown.
71
tools/tracker/stuff/note.cpp
Normal file
71
tools/tracker/stuff/note.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
char * midiNoteName(int note)
|
||||
{
|
||||
static char str[4];
|
||||
if ( note < 0 || note > 127 ) {
|
||||
sprintf(str, "INV");
|
||||
return str;
|
||||
}
|
||||
|
||||
int l = note % 12;
|
||||
|
||||
str[0] = "CCDDEFFGGAAB"[l];
|
||||
|
||||
if ( l == 1 || l == 3 || l == 6 || l == 8 || l == 10 )
|
||||
str[1] = '#';
|
||||
else
|
||||
str[1] = ' ';
|
||||
|
||||
int octave = (note - 12) / 12;
|
||||
if ( note < 12 )
|
||||
str[2] = '-';
|
||||
else
|
||||
str[2] = '0' + octave;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
int round(float f)
|
||||
{
|
||||
return (int)(f+0.5);
|
||||
}
|
||||
#endif
|
||||
|
||||
int midiFreqToNote(unsigned short freq)
|
||||
{
|
||||
return round(69.0 + log(freq/440.0)*17.31234 );
|
||||
}
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
struct NDSNote {
|
||||
unsigned int time : 13;
|
||||
unsigned int volume : 5;
|
||||
unsigned int freq : 14;
|
||||
#if _WIN32
|
||||
};
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
assert(sizeof(NDSNote) == 4);
|
||||
|
||||
if ( argc == 2 ) {
|
||||
NDSNote note;
|
||||
sscanf(argv[1], "%x", (unsigned int *) & note);
|
||||
printf(">> time(%d) volume(%d) note(%s) [%dHz -> %d]\n",
|
||||
note.time, note.volume,
|
||||
midiNoteName(midiFreqToNote(note.freq)), note.freq,
|
||||
midiFreqToNote(note.freq) );
|
||||
return 0;
|
||||
}
|
||||
printf("Give me 32 bit hex of a nds note, I give you what it means\n");
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user