blob: 88c3dc539fbc121cae4a86415f6958158875d7f9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#include "Main.h"
#include "dsp.h"
static int initted=0;
static HINSTANCE hLib=0;
static winampDSPModule *mod=0;
void dsp_init(void)
{
if (g_safeMode)
return;
wchar_t str[1024] = {0};
if (initted)
dsp_quit();
if (!config_dspplugin_name[0])
return;
PathCombineW(str,DSPDIR,config_dspplugin_name);
hLib = LoadLibraryW(str);
if (!hLib)
return;
winampDSPGetHeaderType pr = (winampDSPGetHeaderType) GetProcAddress(hLib,"winampDSPGetHeader2");
if (!pr || (pr(hMainWindow)->version < DSP_HDRVER && pr(hMainWindow)->version >= DSP_HDRVER+0x10) || !(mod = pr(hMainWindow)->getModule(config_dspplugin_num)))
{
FreeLibrary(hLib);
hLib=0;
return;
}
mod->hwndParent=hMainWindow;
mod->hDllInstance=hLib;
mod->Init(mod);
initted=1;
}
void dsp_quit(void)
{
if (!initted)
return;
initted=0;
if (mod)
{
if (!(config_no_visseh&2))
{
try
{
mod->Quit(mod);
}
catch(...)
{
}
}
else
{
mod->Quit(mod);
}
}
FreeLibrary(hLib);
hLib=0;
mod=0;
}
int dsp_isactive(void)
{
return (in_mod && initted && mod);
}
int dsp_dosamples(short int *samples, int numsamples, int bps, int nch, int srate)
{
if (dsp_isactive())
{
if (mod)
return (mod->ModifySamples(mod,samples,numsamples,bps,nch,srate));
}
return numsamples;
}
|