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(); }