winamp plugin 한
winamp 한 plugin 한.
input plugin 해 화 output plugin 한. output plugin 하 크 한. DSP Visual plugin callback 한.
하 한 ACM 훌한 확 플 .
Simple Code ¶
파하 in2.h Out.h 하. http://www.winamp.com/nsdn/ Winamp SDK .
~cpp
#include <windows.h>
#include <stdio.h>
#include "in2.h"
// define procedures, that'll be found in a .DLL
typedef In_Module* (*INHDRPROC)(void);
typedef Out_Module* (*OUTHDRPROC)(void);
// dsp-functions
int dsp_donothing(short int *, int cnt, int, int, int) {
return cnt;
}
int dsp_isactive() {
return 0;
}
// other functions, needed to get it to work
void SAVSAInit(int maxlatency_in_ms, int srate){
}
void SAVSADeInit(){
}
void SAAddPCMData(void *PCMData, int nch, int bps, int timestamp){
// printf ("%d,%d,%d\n", nch,bps,timestamp);
}
int SAGetMode(){
return 0;
}
void SAAdd(void *data, int timestamp, int csa){
}
void VSAAddPCMData(void *PCMData, int nch, int bps, int timestamp){
// printf ("%d,%d,%d\n", nch,bps,timestamp);
}
int VSAGetMode(int *specNch, int *waveNch) {
*specNch = *waveNch = 0;
return 0;
}
void VSAAdd(void *data, int timestamp){
}
void VSASetInfo(int nch, int srate){
}
void SetInfo(int bitrate, int srate, int stereo, int synched){
}
void playFile() {
// 플 DLL load 하 .
HINSTANCE hout = LoadLibrary("out_wave.dll");
HINSTANCE hin = LoadLibrary("in_vorbis.dll");
// 포
INHDRPROC ihp = (INHDRPROC)GetProcAddress(hin,"winampGetInModule2");
OUTHDRPROC ohp = (OUTHDRPROC)GetProcAddress(hout,"winampGetOutModule");
// Mapping.
In_Module* in = ihp();
Out_Module* out = ohp();
// 한 .
if (in->version != IN_VER || out->version != OUT_VER)
{
FreeLibrary(hout);
FreeLibrary(hin);
return;
}
// console mode . window 팅 NULL.
out->hMainWindow = NULL;
out->hDllInstance = hout;
in->hMainWindow = NULL;
in->hDllInstance = hin;
if (in->UsesOutputPlug)
{
in->outMod = out;
}
// 파 . input plugin Visual plugin .
// 함포 하 핑해.
// 화 callback 함 해.
// Visualization 함 하 .
in->SAVSAInit = SAVSAInit;
in->SAVSADeInit = SAVSADeInit;
in->SAAdd = SAAdd;
in->SAGetMode = SAGetMode;
in->SAAddPCMData = SAAddPCMData;
in->VSAAddPCMData = VSAAddPCMData;
in->VSAGetMode = VSAGetMode;
in->VSAAdd = VSAAdd;
in->VSASetInfo = VSASetInfo;
// DSP Plugin . 한 .
in->dsp_dosamples = dsp_donothing;
in->dsp_isactive = dsp_isactive;
in->SetInfo = SetInfo;
// 플 화.
out->Init();
in->Init();
char playFile[256] = "garden.ogg";
printf ("%d \n", in->version); // 플
printf ("%s \n", in->description); // 플
printf ("%s \n", in->FileExtensions); // 해 플 하 확 .
// if playing starts correctly
if (!in->Play(playFile))
{
// & panning ( balance) .
in->SetVolume(255);
in->SetPan(0);
//int x = 1,len = in->GetLength();
//for (;x=1 && in->GetOutputTime()<len;) Sleep(100);
for (int i=0;i<10000;i++) {
printf(" %d ms\n", in->GetLength()); // play time (ms)
printf("current : %d ms\n", in->GetOutputTime()); // 행 play time (ms)
Sleep(1000); // plugin 티 .
}
// when playing stops, terminate
in->Stop();
}
// un-init plugins
in->Quit();
out->Quit();
// dll .
FreeLibrary(hin);
FreeLibrary(hout);
}
void main() {
playFile();
}









