//------------------------------------------------------------------------ // // VisInterface.h // // The CVisInterface class wraps the Vis DLL's. // Visit http://www.ratajik.com/VisInterface for more information, // including examples. // // The intended flow of execution will generally be: // // - Construct the class with the path to the DLL. // - Look at the Name of the Vis and the Mods. // - SelectModule() to pick one of them as the active one. // - Call the Get[Spectrum/Waveform]Data[Left/Right] methods to get a // pointer to the data. // - Fill out information to be rendered using these pointers // - Call Render() to render the wave/spec data. // // So, for example, you could write a app that get a directory of DLL's, // creating a version of this class for each one (you can check to see // what worked by calling isVis()). You could display the results to // the user, letting them pick one of them. Then, somehow fill out the // waveform/spec data and Render() it. // // // ------------------------------------------------------------------- // * COPYRIGHT 2001, Greg Ratajik and Ratajik Software * // * All rights Reserved * // ------------------------------------------------------------------- // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // More information about this program can be found at: // http://www.ratajik.com/VisInterface // C H A N G E L O G // ===================================================================== // Change ID Date Programmer Description // ============ ========= =========== ================================ // 02-05-01 Ratajik Initial Development //------------------------------------------------------------------------ #pragma once #include "Vis.h" // Included in the Vis SDK at http://www.winamp.com #include "VisThread.h" #include // Don't be annoying to other projects const int VIS_BUFFER_SIZE = 576; const int WM_VIS_ENDED = 9830; // This is sent when a Vis exited (user shut it down) //------------------------------------------------------------------------ // // Class: CVisInterface // // Description: Interface to Vis DLL's. // // Methods // of // Interest: CVisInterace(CWnd&, const CString& ) // - The one and only constructor. Must pass the parent // window and the path to the DLL. // // isVis(CString&) (STATIC) // - Quick test to see if the passed DLL is a Vis DLL. (So // you don't have to create the class on a DLL that's not // a Vis). // // // isValid() // - Use to tell if a Vis was a valid DLL (non-static) // // VisName (CString&) // - Puts the name of the loaded vis into the passed // CString. // // VisPath() // - Returned the full path to the DLL // // ModName(int, CString&) // - Loads passed mod name into the passed CString. // // SelectModule(int) // - Selects the passed Mod # (All the rest of these // methods require this one to be called first). // // Config() // - Load the config screen for the [SelectedModule]. // // Render() // - Render in the vis for the [SelectedModule] // NOTE: You must have filled up either/or the spec // or waveform arrays (see the GetXXXLeft/Right methods) // // SetSpectrumStero()/Mon() // - If Stereo, expects both channels to be filled, other // wise ONLY the left channel. // // SetWaveFormStero()/Mon() // - If Stereo, expects both channels to be filled, other // wise ONLY the left channel. // // GetSpectrumDataLeft () // GetSpectrumDataRight() // GetWaveformDataLeft () // GetWaveformDataRight() // - Get a pointer to one of these channels. NOTE: // the returned pointer points to a array 576 chars // long. Only fill to that point :P // // // C H A N G E L O G // =================================================================== // Change ID Date Programmer Description // ============ ========= =========== ================================ // 02-03-01 Ratajik Initial Development //_________________________________________________________________________ class __declspec(dllexport) CVisInterface { public: static CVisInterface * Create(CWnd& wndParent, const CString& sDLLPath); CVisInterface(CWnd& wndParent, const CString& sDLLPath); virtual ~CVisInterface(); static bool isVis(const CString& sDLLPath); bool isValid( void ) { return(m_pVisHeader != NULL);} bool SelectModule( int nModNbr ); bool VisName ( CString& sVisName ) const; bool ModName ( CString& sModName ) const; bool ModName ( int nModNbr, CString& sModName ) const; int ModNbr ( void ) { return(m_nCurModNbr);} CString VisPath( void ) { return(m_sDLLPath);} bool Init ( void ); bool Config( void ); bool Render( void ); bool Quit ( void ); void SetChannelNull (); void SetChannelStereo(); void SetChannelMono (); void SetSpectrumNull (); void SetSpectrumStereo(); void SetSpectrumMono (); void SetWaveformNull (); void SetWaveformStereo(); void SetWaveformMono (); unsigned char * GetSpectrumDataLeft ( void ); unsigned char * GetSpectrumDataRight( void ); unsigned char * GetWaveformDataLeft ( void ); unsigned char * GetWaveformDataRight( void ); protected: virtual void LoadModDefaults( winampVisModule *pMod); bool LoadDLL(void); private: const CString m_sDLLPath; // Full path to the loaded DLL. CWnd& m_wndParent; // The Parent Window winampVisHeader *m_pVisHeader; // Info abou the Vis DLL. winampVisModule *m_pMod[3]; // Up to three mods supported in the DLL. winampVisModule *m_pCurMod; // The Selected() mod HINSTANCE m_hLib; // Handle to the loaded DLL. int m_nCurModNbr; // The Selected() mod #. };