From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Plugins/SDK/in_tone/IN_TONE.sln | 24 ++ Src/Plugins/SDK/in_tone/IN_TONE.vcxproj | 319 ++++++++++++++++++++++++ Src/Plugins/SDK/in_tone/IN_TONE.vcxproj.filters | 29 +++ Src/Plugins/SDK/in_tone/MAIN.C | 240 ++++++++++++++++++ Src/Plugins/SDK/in_tone/in_tone.rc | 109 ++++++++ Src/Plugins/SDK/in_tone/resource.h | 18 ++ Src/Plugins/SDK/in_tone/version.rc2 | 39 +++ 7 files changed, 778 insertions(+) create mode 100644 Src/Plugins/SDK/in_tone/IN_TONE.sln create mode 100644 Src/Plugins/SDK/in_tone/IN_TONE.vcxproj create mode 100644 Src/Plugins/SDK/in_tone/IN_TONE.vcxproj.filters create mode 100644 Src/Plugins/SDK/in_tone/MAIN.C create mode 100644 Src/Plugins/SDK/in_tone/in_tone.rc create mode 100644 Src/Plugins/SDK/in_tone/resource.h create mode 100644 Src/Plugins/SDK/in_tone/version.rc2 (limited to 'Src/Plugins/SDK/in_tone') diff --git a/Src/Plugins/SDK/in_tone/IN_TONE.sln b/Src/Plugins/SDK/in_tone/IN_TONE.sln new file mode 100644 index 00000000..d6f93055 --- /dev/null +++ b/Src/Plugins/SDK/in_tone/IN_TONE.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32802.440 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "in_tone", "IN_TONE.vcxproj", "{CE007A38-412F-4758-B17D-489398D1DD50}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CE007A38-412F-4758-B17D-489398D1DD50}.Debug|x86.ActiveCfg = Debug|Win32 + {CE007A38-412F-4758-B17D-489398D1DD50}.Debug|x86.Build.0 = Debug|Win32 + {CE007A38-412F-4758-B17D-489398D1DD50}.Release|x86.ActiveCfg = Release|Win32 + {CE007A38-412F-4758-B17D-489398D1DD50}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AAF99C25-33D3-4ECC-BF56-FF3FF981E2E8} + EndGlobalSection +EndGlobal diff --git a/Src/Plugins/SDK/in_tone/IN_TONE.vcxproj b/Src/Plugins/SDK/in_tone/IN_TONE.vcxproj new file mode 100644 index 00000000..d7242f25 --- /dev/null +++ b/Src/Plugins/SDK/in_tone/IN_TONE.vcxproj @@ -0,0 +1,319 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + in_tone + {CE007A38-412F-4758-B17D-489398D1DD50} + + + 10.0.19041.0 + + + + DynamicLibrary + v142 + false + Unicode + + + DynamicLibrary + v142 + false + Unicode + + + DynamicLibrary + v142 + false + Unicode + + + DynamicLibrary + v142 + false + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>16.0.32629.160 + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + + + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + + + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + + + false + + + Debug + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + true + true + + $(IntDir)$(TargetName).pch + $(IntDir) + $(IntDir) + $(IntDir)$(TargetName).pdb + Level3 + true + ProgramDatabase + true + ..\..;%(AdditionalIncludeDirectories) + + + $(OutDir)$(TargetName)$(TargetExt) + true + false + true + $(IntDir)$(TargetName).pdb + Windows + true + true + $(IntDir)$(TargetName).lib + MachineX86 + false + msvcmrt.lib;vcruntime.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Debug/IN_TONE.tlb + + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + true + true + + + $(IntDir)$(TargetName).pch + $(IntDir) + $(IntDir) + $(IntDir)$(TargetName).pdb + Level3 + true + ProgramDatabase + true + ..\..;%(AdditionalIncludeDirectories) + + + $(OutDir)$(TargetName)$(TargetExt) + true + true + true + $(IntDir)$(TargetName).pdb + Windows + true + true + $(IntDir)$(TargetName).lib + false + msvcmrt.lib;vcruntime.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + _DEBUG;%(PreprocessorDefinitions) + true + true + .\Debug/IN_TONE.tlb + + + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + + + MinSpace + OnlyExplicitInline + true + Size + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + + + true + true + + $(IntDir)$(TargetName).pch + $(IntDir) + $(IntDir) + $(IntDir)$(TargetName).pdb + Level3 + true + true + None + ..\..;%(AdditionalIncludeDirectories) + + + $(OutDir)$(TargetName)$(TargetExt) + true + false + $(IntDir)$(TargetName).pdb + Windows + true + true + $(IntDir)$(TargetName).lib + MachineX86 + false + msvcmrt.lib;vcruntime.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/IN_TONE.tlb + + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + + + MinSpace + OnlyExplicitInline + true + Size + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + true + true + + + $(IntDir)$(TargetName).pch + $(IntDir) + $(IntDir) + $(IntDir)$(TargetName).pdb + Level3 + true + true + None + ..\..;%(AdditionalIncludeDirectories) + + + $(OutDir)$(TargetName)$(TargetExt) + true + false + $(IntDir)$(TargetName).pdb + Windows + true + true + $(IntDir)$(TargetName).lib + false + msvcmrt.lib;vcruntime.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + NDEBUG;%(PreprocessorDefinitions) + true + true + .\Release/IN_TONE.tlb + + + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Src/Plugins/SDK/in_tone/IN_TONE.vcxproj.filters b/Src/Plugins/SDK/in_tone/IN_TONE.vcxproj.filters new file mode 100644 index 00000000..ffd0a02d --- /dev/null +++ b/Src/Plugins/SDK/in_tone/IN_TONE.vcxproj.filters @@ -0,0 +1,29 @@ + + + + + {fe3315d9-7104-47fb-a190-5606b0a79c2c} + + + {a324aabb-8e08-4409-b564-68f296e5712f} + + + {e5a6e5a8-3ea2-46a9-9e02-9b9880fc1f6d} + + + + + Resource Files + + + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/Src/Plugins/SDK/in_tone/MAIN.C b/Src/Plugins/SDK/in_tone/MAIN.C new file mode 100644 index 00000000..1ab7ccce --- /dev/null +++ b/Src/Plugins/SDK/in_tone/MAIN.C @@ -0,0 +1,240 @@ +/* +** Example Winamp input plug-in +** Copyright (c) 1998, Justin Frankel/Nullsoft Inc. +*/ + +#include +#include +#include +#include +#include + +#include "../Winamp/in2.h" + +#define WM_WA_MPEG_EOF WM_USER+2 + + +extern In_Module mod; +char lastfn[MAX_PATH]; +short sample_buffer[576*2]; + +/* +// avoid CRT. Evil. Big. Bloated. +BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) +{ + return TRUE; +} +*/ +int paused; +DWORD WINAPI __stdcall PlayThread(void *b); + +int gen_freq=2600; + +int killDecodeThread=0; +HANDLE thread_handle=INVALID_HANDLE_VALUE; + +void config(HWND hwndParent) +{ + MessageBoxA(hwndParent,"To use, open 'tone://2600' (for 2600hz).","Configuration",MB_OK); // Must stay in ANSI +} +void about(HWND hwndParent) +{ + MessageBoxA(hwndParent,"Nullsoft Tone Generator, by Justin Frankel","About Nullsoft Tone Generator",MB_OK); // Must stay in ANSI +} + +int init() +{ + return 0; +} + +void quit() { } + +int isourfile(const char *fn) +{ + char buf[8]; + memcpy(buf,fn,7); + buf[7]=0; + return lstrcmpA(buf,"tone://")?0:1; // Must stay in ANSI +} + +int play(const char *fn) { + int maxlatency; + int tmp; + strcpy(lastfn,fn); + // simple atoi() inline so that we don't have to use libc (for a nice 4k dll) + { + const char *s=fn+7; + int n=0; + while (*s >= '0' && *s <= '9') + { + n*=10; + n += *s++ -'0'; + } + gen_freq=n; + } + paused=0; + memset(sample_buffer,0,sizeof(sample_buffer)); + + maxlatency = mod.outMod->Open(44100,1,16, -1,-1); + if (maxlatency < 0) + { + return 1; + } + mod.SetInfo(0,44,1,1); + mod.SAVSAInit(maxlatency,44100); + mod.VSASetInfo(44100,1); + mod.outMod->SetVolume(-666); + + killDecodeThread=0; + thread_handle = (HANDLE) CreateThread(NULL,0,(LPTHREAD_START_ROUTINE) PlayThread,(void *) &killDecodeThread,0,&tmp); + + return 0; +} + +void pause() { paused=1; mod.outMod->Pause(1); } +void unpause() { paused=0; mod.outMod->Pause(0); } +int ispaused() { return paused; } + +void stop() { + if (thread_handle != INVALID_HANDLE_VALUE) + { + killDecodeThread=1; + if (WaitForSingleObject(thread_handle,INFINITE) == WAIT_TIMEOUT) + { + MessageBoxA(mod.hMainWindow,"error asking thread to die!\n","error killing decode thread",0); // Must stay in ANSI + TerminateThread(thread_handle,0); + } + CloseHandle(thread_handle); + thread_handle = INVALID_HANDLE_VALUE; + } + + mod.outMod->Close(); + mod.SAVSADeInit(); +} + +int getlength() { return -1000; } +int getoutputtime() { return mod.outMod->GetOutputTime(); } +void setoutputtime(int time_in_ms) { } + +void setvolume(int volume) { mod.outMod->SetVolume(volume); } +void setpan(int pan) { mod.outMod->SetPan(pan); } + +int infoDlg(const char *fn, HWND hwnd) +{ + return 0; +} + +void getfileinfo(const char *filename, char *title, int *length_in_ms) +{ + if (!filename || !*filename) filename=lastfn; + if (title) + { + const char *s=filename+7; + int n=0; + while (*s >= '0' && *s <= '9') + { + n*=10; + n += *s++ -'0'; + } + sprintf(title,"%dhz Tone",n); + } + if (length_in_ms) *length_in_ms=-1000; +} + +void eq_set(int on, char data[10], int preamp) +{ +} + + +In_Module mod = +{ + IN_VER, + L"Nullsoft Tone Generator v0.2 " +/* #ifdef __alpha + "(AXP)" +#else + "(x86)" +#endif */ + , + 0, // hMainWindow + 0, // hDllInstance + "\0" + , + 0, // is_seekable + 1, // uses output + config, + about, + init, + quit, + getfileinfo, + infoDlg, + isourfile, + play, + pause, + unpause, + ispaused, + stop, + + getlength, + getoutputtime, + setoutputtime, + + setvolume, + setpan, + + 0,0,0,0,0,0,0,0,0, // vis stuff + + + 0,0, // dsp + + eq_set, + + NULL, // setinfo + + 0 // out_mod + +}; + +__declspec( dllexport ) In_Module * winampGetInModule2() +{ + return &mod; +} + +int _fltused=0; + +DWORD WINAPI __stdcall PlayThread(void *b) +{ + double angle=0.0,dangle=3.14159*2.0*(double)gen_freq/(double)44100.0; + while (! *((int *)b) ) + { + if (mod.outMod->CanWrite() >= ((sizeof(sample_buffer)/2)<<(mod.dsp_isactive()?1:0))) + { + int l=sizeof(sample_buffer)/2,x=l/2; + short *s=sample_buffer; + while (x--) + { + int i; + double d = sin(angle)*32766.5; +#ifndef __alpha + __asm { + fld d + fistp i + } +#else + i = (int) d; +#endif + *s++=i; + angle += dangle; + } + { + int t=mod.outMod->GetWrittenTime(); + mod.SAAddPCMData((char *)sample_buffer,1,16,t); + mod.VSAAddPCMData((char *)sample_buffer,1,16,t); + } + l=mod.dsp_dosamples(sample_buffer,l/2,16,1,44100)*2; + mod.outMod->Write((char *)sample_buffer,l); + } + else Sleep(50); + } + return 0; +} \ No newline at end of file diff --git a/Src/Plugins/SDK/in_tone/in_tone.rc b/Src/Plugins/SDK/in_tone/in_tone.rc new file mode 100644 index 00000000..9616e11d --- /dev/null +++ b/Src/Plugins/SDK/in_tone/in_tone.rc @@ -0,0 +1,109 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Polish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK) +#ifdef _WIN32 +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT +#pragma code_page(1250) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Polish resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_NULLSOFT_IN_TONE "Nullsoft Tone Input v%s" + 65535 "{1A710E67-5180-49ac-8102-105856ED0A2F}" +END + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Plugins/SDK/in_tone/resource.h b/Src/Plugins/SDK/in_tone/resource.h new file mode 100644 index 00000000..8af67da5 --- /dev/null +++ b/Src/Plugins/SDK/in_tone/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by in_tone.rc +// +#define IDS_NULLSOFT_IN_TONE_OLD 0 + +#define IDS_NULLSOFT_IN_TONE 65534 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1037 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Plugins/SDK/in_tone/version.rc2 b/Src/Plugins/SDK/in_tone/version.rc2 new file mode 100644 index 00000000..b3a65977 --- /dev/null +++ b/Src/Plugins/SDK/in_tone/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "..\..\..\Winamp\buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,2,0,1 + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Tone Input Plug-in" + VALUE "FileVersion", "0,2,0,1" + VALUE "InternalName", "Nullsoft Tone Input" + VALUE "LegalCopyright", "Copyright © 2005-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "in_tone.dll" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END -- cgit