diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-01-13 11:49:53 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-01-13 11:49:53 +0000 |
commit | 163b104cb2c5a09d14bf7fcacab57e6fa704b005 (patch) | |
tree | 9cbe4c99e177f16bbab130d1bf5dcbd363e8816b /plugins/!NotAdopted | |
parent | c11ef9b9898776e57c664cd3ab60df83d599acdf (diff) |
Added sndVol sources (not adopted; old addons version, does someone has newer version?)
git-svn-id: http://svn.miranda-ng.org/main/trunk@3093 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted')
-rw-r--r-- | plugins/!NotAdopted/sndVol/IcoLib.h | 25 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/dmutil.cpp | 689 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/dmutil.h | 126 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/dxutil.cpp | 226 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/dxutil.h | 49 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/m_cluiframes.h | 128 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/nosnd.ico | bin | 0 -> 2550 bytes | |||
-rw-r--r-- | plugins/!NotAdopted/sndVol/optionsdlg.cpp | 146 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/optionsdlg.h | 1 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/playSnd.cpp | 137 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/playSnd.h | 24 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/plugin.cpp | 362 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/plugin.h | 42 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/resource.h | 24 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/snd.ico | bin | 0 -> 2550 bytes | |||
-rw-r--r-- | plugins/!NotAdopted/sndVol/sndVol.dsp | 163 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/sndVol.dsw | 29 | ||||
-rw-r--r-- | plugins/!NotAdopted/sndVol/sndVol.rc | 96 |
18 files changed, 2267 insertions, 0 deletions
diff --git a/plugins/!NotAdopted/sndVol/IcoLib.h b/plugins/!NotAdopted/sndVol/IcoLib.h new file mode 100644 index 0000000000..86666553dd --- /dev/null +++ b/plugins/!NotAdopted/sndVol/IcoLib.h @@ -0,0 +1,25 @@ +typedef struct {
+ int cbSize;
+ char *pszSection; //section name used to group icons
+ char *pszDescription; //description for options dialog
+ char *pszName; //name to refer to icon when playing and in db
+ char *pszDefaultFile; //default icon file to use
+ int iDefaultIndex;
+} SKINICONDESC;
+
+//
+// Add a icon into options UI
+//
+// wParam = (WPARAM)0
+// lParam = (LPARAM)(SKINICONDESC*)sid;
+//
+#define MS_SKIN2_ADDICON "Skin2/Icons/AddIcon"
+//
+// Retrieve HICON with name specified in lParam
+// Returned HICON SHOULDN'T be destroyed, it managed by IcoLib
+//
+#define MS_SKIN2_GETICON "Skin2/Icons/GetIcon"
+//
+// Icons change notification
+//
+#define ME_SKIN2_ICONSCHANGED "Skin2/IconsChanged"
diff --git a/plugins/!NotAdopted/sndVol/dmutil.cpp b/plugins/!NotAdopted/sndVol/dmutil.cpp new file mode 100644 index 0000000000..4e2767ac27 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/dmutil.cpp @@ -0,0 +1,689 @@ +//-----------------------------------------------------------------------------
+// File: DMUtil.cpp
+//
+// Desc: DirectMusic framework classes for playing DirectMusic segments and
+// DirectMusic scripts. Feel free to use this class as a starting point
+// for adding extra functionality.
+//
+// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
+//-----------------------------------------------------------------------------
+#define STRICT
+#include <dmusicc.h>
+#include <dmusici.h>
+#include <dsound.h>
+#include <dxerr8.h>
+#include "DMUtil.h"
+#include "DXUtil.h"
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CMusicManager()
+// Desc: Constructs the class
+//-----------------------------------------------------------------------------
+CMusicManager::CMusicManager()
+{
+ m_pLoader = NULL;
+ m_pPerformance = NULL;
+
+ // Initialize COM
+ HRESULT hr = CoInitialize(NULL);
+ m_bCleanupCOM = SUCCEEDED(hr);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::~CMusicManager()
+// Desc: Destroys the class
+//-----------------------------------------------------------------------------
+CMusicManager::~CMusicManager()
+{
+ SAFE_RELEASE( m_pLoader );
+
+ if( m_pPerformance )
+ {
+ // If there is any music playing, stop it.
+ m_pPerformance->Stop( NULL, NULL, 0, 0 );
+ m_pPerformance->CloseDown();
+
+ SAFE_RELEASE( m_pPerformance );
+ }
+
+ if( m_bCleanupCOM )
+ CoUninitialize();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::Initialize()
+// Desc: Inits DirectMusic using a standard audio path
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::Initialize( HWND hWnd, DWORD dwPChannels, DWORD dwDefaultPathType )
+{
+ HRESULT hr;
+
+ // Create loader object
+ if( FAILED( hr = CoCreateInstance( CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC,
+ IID_IDirectMusicLoader8, (void**)&m_pLoader ) ) )
+ return DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
+
+ // Create performance object
+ if( FAILED( hr = CoCreateInstance( CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC,
+ IID_IDirectMusicPerformance8, (void**)&m_pPerformance ) ) )
+ return DXTRACE_ERR( TEXT("CoCreateInstance"), hr );
+
+ // Initialize the performance with the standard audio path.
+ // This initializes both DirectMusic and DirectSound and
+ // sets up the synthesizer. Typcially its easist to use an
+ // audio path for playing music and sound effects.
+ if( FAILED( hr = m_pPerformance->InitAudio( NULL, NULL, hWnd, dwDefaultPathType,
+ dwPChannels, DMUS_AUDIOF_ALL, NULL ) ) )
+ {
+ if( hr == DSERR_NODRIVER )
+ {
+ DXTRACE( "Warning: No sound card found\n" );
+ return hr;
+ }
+
+ return DXTRACE_ERR( TEXT("InitAudio"), hr );
+ }
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::SetSearchDirectory()
+// Desc: Sets the search directory. If not called, the current working
+// directory is used to load content.
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::SetSearchDirectory( const TCHAR* strMediaPath )
+{
+ if( NULL == m_pLoader )
+ return E_UNEXPECTED;
+
+ // DMusic only takes wide strings
+ WCHAR wstrMediaPath[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrMediaPath, strMediaPath );
+
+ return m_pLoader->SetSearchDirectory( GUID_DirectMusicAllTypes,
+ wstrMediaPath, FALSE );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::GetDefaultAudioPath()
+// Desc:
+//-----------------------------------------------------------------------------
+IDirectMusicAudioPath8* CMusicManager::GetDefaultAudioPath()
+{
+ IDirectMusicAudioPath8* pAudioPath = NULL;
+ if( NULL == m_pPerformance )
+ return NULL;
+
+ m_pPerformance->GetDefaultAudioPath( &pAudioPath );
+ return pAudioPath;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CollectGarbage()
+// Desc: Tells the loader to cleanup any garbage from previously
+// released objects.
+//-----------------------------------------------------------------------------
+VOID CMusicManager::CollectGarbage()
+{
+ if( m_pLoader )
+ m_pLoader->CollectGarbage();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CreateSegmentFromFile()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::CreateSegmentFromFile( CMusicSegment** ppSegment,
+ TCHAR* strFileName,
+ BOOL bDownloadNow,
+ BOOL bIsMidiFile )
+{
+ HRESULT hr;
+ IDirectMusicSegment8* pSegment = NULL;
+
+ // DMusic only takes wide strings
+ WCHAR wstrFileName[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrFileName, strFileName );
+
+ if ( FAILED( hr = m_pLoader->LoadObjectFromFile( CLSID_DirectMusicSegment,
+ IID_IDirectMusicSegment8,
+ wstrFileName,
+ (LPVOID*) &pSegment ) ) )
+ {
+ if( hr == DMUS_E_LOADER_FAILEDOPEN )
+ return hr;
+ return DXTRACE_ERR( TEXT("LoadObjectFromFile"), hr );
+ }
+
+ *ppSegment = new CMusicSegment( m_pPerformance, m_pLoader, pSegment );
+ if (!*ppSegment)
+ return E_OUTOFMEMORY;
+
+ if( bIsMidiFile )
+ {
+ if( FAILED( hr = pSegment->SetParam( GUID_StandardMIDIFile,
+ 0xFFFFFFFF, 0, 0, NULL ) ) )
+ return DXTRACE_ERR( TEXT("SetParam"), hr );
+ }
+
+ if( bDownloadNow )
+ {
+ if( FAILED( hr = (*ppSegment)->Download() ) )
+ return DXTRACE_ERR( TEXT("Download"), hr );
+ }
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CreateSegmentFromResource()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::CreateSegmentFromResource( CMusicSegment** ppSegment,
+ TCHAR* strResource,
+ TCHAR* strResourceType,
+ BOOL bDownloadNow,
+ BOOL bIsMidiFile )
+{
+ HRESULT hr;
+ IDirectMusicSegment8* pSegment = NULL;
+ HRSRC hres = NULL;
+ void* pMem = NULL;
+ DWORD dwSize = 0;
+ DMUS_OBJECTDESC objdesc;
+
+ // Find the resource
+ hres = FindResource( NULL,strResource,strResourceType );
+ if( NULL == hres )
+ return E_FAIL;
+
+ // Load the resource
+ pMem = (void*)LoadResource( NULL, hres );
+ if( NULL == pMem )
+ return E_FAIL;
+
+ // Store the size of the resource
+ dwSize = SizeofResource( NULL, hres );
+
+ // Set up our object description
+ ZeroMemory(&objdesc,sizeof(DMUS_OBJECTDESC));
+ objdesc.dwSize = sizeof(DMUS_OBJECTDESC);
+ objdesc.dwValidData = DMUS_OBJ_MEMORY | DMUS_OBJ_CLASS;
+ objdesc.guidClass = CLSID_DirectMusicSegment;
+ objdesc.llMemLength =(LONGLONG)dwSize;
+ objdesc.pbMemData = (BYTE*)pMem;
+
+ if (FAILED ( hr = m_pLoader->GetObject( &objdesc,
+ IID_IDirectMusicSegment8,
+ (void**)&pSegment ) ) )
+ {
+ if( hr == DMUS_E_LOADER_FAILEDOPEN )
+ return hr;
+ return DXTRACE_ERR( TEXT("LoadObjectFromFile"), hr );
+ }
+
+ *ppSegment = new CMusicSegment( m_pPerformance, m_pLoader, pSegment );
+ if( NULL == *ppSegment )
+ return E_OUTOFMEMORY;
+
+ if( bIsMidiFile )
+ {
+ // Do this to make sure that the default General MIDI set
+ // is connected appropriately to the MIDI file and
+ // all instruments sound correct.
+ if( FAILED( hr = pSegment->SetParam( GUID_StandardMIDIFile,
+ 0xFFFFFFFF, 0, 0, NULL ) ) )
+ return DXTRACE_ERR( TEXT("SetParam"), hr );
+ }
+
+ if( bDownloadNow )
+ {
+ // The segment needs to be download first before playing.
+ // However, some apps may want to wait before calling this
+ // to because the download allocates memory for the
+ // instruments. The more instruments currently downloaded,
+ // the more memory is in use by the synthesizer.
+ if( FAILED( hr = (*ppSegment)->Download() ) )
+ return DXTRACE_ERR( TEXT("Download"), hr );
+ }
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CreateScriptFromFile()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::CreateScriptFromFile( CMusicScript** ppScript,
+ TCHAR* strFileName )
+{
+ HRESULT hr;
+ IDirectMusicScript* pScript = NULL;
+
+ // DMusic only takes wide strings
+ WCHAR wstrFileName[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrFileName, strFileName );
+
+ if ( FAILED( hr = m_pLoader->LoadObjectFromFile( CLSID_DirectMusicScript,
+ IID_IDirectMusicScript8,
+ wstrFileName,
+ (LPVOID*) &pScript ) ) )
+ return DXTRACE_ERR_NOMSGBOX( TEXT("LoadObjectFromFile"), hr );
+
+ if ( FAILED( hr = pScript->Init( m_pPerformance, NULL ) ) )
+ return DXTRACE_ERR( TEXT("Init"), hr );
+
+ *ppScript = new CMusicScript( m_pPerformance, m_pLoader, pScript );
+ if (!*ppScript)
+ return E_OUTOFMEMORY;
+
+ return hr;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CreateChordMapFromFile()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::CreateChordMapFromFile( IDirectMusicChordMap8** ppChordMap,
+ TCHAR* strFileName )
+{
+ // DMusic only takes wide strings
+ WCHAR wstrFileName[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrFileName, strFileName );
+
+ return m_pLoader->LoadObjectFromFile( CLSID_DirectMusicChordMap,
+ IID_IDirectMusicChordMap8,
+ wstrFileName, (LPVOID*) ppChordMap );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::CreateChordMapFromFile()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::CreateStyleFromFile( IDirectMusicStyle8** ppStyle,
+ TCHAR* strFileName )
+{
+ // DMusic only takes wide strings
+ WCHAR wstrFileName[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrFileName, strFileName );
+
+ return m_pLoader->LoadObjectFromFile( CLSID_DirectMusicStyle,
+ IID_IDirectMusicStyle8,
+ wstrFileName, (LPVOID*) ppStyle );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicManager::GetMotifFromStyle()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicManager::GetMotifFromStyle( IDirectMusicSegment8** ppMotif8,
+ TCHAR* strStyle, TCHAR* strMotif )
+{
+ HRESULT hr;
+ IDirectMusicStyle8* pStyle = NULL;
+ IDirectMusicSegment* pMotif = NULL;
+
+ if( FAILED( hr = CreateStyleFromFile( &pStyle, strStyle ) ) )
+ return DXTRACE_ERR( TEXT("CreateStyleFromFile"), hr );
+
+ if( pStyle )
+ {
+ // DMusic only takes wide strings
+ WCHAR wstrMotif[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrMotif, strMotif );
+
+ hr = pStyle->GetMotif( wstrMotif, &pMotif );
+ SAFE_RELEASE( pStyle );
+
+ if( FAILED( hr ) )
+ return DXTRACE_ERR( TEXT("GetMotif"), hr );
+
+ pMotif->QueryInterface( IID_IDirectMusicSegment8, (LPVOID*) ppMotif8 );
+ }
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::CMusicSegment()
+// Desc: Constructs the class
+//-----------------------------------------------------------------------------
+CMusicSegment::CMusicSegment( IDirectMusicPerformance8* pPerformance,
+ IDirectMusicLoader8* pLoader,
+ IDirectMusicSegment8* pSegment )
+{
+ m_pPerformance = pPerformance;
+ m_pLoader = pLoader;
+ m_pSegment = pSegment;
+ m_pEmbeddedAudioPath = NULL;
+ m_bDownloaded = FALSE;
+
+ // Try to pull out an audio path from the segment itself if there is one.
+ // This embedded audio path will be used instead of the default
+ // audio path if the app doesn't wish to use an overriding audio path.
+ IUnknown* pConfig = NULL;
+ if( SUCCEEDED( m_pSegment->GetAudioPathConfig( &pConfig ) ) )
+ {
+ m_pPerformance->CreateAudioPath( pConfig, TRUE, &m_pEmbeddedAudioPath );
+ SAFE_RELEASE( pConfig );
+ }
+
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::~CMusicSegment()
+// Desc: Destroys the class
+//-----------------------------------------------------------------------------
+CMusicSegment::~CMusicSegment()
+{
+ if( m_pSegment )
+ {
+ // Tell the loader that this object should now be released
+ if( m_pLoader )
+ m_pLoader->ReleaseObjectByUnknown( m_pSegment );
+
+ if( m_bDownloaded )
+ {
+ if( m_pEmbeddedAudioPath )
+ m_pSegment->Unload( m_pEmbeddedAudioPath );
+ else
+ m_pSegment->Unload( m_pPerformance );
+ }
+
+ SAFE_RELEASE( m_pEmbeddedAudioPath );
+ SAFE_RELEASE( m_pSegment );
+ }
+
+ m_pPerformance = NULL;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::Play()
+// Desc: Plays the sound using voice management flags. Pass in DSBPLAY_LOOPING
+// in the dwFlags to loop the sound
+//-----------------------------------------------------------------------------
+HRESULT CMusicSegment::Play( DWORD dwFlags, IDirectMusicAudioPath8* pAudioPath )
+{
+ if( m_pSegment == NULL || m_pPerformance == NULL )
+ return CO_E_NOTINITIALIZED;
+
+ if( !m_bDownloaded )
+ return E_FAIL;
+
+ // If an audio path was passed in then use it, otherwise
+ // use the embedded audio path if there was one.
+ if( pAudioPath == NULL && m_pEmbeddedAudioPath != NULL )
+ pAudioPath = m_pEmbeddedAudioPath;
+
+ // If pAudioPath is NULL then this plays on the default audio path.
+ return m_pPerformance->PlaySegmentEx( m_pSegment, 0, NULL, dwFlags,
+ 0, 0, NULL, pAudioPath );
+}
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::Download()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicSegment::Download( IDirectMusicAudioPath8* pAudioPath )
+{
+ HRESULT hr;
+
+ if( m_pSegment == NULL )
+ return CO_E_NOTINITIALIZED;
+
+ // If no audio path was passed in, then download
+ // to the embedded audio path if it exists
+ // else download to the performance
+ if( pAudioPath == NULL )
+ {
+ if( m_pEmbeddedAudioPath )
+ hr = m_pSegment->Download( m_pEmbeddedAudioPath );
+ else
+ hr = m_pSegment->Download( m_pPerformance );
+ }
+ else
+ {
+ hr = m_pSegment->Download( pAudioPath );
+ }
+
+ if ( SUCCEEDED( hr ) )
+ m_bDownloaded = TRUE;
+
+ return hr;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::Unload()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicSegment::Unload( IDirectMusicAudioPath8* pAudioPath )
+{
+ HRESULT hr;
+
+ if( m_pSegment == NULL )
+ return CO_E_NOTINITIALIZED;
+
+ // If no audio path was passed in, then unload
+ // from the embedded audio path if it exists
+ // else unload from the performance
+ if( pAudioPath == NULL )
+ {
+ if( m_pEmbeddedAudioPath )
+ hr = m_pSegment->Unload( m_pEmbeddedAudioPath );
+ else
+ hr = m_pSegment->Unload( m_pPerformance );
+ }
+ else
+ {
+ hr = m_pSegment->Unload( pAudioPath );
+ }
+
+ if ( SUCCEEDED( hr ) )
+ m_bDownloaded = FALSE;
+
+ return hr;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::IsPlaying()
+// Desc:
+//-----------------------------------------------------------------------------
+BOOL CMusicSegment::IsPlaying()
+{
+ if( m_pSegment == NULL || m_pPerformance == NULL )
+ return CO_E_NOTINITIALIZED;
+
+ return ( m_pPerformance->IsPlaying( m_pSegment, NULL ) == S_OK );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::Stop()
+// Desc: Stops the sound from playing
+//-----------------------------------------------------------------------------
+HRESULT CMusicSegment::Stop( DWORD dwFlags )
+{
+ if( m_pSegment == NULL || m_pPerformance == NULL )
+ return CO_E_NOTINITIALIZED;
+
+ return m_pPerformance->Stop( m_pSegment, NULL, 0, dwFlags );;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::SetRepeats()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicSegment::SetRepeats( DWORD dwRepeats )
+{
+ if( m_pSegment == NULL )
+ return CO_E_NOTINITIALIZED;
+
+ return m_pSegment->SetRepeats( dwRepeats );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicSegment::GetStyle()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CMusicSegment::GetStyle( IDirectMusicStyle8** ppStyle, DWORD dwStyleIndex )
+{
+ // Get the Style from the Segment by calling the Segment's GetData() with
+ // the data type GUID_StyleTrackStyle. 0xffffffff indicates to look at
+ // tracks in all TrackGroups in the segment. The first 0 indicates to
+ // retrieve the Style from the first Track in the indicated TrackGroup.
+ // The second 0 indicates to retrieve the Style from the beginning of the
+ // segment, i.e. time 0 in Segment time. If this Segment was loaded from a
+ // section file, there is only one Style and it is at time 0.
+ return m_pSegment->GetParam( GUID_IDirectMusicStyle, 0xffffffff, dwStyleIndex,
+ 0, NULL, (VOID*)ppStyle );
+}
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicScript::CMusicScript()
+// Desc: Constructs the class
+//-----------------------------------------------------------------------------
+CMusicScript::CMusicScript( IDirectMusicPerformance8* pPerformance,
+ IDirectMusicLoader8* pLoader,
+ IDirectMusicScript8* pScript )
+{
+ m_pPerformance = pPerformance;
+ m_pLoader = pLoader;
+ m_pScript = pScript;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicScript::~CMusicScript()
+// Desc: Destroys the class
+//-----------------------------------------------------------------------------
+CMusicScript::~CMusicScript()
+{
+ if( m_pLoader )
+ {
+ // Tell the loader that this object should now be released
+ m_pLoader->ReleaseObjectByUnknown( m_pScript );
+ m_pLoader = NULL;
+ }
+
+ SAFE_RELEASE( m_pScript );
+ m_pPerformance = NULL;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicScript::Play()
+// Desc: Calls a routine in the script
+//-----------------------------------------------------------------------------
+HRESULT CMusicScript::CallRoutine( TCHAR* strRoutine )
+{
+ // DMusic only takes wide strings
+ WCHAR wstrRoutine[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrRoutine, strRoutine );
+
+ return m_pScript->CallRoutine( wstrRoutine, NULL );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicScript::SetVariableNumber()
+// Desc: Sets the value of a variable in the script
+//-----------------------------------------------------------------------------
+HRESULT CMusicScript::SetVariableNumber( TCHAR* strVariable, LONG lValue )
+{
+ // DMusic only takes wide strings
+ WCHAR wstrVariable[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrVariable, strVariable );
+
+ return m_pScript->SetVariableNumber( wstrVariable, lValue, NULL );
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CMusicScript::GetVariableNumber()
+// Desc: Gets the value of a variable in the script
+//-----------------------------------------------------------------------------
+HRESULT CMusicScript::GetVariableNumber( TCHAR* strVariable, LONG* plValue )
+{
+ // DMusic only takes wide strings
+ WCHAR wstrVariable[MAX_PATH];
+ DXUtil_ConvertGenericStringToWide( wstrVariable, strVariable );
+
+ return m_pScript->GetVariableNumber( wstrVariable, plValue, NULL );
+}
+
+
+
diff --git a/plugins/!NotAdopted/sndVol/dmutil.h b/plugins/!NotAdopted/sndVol/dmutil.h new file mode 100644 index 0000000000..99cc464e61 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/dmutil.h @@ -0,0 +1,126 @@ +//-----------------------------------------------------------------------------
+// File: DMUtil.h
+//
+// Desc:
+//
+// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
+//-----------------------------------------------------------------------------
+#ifndef DMUTIL_H
+#define DMUTIL_H
+
+#include <dmusicc.h>
+#include <dmusici.h>
+#include <dsound.h>
+
+
+//-----------------------------------------------------------------------------
+// Classes used by this header
+//-----------------------------------------------------------------------------
+class CMusicManager;
+class CMusicSegment;
+class CMusicScript;
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: class CMusicManager
+// Desc:
+//-----------------------------------------------------------------------------
+class CMusicManager
+{
+protected:
+ BOOL m_bCleanupCOM;
+ IDirectMusicLoader8* m_pLoader;
+ IDirectMusicPerformance8* m_pPerformance;
+
+public:
+ CMusicManager();
+ ~CMusicManager();
+
+ inline IDirectMusicLoader8* GetLoader() { return m_pLoader; }
+ inline IDirectMusicPerformance8* GetPerformance() { return m_pPerformance; }
+ IDirectMusicAudioPath8* GetDefaultAudioPath();
+
+ HRESULT Initialize( HWND hWnd, DWORD dwPChannels = 128, DWORD dwDefaultPathType = DMUS_APATH_DYNAMIC_STEREO );
+
+ HRESULT SetSearchDirectory( const TCHAR* strMediaPath );
+ VOID CollectGarbage();
+
+ HRESULT CreateSegmentFromFile( CMusicSegment** ppSegment, TCHAR* strFileName,
+ BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
+ HRESULT CreateScriptFromFile( CMusicScript** ppScript, TCHAR* strFileName );
+
+ HRESULT CreateChordMapFromFile( IDirectMusicChordMap8** ppChordMap, TCHAR* strFileName );
+ HRESULT CreateStyleFromFile( IDirectMusicStyle8** ppStyle, TCHAR* strFileName );
+ HRESULT GetMotifFromStyle( IDirectMusicSegment8** ppMotif, TCHAR* strStyle, TCHAR* wstrMotif );
+
+ HRESULT CreateSegmentFromResource( CMusicSegment** ppSegment, TCHAR* strResource, TCHAR* strResourceType,
+ BOOL bDownloadNow = TRUE, BOOL bIsMidiFile = FALSE );
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: class CMusicSegment
+// Desc: Encapsulates functionality of an IDirectMusicSegment
+//-----------------------------------------------------------------------------
+class CMusicSegment
+{
+protected:
+ IDirectMusicSegment8* m_pSegment;
+ IDirectMusicLoader8* m_pLoader;
+ IDirectMusicPerformance8* m_pPerformance;
+ IDirectMusicAudioPath8* m_pEmbeddedAudioPath;
+ BOOL m_bDownloaded;
+
+public:
+ CMusicSegment( IDirectMusicPerformance8* pPerformance,
+ IDirectMusicLoader8* pLoader,
+ IDirectMusicSegment8* pSegment );
+ virtual ~CMusicSegment();
+
+ inline IDirectMusicSegment8* GetSegment() { return m_pSegment; }
+ HRESULT GetStyle( IDirectMusicStyle8** ppStyle, DWORD dwStyleIndex = 0 );
+
+ HRESULT SetRepeats( DWORD dwRepeats );
+ HRESULT Play( DWORD dwFlags = DMUS_SEGF_SECONDARY, IDirectMusicAudioPath8* pAudioPath = NULL );
+ HRESULT Stop( DWORD dwFlags = 0 );
+ HRESULT Download( IDirectMusicAudioPath8* pAudioPath = NULL );
+ HRESULT Unload( IDirectMusicAudioPath8* pAudioPath = NULL );
+
+ BOOL IsPlaying();
+};
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: class CMusicScript
+// Desc: Encapsulates functionality of an IDirectMusicScript
+//-----------------------------------------------------------------------------
+class CMusicScript
+{
+protected:
+ IDirectMusicScript8* m_pScript;
+ IDirectMusicLoader8* m_pLoader;
+ IDirectMusicPerformance8* m_pPerformance;
+
+public:
+ CMusicScript( IDirectMusicPerformance8* pPerformance,
+ IDirectMusicLoader8* pLoader,
+ IDirectMusicScript8* pScript );
+ virtual ~CMusicScript();
+
+ inline IDirectMusicScript8* GetScript() { return m_pScript; }
+
+ HRESULT CallRoutine( TCHAR* strRoutine );
+ HRESULT SetVariableNumber( TCHAR* strVariable, LONG lValue );
+ HRESULT GetVariableNumber( TCHAR* strVariable, LONG* plValue );
+};
+
+
+
+
+#endif // DMUTIL_H
diff --git a/plugins/!NotAdopted/sndVol/dxutil.cpp b/plugins/!NotAdopted/sndVol/dxutil.cpp new file mode 100644 index 0000000000..7cf3ecd863 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/dxutil.cpp @@ -0,0 +1,226 @@ +//-----------------------------------------------------------------------------
+// File: DXUtil.cpp
+//
+// Desc: Shortcut macros and functions for using DX objects
+//
+//
+// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved
+//-----------------------------------------------------------------------------
+#define STRICT
+#include <windows.h>
+#include <mmsystem.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include "DXUtil.h"
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_ConvertAnsiStringToWide()
+// Desc: This is a UNICODE conversion utility to convert a CHAR string into a
+// WCHAR string. cchDestChar defaults -1 which means it
+// assumes strDest is large enough to store strSource
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertAnsiStringToWide( WCHAR* wstrDestination, const CHAR* strSource,
+ int cchDestChar )
+{
+ if( wstrDestination==NULL || strSource==NULL )
+ return;
+
+ if( cchDestChar == -1 )
+ cchDestChar = strlen(strSource)+1;
+
+ MultiByteToWideChar( CP_ACP, 0, strSource, -1,
+ wstrDestination, cchDestChar-1 );
+
+ wstrDestination[cchDestChar-1] = 0;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_ConvertWideStringToAnsi()
+// Desc: This is a UNICODE conversion utility to convert a WCHAR string into a
+// CHAR string. cchDestChar defaults -1 which means it
+// assumes strDest is large enough to store strSource
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertWideStringToAnsi( CHAR* strDestination, const WCHAR* wstrSource,
+ int cchDestChar )
+{
+ if( strDestination==NULL || wstrSource==NULL )
+ return;
+
+ if( cchDestChar == -1 )
+ cchDestChar = wcslen(wstrSource)+1;
+
+ WideCharToMultiByte( CP_ACP, 0, wstrSource, -1, strDestination,
+ cchDestChar-1, NULL, NULL );
+
+ strDestination[cchDestChar-1] = 0;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_ConvertGenericStringToAnsi()
+// Desc: This is a UNICODE conversion utility to convert a TCHAR string into a
+// CHAR string. cchDestChar defaults -1 which means it
+// assumes strDest is large enough to store strSource
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertGenericStringToAnsi( CHAR* strDestination, const TCHAR* tstrSource,
+ int cchDestChar )
+{
+ if( strDestination==NULL || tstrSource==NULL || cchDestChar == 0 )
+ return;
+
+#ifdef _UNICODE
+ DXUtil_ConvertWideStringToAnsi( strDestination, tstrSource, cchDestChar );
+#else
+ if( cchDestChar == -1 )
+ {
+ strcpy( strDestination, tstrSource );
+ }
+ else
+ {
+ strncpy( strDestination, tstrSource, cchDestChar );
+ strDestination[cchDestChar-1] = '\0';
+ }
+#endif
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_ConvertGenericStringToWide()
+// Desc: This is a UNICODE conversion utility to convert a TCHAR string into a
+// WCHAR string. cchDestChar defaults -1 which means it
+// assumes strDest is large enough to store strSource
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertGenericStringToWide( WCHAR* wstrDestination, const TCHAR* tstrSource,
+ int cchDestChar )
+{
+ if( wstrDestination==NULL || tstrSource==NULL || cchDestChar == 0 )
+ return;
+
+#ifdef _UNICODE
+ if( cchDestChar == -1 )
+ {
+ wcscpy( wstrDestination, tstrSource );
+ }
+ else
+ {
+ wcsncpy( wstrDestination, tstrSource, cchDestChar );
+ wstrDestination[cchDestChar-1] = L'\0';
+ }
+#else
+ DXUtil_ConvertAnsiStringToWide( wstrDestination, tstrSource, cchDestChar );
+#endif
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_ConvertAnsiStringToGeneric()
+// Desc: This is a UNICODE conversion utility to convert a CHAR string into a
+// TCHAR string. cchDestChar defaults -1 which means it
+// assumes strDest is large enough to store strSource
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertAnsiStringToGeneric( TCHAR* tstrDestination, const CHAR* strSource,
+ int cchDestChar )
+{
+ if( tstrDestination==NULL || strSource==NULL || cchDestChar == 0 )
+ return;
+
+#ifdef _UNICODE
+ DXUtil_ConvertAnsiStringToWide( tstrDestination, strSource, cchDestChar );
+#else
+ if( cchDestChar == -1 )
+ {
+ strcpy( tstrDestination, strSource );
+ }
+ else
+ {
+ strncpy( tstrDestination, strSource, cchDestChar );
+ tstrDestination[cchDestChar-1] = '\0';
+ }
+#endif
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_ConvertAnsiStringToGeneric()
+// Desc: This is a UNICODE conversion utility to convert a WCHAR string into a
+// TCHAR string. cchDestChar defaults -1 which means it
+// assumes strDest is large enough to store strSource
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertWideStringToGeneric( TCHAR* tstrDestination, const WCHAR* wstrSource,
+ int cchDestChar )
+{
+ if( tstrDestination==NULL || wstrSource==NULL || cchDestChar == 0 )
+ return;
+
+#ifdef _UNICODE
+ if( cchDestChar == -1 )
+ {
+ wcscpy( tstrDestination, wstrSource );
+ }
+ else
+ {
+ wcsncpy( tstrDestination, wstrSource, cchDestChar );
+ tstrDestination[cchDestChar-1] = L'\0';
+ }
+#else
+ DXUtil_ConvertWideStringToAnsi( tstrDestination, wstrSource, cchDestChar );
+#endif
+}
+
+//-----------------------------------------------------------------------------
+// Name: _DbgOut()
+// Desc: Outputs a message to the debug stream
+//-----------------------------------------------------------------------------
+HRESULT _DbgOut( TCHAR* strFile, DWORD dwLine, HRESULT hr, TCHAR* strMsg )
+{
+ TCHAR buffer[256];
+ wsprintf( buffer, _T("%s(%ld): "), strFile, dwLine );
+ OutputDebugString( buffer );
+ OutputDebugString( strMsg );
+
+ if( hr )
+ {
+ wsprintf( buffer, _T("(hr=%08lx)\n"), hr );
+ OutputDebugString( buffer );
+ }
+
+ OutputDebugString( _T("\n") );
+
+ return hr;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DXUtil_Trace()
+// Desc: Outputs to the debug stream a formatted string with a variable-
+// argument list.
+//-----------------------------------------------------------------------------
+VOID DXUtil_Trace( TCHAR* strMsg, ... )
+{
+#if defined(DEBUG) | defined(_DEBUG)
+ TCHAR strBuffer[512];
+
+ va_list args;
+ va_start(args, strMsg);
+ _vsntprintf( strBuffer, 512, strMsg, args );
+ va_end(args);
+
+ OutputDebugString( strBuffer );
+#else
+ UNREFERENCED_PARAMETER(strMsg);
+#endif
+}
diff --git a/plugins/!NotAdopted/sndVol/dxutil.h b/plugins/!NotAdopted/sndVol/dxutil.h new file mode 100644 index 0000000000..cfded98bcd --- /dev/null +++ b/plugins/!NotAdopted/sndVol/dxutil.h @@ -0,0 +1,49 @@ +//-----------------------------------------------------------------------------
+// File: DXUtil.h
+//
+// Desc: Helper functions and typing shortcuts for DirectX programming.
+//
+// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved
+//-----------------------------------------------------------------------------
+#ifndef DXUTIL_H
+#define DXUTIL_H
+
+//-----------------------------------------------------------------------------
+// UNICODE support for converting between CHAR, TCHAR, and WCHAR strings
+//-----------------------------------------------------------------------------
+VOID DXUtil_ConvertAnsiStringToWide( WCHAR* wstrDestination, const CHAR* strSource, int cchDestChar = -1 );
+VOID DXUtil_ConvertWideStringToAnsi( CHAR* strDestination, const WCHAR* wstrSource, int cchDestChar = -1 );
+VOID DXUtil_ConvertGenericStringToAnsi( CHAR* strDestination, const TCHAR* tstrSource, int cchDestChar = -1 );
+VOID DXUtil_ConvertGenericStringToWide( WCHAR* wstrDestination, const TCHAR* tstrSource, int cchDestChar = -1 );
+VOID DXUtil_ConvertAnsiStringToGeneric( TCHAR* tstrDestination, const CHAR* strSource, int cchDestChar = -1 );
+VOID DXUtil_ConvertWideStringToGeneric( TCHAR* tstrDestination, const WCHAR* wstrSource, int cchDestChar = -1 );
+
+//-----------------------------------------------------------------------------
+// Miscellaneous helper functions
+//-----------------------------------------------------------------------------
+#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
+#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
+#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
+
+//-----------------------------------------------------------------------------
+// Debug printing support
+//-----------------------------------------------------------------------------
+VOID DXUtil_Trace( TCHAR* strMsg, ... );
+HRESULT _DbgOut( TCHAR*, DWORD, HRESULT, TCHAR* );
+
+#if defined(DEBUG) | defined(_DEBUG)
+ #define DXTRACE DXUtil_Trace
+#else
+ #define DXTRACE sizeof
+#endif
+
+#if defined(DEBUG) | defined(_DEBUG)
+ #define DEBUG_MSG(str) _DbgOut( __FILE__, (DWORD)__LINE__, 0, str )
+#else
+ #define DEBUG_MSG(str) (0L)
+#endif
+
+
+
+
+#endif // DXUTIL_H
diff --git a/plugins/!NotAdopted/sndVol/m_cluiframes.h b/plugins/!NotAdopted/sndVol/m_cluiframes.h new file mode 100644 index 0000000000..d046439346 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/m_cluiframes.h @@ -0,0 +1,128 @@ +/*
+Miranda ICQ: the free icq client for MS Windows
+Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede
+
+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.
+*/
+
+//#include "../../core/commonheaders.h"
+//#pragma hdrstop
+
+//adds a frame window
+//wParam=(CLISTFrame*)
+//lParam=0
+//returns an integer, the frame id.
+typedef struct tagCLISTFrame {
+ DWORD cbSize;
+ HWND hWnd ;
+ HICON hIcon;
+ int align; //al flags below
+ int height;
+ int Flags; //F_flags below
+ char *name; //frame window name,will be shown in menu
+ char *TBname; //titlebar caption
+ //COLORREF TBBackColour; //titlebar background colour
+} CLISTFrame;
+#define F_VISIBLE 1 //Frame visible
+#define F_SHOWTB 2 //Show TitleBar
+#define F_UNCOLLAPSED 4 //UnCollapse frame
+#define F_LOCKED 8 //Lock Frame
+#define F_NOBORDER 16 //Dont apply WS_BORDER style for window
+#define F_SHOWTBTIP 32 //Show titlebar tooltip
+
+
+// frame alignment
+#define alTop 0x00000001
+#define alBottom 0x00000002
+#define alClient 0x00000004 //only one alClient frame
+#define MS_CLIST_FRAMES_ADDFRAME "CListFrames/AddFrame"
+
+#define MS_CLIST_FRAMES_REMOVEFRAME "CListFrames/RemoveFrame"
+
+//shows all frames
+//wParam=lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SHOWALLFRAMES "CListFrames/ShowALLFrames"
+
+//shows the titlebars of all frames
+//wParam=lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SHOWALLFRAMESTB "CListFrames/ShowALLFramesTB"
+
+//hides the titlebars of all frames
+//wParam=lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_HIDEALLFRAMESTB "CListFrames/HideALLFramesTB"
+
+//shows the frame if it is hidden,
+//hides the frame if it is shown
+//wParam=FrameId
+//lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SHFRAME "CListFrames/SHFrame"
+
+//shows the frame titlebar if it is hidden,
+//hides the frame titlebar if it is shown
+//wParam=FrameId
+//lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SHFRAMETITLEBAR "CListFrame/SHFrameTitleBar"
+
+//locks the frame if it is unlocked,
+//unlock the frame if it is locked
+//wParam=FrameId
+//lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_ULFRAME "CListFrame/ULFrame"
+
+//collapses the frame if it is uncollapsed,
+//uncollapses the frame if it is collapsed
+//wParam=FrameId
+//lParam=0
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_UCOLLFRAME "CListFrame/UCOLLFrame"
+
+//redraws the frame
+//wParam=FrameId, -1 for all frames
+//lparam=FU_flags
+//returns a pointer to option, -1 on failure
+#define FU_TBREDRAW 1 //redraw titlebar
+#define FU_FMREDRAW 2 //redraw Frame
+#define FU_FMPOS 4 //update Frame position
+#define MS_CLIST_FRAMES_UPDATEFRAME "CListFrame/UpdateFrame"
+
+//gets the frame options
+//(HIWORLD)wParam=FrameId
+//(LOWORD)wParam=FO_flag
+//lParam=0
+//returns a pointer to option, -1 on failure
+#define FO_FLAGS 0x0001 //return set of F_VISIBLE,F_SHOWTB,F_UNCOLLAPSED,F_LOCKED,F_NOBORDER,F_SHOWTBTIP
+#define FO_NAME 0x0002 //Change name
+#define FO_TBNAME 0x0003 //Change TB caption
+#define FO_TBSTYLE 0x0004 //Change TB style
+#define FO_TBEXSTYLE 0x0005 //Change TB exstyle
+#define FO_ICON 0x0006 //Change icon
+#define FO_HEIGHT 0x0007 //Change height
+#define FO_ALIGN 0x0008 //Change align
+#define FO_TBTIPNAME 0x0009 //Change TB tooltip
+
+#define MS_CLIST_FRAMES_GETFRAMEOPTIONS "CListFrame/GetFrameOptions"
+
+//sets the frame options
+//(HIWORLD)wParam=FrameId
+//(LOWORD)wParam=FO_flag
+//lParam=value
+//returns 0 on success, -1 on failure
+#define MS_CLIST_FRAMES_SETFRAMEOPTIONS "CListFrame/SetFrameOptions"
diff --git a/plugins/!NotAdopted/sndVol/nosnd.ico b/plugins/!NotAdopted/sndVol/nosnd.ico Binary files differnew file mode 100644 index 0000000000..231bc4187d --- /dev/null +++ b/plugins/!NotAdopted/sndVol/nosnd.ico diff --git a/plugins/!NotAdopted/sndVol/optionsdlg.cpp b/plugins/!NotAdopted/sndVol/optionsdlg.cpp new file mode 100644 index 0000000000..88443448c0 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/optionsdlg.cpp @@ -0,0 +1,146 @@ +#include "plugin.h"
+#include "playSnd.h"
+#include "resource.h"
+#include "optionsdlg.h"
+
+#include <math.h>
+
+#pragma comment(lib, "comctl32.lib")
+
+
+LRESULT CALLBACK GroupWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch( uMsg )
+ {
+ case WM_LBUTTONDOWN:
+ ::MessageBox(0,"LB","",0);
+ return 0;
+ case WM_PAINT:
+ {
+ CallWindowProc((WNDPROC)GetWindowLong(hwnd, GWL_USERDATA), hwnd, uMsg, wParam, lParam);
+
+ HDC hdc = GetDC(hwnd);
+ RECT rc;
+ char szTitle[256];
+ HFONT oldfont;
+ int oldBk;
+ ZeroMemory(&rc, sizeof(rc));
+ // Determine a size of the text
+
+ oldBk = SetBkMode(hdc, TRANSPARENT);
+ oldfont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(hwnd, WM_GETFONT, 0,0));
+ SetBkMode(hdc, TRANSPARENT);
+ GetWindowText(hwnd, szTitle, sizeof(szTitle));
+ DrawText(hdc, szTitle, lstrlen(szTitle), &rc, DT_SINGLELINE|DT_CALCRECT);
+
+ rc.left += 8; rc.right += 8 + 16 + 4;
+
+ FillRect(hdc, &rc, (HBRUSH) (COLOR_BTNFACE+1));
+ DrawIconEx(hdc, rc.left+2, rc.top, hSoundOn, 16,16, 0, NULL, DI_NORMAL);
+
+ rc.left += 2 + 16 + 2;
+ //rc.right += 2 + 16 + 2;
+ DrawText(hdc, szTitle, lstrlen(szTitle), &rc, DT_SINGLELINE|DT_WORD_ELLIPSIS);
+
+ SetBkMode(hdc, oldBk);
+
+ SelectObject(hdc, oldfont);
+
+ ReleaseDC(hwnd, hdc);
+
+ return 0;
+ }
+ }
+
+ return CallWindowProc((WNDPROC)GetWindowLong(hwnd, GWL_USERDATA), hwnd, uMsg, wParam, lParam);
+}
+//
+// OptionsDlgProc()
+// this handles the options page
+// verwaltet die Optionsseite
+//
+LRESULT CALLBACK OptionsDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+{
+ switch( uMsg )
+ {
+ case WM_INITDIALOG:
+ {
+ HWND grp = GetDlgItem(hwndDlg, IDC_GRP);
+
+ TranslateDialogDefault(hwndDlg);
+ CheckDlgButton(hwndDlg, IDC_AUTO, DBGetContactSettingByte(NULL,SERVICENAME,"AutoPreview", TRUE)?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MUTE, DBGetContactSettingByte(NULL,SERVICENAME,"MuteBtn", TRUE)?BST_CHECKED:BST_UNCHECKED);
+
+ hwndOptSlider = GetDlgItem(hwndDlg, IDC_VOLUME);
+ SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN,SLIDER_MAX));
+ SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL,SERVICENAME,"Volume",100));
+
+ SetWindowLong(grp, GWL_USERDATA, GetWindowLong(grp, GWL_WNDPROC));
+ SetWindowLong(grp, GWL_WNDPROC, (LONG)GroupWndProc);
+
+ return TRUE;
+ }
+ case WM_HSCROLL:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_COMMAND:
+ if(LOWORD(wParam) == IDC_TEST)
+ {
+ //playSnd::g_bInOption = TRUE;
+ playSnd::SetVolume((DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0));
+ SkinPlaySound("RecvMsg");
+ //playSnd::g_bInOption = FALSE;
+ return FALSE;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0,0);
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->code)
+ {
+ case NM_RELEASEDCAPTURE:
+ if(IsDlgButtonChecked(hwndDlg, IDC_AUTO) == BST_CHECKED)
+ {
+ int value = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
+ if(hwndSlider) SendMessage(hwndSlider, TBM_SETPOS, TRUE, value/SLIDER_DIV);
+
+ //playSnd::g_bInOption = TRUE;
+ playSnd::SetVolume(value);
+ SkinPlaySound("RecvMsg");
+ //playSnd::g_bInOption = FALSE;
+ }
+ break;
+ case PSN_APPLY:
+ {
+ int value = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0);
+ if(hwndSlider) SendMessage(hwndSlider, TBM_SETPOS, TRUE, value/SLIDER_DIV);
+ playSnd::SetVolume(value);
+ DBWriteContactSettingDword(NULL, SERVICENAME, "Volume", value);
+ autoPreview = (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_AUTO) == BST_CHECKED);
+ DBWriteContactSettingByte(NULL, SERVICENAME, "AutoPreview", autoPreview);
+ value = (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_MUTE) == BST_CHECKED);
+ DBWriteContactSettingByte(NULL, SERVICENAME, "MuteBtn", value);
+ PostMessage(hwndFrame, WM_USER, value, 0);
+
+ return TRUE;
+ }
+ case PSN_RESET:
+ {
+ int value = DBGetContactSettingDword(NULL,SERVICENAME,"Volume",100);
+ SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETPOS, TRUE, value);
+ if(hwndSlider) SendMessage(hwndSlider, TBM_SETPOS, TRUE, value/SLIDER_DIV);
+ playSnd::SetVolume(value);
+
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_DESTROY:
+ hwndOptSlider = NULL;
+ return FALSE;
+ }
+
+ return FALSE;
+}
diff --git a/plugins/!NotAdopted/sndVol/optionsdlg.h b/plugins/!NotAdopted/sndVol/optionsdlg.h new file mode 100644 index 0000000000..ae4080788e --- /dev/null +++ b/plugins/!NotAdopted/sndVol/optionsdlg.h @@ -0,0 +1 @@ +LRESULT CALLBACK OptionsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
\ No newline at end of file diff --git a/plugins/!NotAdopted/sndVol/playSnd.cpp b/plugins/!NotAdopted/sndVol/playSnd.cpp new file mode 100644 index 0000000000..9b084ca4f1 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/playSnd.cpp @@ -0,0 +1,137 @@ +#include "plugin.h"
+#include "playSnd.h"
+
+namespace playSnd
+{
+
+CMusicManager* g_pMusicManager = NULL;
+CMusicSegment* g_pMusicSegment = NULL;
+HANDLE g_hDMusicMessageEvent = NULL;
+DWORD g_dwVolume = -77777;
+BOOL g_bInOption = FALSE;
+
+
+HRESULT Init()
+{
+ HRESULT hr;
+ g_pMusicManager = new CMusicManager();
+
+ if( FAILED( hr = g_pMusicManager->Initialize( NULL ) ) )
+ return DXTRACE_ERR( TEXT("Initialize"), hr );
+
+ return S_OK;
+}
+
+void Destroy()
+{
+ SAFE_DELETE( g_pMusicSegment );
+ SAFE_DELETE( g_pMusicManager );
+}
+
+//-----------------------------------------------------------------------------
+// Name: LoadSegmentFile()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT LoadSegmentFile( char* strFileName )
+{
+ HRESULT hr;
+
+ // Free any previous segment, and make a new one
+ SAFE_DELETE( g_pMusicSegment );
+
+ // Have the loader collect any garbage now that the old
+ // segment has been released
+ g_pMusicManager->CollectGarbage();
+
+ // Set the media path based on the file name (something like C:\MEDIA)
+ // to be used as the search directory for finding DirectMusic content
+ // related to this file.
+ TCHAR strMediaPath[MAX_PATH];
+ _tcscpy( strMediaPath, strFileName );
+ TCHAR* strLastSlash = _tcsrchr(strMediaPath, TEXT('\\'));
+ if(strLastSlash != NULL)
+ {
+ *strLastSlash = 0;
+ if( FAILED( hr = g_pMusicManager->SetSearchDirectory( strMediaPath ) ) )
+ return DXTRACE_ERR( TEXT("SetSearchDirectory"), hr );
+ }
+ else
+ {
+ if( FAILED( hr = g_pMusicManager->SetSearchDirectory( "" ) ) )
+ return DXTRACE_ERR( TEXT("SetSearchDirectory"), hr );
+ }
+
+ // For DirectMusic must know if the file is a standard MIDI file or not
+ // in order to load the correct instruments.
+ BOOL bMidiFile = FALSE;
+ if( strstr( strFileName, ".mid" ) != NULL ||
+ strstr( strFileName, ".rmi" ) != NULL )
+ {
+ bMidiFile = TRUE;
+ }
+
+ BOOL bWavFile = FALSE;
+ if( strstr( strFileName, ".wav" ) != NULL )
+ {
+ bWavFile = TRUE;
+ }
+
+ // Load the file into a DirectMusic segment
+ if( FAILED( g_pMusicManager->CreateSegmentFromFile( &g_pMusicSegment, strFileName,
+ TRUE, bMidiFile ) ) )
+ {
+ // Not a critical failure, so just update the status
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+BOOL WINAPI PlaySound(char* pszSound, HMODULE hmod, DWORD fdwSound)
+{
+ /*
+ if(!g_bInOption)
+ {
+ DWORD volume = (DWORD)DBGetContactSettingDword(NULL, SERVICENAME, "Volume", 100);
+
+ if(volume != g_dwVolume)
+ {
+ g_dwVolume = volume;
+ playSnd::SetVolume(g_dwVolume);
+ }
+ }
+ */
+ HRESULT hr;
+
+ if( FAILED( hr = LoadSegmentFile(pszSound) ) )
+ return FALSE;
+
+ if( FAILED( hr = g_pMusicSegment->SetRepeats( 0 ) ) )
+ return FALSE;
+
+ // Play the segment and wait. The DMUS_SEGF_BEAT indicates to play on the
+ // next beat if there is a segment currently playing.
+ if( FAILED( hr = g_pMusicSegment->Play( DMUS_SEGF_BEAT ) ) )
+ return FALSE;
+
+ return TRUE;
+}
+
+
+BOOL SetVolume(long Value)
+{
+ long value = (int)(log10(Value)/2.0*5000.0-4000.0);
+ IDirectMusicPerformance* pPerf = NULL;
+ if( g_pMusicManager )
+ pPerf = g_pMusicManager->GetPerformance();
+ if( NULL == pPerf )
+ return FALSE;
+
+ // Adjust the slider position to match GUID_PerfMasterTempo range
+ pPerf->SetGlobalParam(GUID_PerfMasterVolume, (void*)&value, sizeof(long));
+
+ return TRUE;
+}
+
+
+}
diff --git a/plugins/!NotAdopted/sndVol/playSnd.h b/plugins/!NotAdopted/sndVol/playSnd.h new file mode 100644 index 0000000000..f9a6c3299f --- /dev/null +++ b/plugins/!NotAdopted/sndVol/playSnd.h @@ -0,0 +1,24 @@ +#include <windows.h>
+#include <mmsystem.h>
+#include <basetsd.h>
+#include <dmusicc.h>
+#include <dmusici.h>
+#include <dxerr8.h>
+#include <tchar.h>
+#include "DMUtil.h"
+#include "DXUtil.h"
+
+//-----------------------------------------------------------------------------
+// Defines, constants, and global variables
+//-----------------------------------------------------------------------------
+
+namespace playSnd
+{
+ extern BOOL g_bInOption;
+
+ HRESULT Init();
+ void Destroy();
+ HRESULT LoadSegmentFile( TCHAR* strFileName );
+ BOOL WINAPI PlaySound(char* pszSound, HMODULE hmod, DWORD fdwSound);
+ BOOL SetVolume(long Value);
+}
diff --git a/plugins/!NotAdopted/sndVol/plugin.cpp b/plugins/!NotAdopted/sndVol/plugin.cpp new file mode 100644 index 0000000000..f179dbb645 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/plugin.cpp @@ -0,0 +1,362 @@ +#define _WIN32_WINNT 0x0500
+#include "plugin.h"
+#include "playSnd.h"
+#include "optionsdlg.h"
+#include "resource.h"
+#include "m_cluiframes.h"
+
+#include "IcoLib.h"
+
+HINSTANCE hInst;
+PLUGINLINK *pluginLink;
+
+HWND hwndFrame = NULL, hwndMute = NULL, hwndSlider = NULL, hwndOptSlider = NULL;
+HANDLE hHookSkinPlayingSound, hHookDbSettingChange, hHookSkinIconsChanged;
+HHOOK hHookMouse;
+bool showMute = TRUE;
+
+char szTitle[] = "sndVol";
+bool isEnabled = FALSE;
+HICON hSoundOn = NULL, hSoundOff = NULL;
+int isMuteVisible = FALSE;
+int autoPreview = FALSE;
+
+char *szIconId[2] = {"sndVol_Off", "sndVol_On"};
+char *szIconName[2] = {"Off", "On"};
+int iIconId[2] = {-IDI_SND_OFF, -IDI_SND_ON};
+
+PLUGININFO pluginInfo={
+ sizeof( PLUGININFO ),
+ szTitle,
+ PLUGIN_MAKE_VERSION( 0,0,1,1 ),
+ "Volume control 4 Miranda's events sound",
+ "Denis Stanishevskiy // StDenis",
+ "stdenformiranda(at)fromru(dot)com",
+ "Copyright (c) 2005, Denis Stanishevskiy",
+ "",
+ 0, 0
+};
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+{
+ hInst=hinstDLL;
+ if(fdwReason == DLL_PROCESS_ATTACH)
+ DisableThreadLibraryCalls(GetModuleHandle("sndvol"));
+ return TRUE;
+}
+
+__declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
+{
+ return &pluginInfo;
+}
+
+HANDLE hMenuItem;
+
+int OnSkinPlayingSound(WPARAM wParam,LPARAM lParam)
+{
+ char * pszFile = (char *) lParam;
+ if(pszFile && (DBGetContactSettingByte(NULL,"Skin","UseSound",1) || (int)wParam==1))
+ playSnd::PlaySound(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOWAIT);
+ return 0;
+}
+
+int OnSkinIconsChanged(WPARAM wParam,LPARAM lParam)
+{
+ hSoundOff = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[0]);
+ hSoundOn = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[1]);
+
+ int useSound = DBGetContactSettingByte(NULL,"Skin","UseSound",1);
+ DBWriteContactSettingByte(NULL,"Skin","UseSound",useSound);
+ SendMessage(hwndMute, BM_SETIMAGE,IMAGE_ICON,(LPARAM)(useSound?hSoundOn:hSoundOff));
+
+ return 0;
+}
+
+int OnSettingChanged(WPARAM wParam,LPARAM lParam)
+{
+ if(wParam != 0 || lParam == NULL) return 0;
+ {
+ DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam;
+ if(!strcmp(dbcws->szModule,"Skin"))
+ if(!strcmp(dbcws->szSetting,"UseSound"))
+ {
+ int useSound = dbcws->value.bVal;
+ SendMessage(hwndMute, BM_SETIMAGE,IMAGE_ICON,(LPARAM)(useSound?hSoundOn:hSoundOff));
+
+ return 0;
+ };
+ }
+
+ return 0;
+}
+
+static int OnOptionsInit(WPARAM wParam,LPARAM lParam)
+{
+ OPTIONSDIALOGPAGE odp;
+
+ ZeroMemory(&odp, sizeof(odp));
+
+ odp.cbSize = sizeof(odp);
+ odp.pszGroup = Translate("Events");
+ odp.position = -200000000;
+ odp.hInstance = hInst;
+ odp.pszTemplate = MAKEINTRESOURCE(IDD_OPT);
+ odp.pszTitle = Translate("Sounds Volume");
+ odp.pfnDlgProc = (DLGPROC)OptionsDlgProc;
+ odp.flags = ODPF_BOLDGROUPS;
+ CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+
+ return 0;
+}
+
+BOOL __inline IsMouseInside(HWND hwnd)
+{
+ POINT pt;
+ HWND hwndAtPt;
+
+ GetCursorPos(&pt);
+ hwndAtPt = WindowFromPoint(pt);
+ while(hwndAtPt != NULL)
+ {
+ if(hwndAtPt == hwnd)
+ return TRUE;
+ hwndAtPt = GetParent(hwndAtPt);
+ }
+ return FALSE;
+ //return (hwndAtPt == hwnd) || (GetParent(hwndAtPt) == hwnd);
+ //GetWindowRect(hwnd, &rc);
+ //return PtInRect(&rc, pt);
+}
+
+LRESULT CALLBACK OnMouseHook(int code, WPARAM wParam, LPARAM lParam)
+{
+ if(code >= 0)
+ {
+ if(wParam == WM_MOUSEWHEEL)
+ {
+ //MOUSEHOOKSTRUCTEX *mhk = (MOUSEHOOKSTRUCTEX*)lParam;
+ MSLLHOOKSTRUCT *mhk = (MSLLHOOKSTRUCT*)lParam;
+
+ if(IsMouseInside(hwndSlider))
+ {
+ int count = (short)HIWORD(mhk->mouseData);
+
+ PostMessage(hwndSlider, WM_MOUSEWHEEL, MAKEWPARAM(0,-count), MAKELPARAM(mhk->pt.x, mhk->pt.y));
+
+ return 1;
+ }
+
+ }
+ }
+ return CallNextHookEx(hHookMouse, code, wParam, lParam);
+}
+
+
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch(msg)
+ {
+ case WM_CREATE:
+ {
+#define MUTE_W 20
+#define MUTE_H 20
+ isMuteVisible = DBGetContactSettingByte(NULL,SERVICENAME,"MuteBtn", TRUE);
+ hwndMute = CreateWindow(MIRANDABUTTONCLASS,
+ "",
+ WS_CHILD | (isMuteVisible?WS_VISIBLE:0),
+ 1,
+ 1,
+ MUTE_W,
+ MUTE_H,
+ hwnd,
+ (HMENU)0,
+ (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
+ NULL);
+ SendMessage(hwndMute, BUTTONSETASFLATBTN,0,0);
+ SendMessage(hwndMute, BM_SETIMAGE,IMAGE_ICON,(LPARAM)hSoundOn);
+ hwndSlider = CreateWindow(TRACKBAR_CLASS,
+ "",
+ WS_CHILD | WS_VISIBLE | TBS_NOTICKS,
+ MUTE_W+1,
+ 1,
+ 120,
+ MUTE_W,
+ hwnd,
+ (HMENU)0,
+ (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
+ NULL);
+ //SendMessage(hwndSlider, TBM_SETRANGE, FALSE, MAKELONG(-10000/3,1000));
+ SendMessage(hwndSlider, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN, SLIDER_MAX/SLIDER_DIV));
+ SendMessage(hwndSlider, TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL,SERVICENAME,"Volume",1000)/SLIDER_DIV);
+
+ //SetWindowLong(hwndSlider, GWL_USERDATA, GetWindowLong(hwndSlider, GWL_WNDPROC));
+ //SetWindowLong(hwndSlider, GWL_WNDPROC, (LONG)SliderWndProc);
+
+ break;
+ }
+ case WM_COMMAND:
+ if((HWND)lParam == hwndMute)
+ {
+ int useSound = !DBGetContactSettingByte(NULL,"Skin","UseSound",1);
+ DBWriteContactSettingByte(NULL,"Skin","UseSound",useSound);
+ SendMessage(hwndMute, BM_SETIMAGE,IMAGE_ICON,(LPARAM)(useSound?hSoundOn:hSoundOff));
+ }
+ break;
+ /*
+ case WM_MOUSEWHEEL:
+ {
+ int count = HIWORD(wParam);
+ break;
+ }
+ */
+ case WM_USER:
+ ShowWindow(hwndMute, wParam?SW_SHOW:SW_HIDE);
+ isMuteVisible = wParam;
+ case WM_HSCROLL:
+ {
+ int value = (DWORD)SendMessage(hwndSlider, TBM_GETPOS, 0, 0)*SLIDER_DIV;
+ if(hwndOptSlider)
+ SendMessage(hwndOptSlider, TBM_SETPOS, TRUE, value);
+ else
+ DBWriteContactSettingDword(NULL, SERVICENAME, "Volume", value);
+ playSnd::SetVolume(value);
+ SkinPlaySound("RecvMsg");
+
+ break;
+ }
+ case WM_SIZE:
+ {
+ RECT rect;
+ // = DBGetContactSettingByte(NULL,SERVICENAME,"MuteBtn", TRUE);//IsWindowVisible(hwndMute);
+
+ GetClientRect(hwnd,&rect);
+#define SLIDER_H 18
+ SetWindowPos(hwndSlider, 0,
+ rect.left+(isMuteVisible?MUTE_W:0)+1, rect.top+1+ (MUTE_H-SLIDER_H)/2, rect.right-rect.left-3-(isMuteVisible?MUTE_W:0), SLIDER_H,
+ SWP_NOZORDER);
+ InvalidateRect(hwnd, &rect, FALSE);
+ return 0;
+ }
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->code)
+ {
+ case NM_RELEASEDCAPTURE:
+ {
+ int value = (DWORD)SendMessage(hwndSlider, TBM_GETPOS, 0, 0)*SLIDER_DIV;
+
+ DBWriteContactSettingDword(NULL, SERVICENAME, "Volume", value);
+ if(hwndOptSlider) SendMessage(hwndOptSlider, TBM_SETPOS, TRUE, value);
+ playSnd::SetVolume(value);
+ //SkinPlaySound("RecvMsg");
+
+ break;
+ }
+ }
+ break;
+ }
+ return DefWindowProc(hwnd,msg,wParam,lParam);
+}
+#define WndClass "SNDVOL_WND"
+
+int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
+{
+ if(!ServiceExists(MS_SKIN2_ADDICON))
+ {
+ hSoundOn = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_SND_ON),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0);
+ hSoundOff = (HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_SND_OFF),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0);
+ }
+ else
+ {
+ SKINICONDESC sid;
+ char ModuleName[MAX_PATH];
+
+ sid.cbSize = sizeof(sid);
+ sid.pszSection = Translate("Sound Volume");
+ GetModuleFileName(hInst, ModuleName, sizeof(ModuleName));
+ sid.pszDefaultFile = ModuleName;
+#define myLOAD_ICON(n, result)\
+ sid.pszName = szIconId[n];\
+ sid.pszDescription = szIconName[n];\
+ sid.iDefaultIndex = iIconId[n];\
+ CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);\
+ result = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)szIconId[n]);
+
+ myLOAD_ICON(0, hSoundOff);
+ myLOAD_ICON(1, hSoundOn);
+
+ hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
+ }
+ if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ {
+ WNDCLASSEX wcx;
+ CLISTFrame f;
+
+ ZeroMemory( &wcx, sizeof( wcx ) );
+
+ wcx.cbSize = sizeof(WNDCLASSEX);
+ wcx.style = 0;
+ wcx.lpfnWndProc = WndProc;
+ wcx.cbClsExtra = 0;
+ wcx.cbWndExtra = 0;
+ wcx.hInstance = hInst;
+ wcx.hIcon = NULL;
+ wcx.hCursor = LoadCursor(hInst, IDC_ARROW);
+ wcx.hbrBackground = (HBRUSH)(COLOR_3DFACE+1);
+ wcx.lpszMenuName = NULL;
+ wcx.lpszClassName = WndClass;
+ wcx.hIconSm = NULL;
+ //
+ RegisterClassEx(&wcx);
+ //
+ hwndFrame = CreateWindow(WndClass,
+ NULL,
+ WS_CHILD|WS_VISIBLE,
+ 0,
+ 0,
+ 120,
+ MUTE_H+2,
+ (HWND)CallService( MS_CLUI_GETHWND, 0, 0 ),
+ NULL,
+ hInst,
+ NULL);
+ //
+ ZeroMemory(&f, sizeof(CLISTFrame));
+ f.align = alBottom;
+ f.cbSize = sizeof(CLISTFrame);
+ f.height = MUTE_H+2;
+ f.Flags = F_VISIBLE;
+ f.hWnd = hwndFrame;
+ f.name = "SoundVolume";
+ CallService(MS_CLIST_FRAMES_ADDFRAME,(int)&f,0);
+ }
+ return 0;
+}
+
+
+int __declspec(dllexport) Load(PLUGINLINK *link)
+{
+ pluginLink=link;
+
+ playSnd::Init();
+ hHookSkinPlayingSound = HookEvent(ME_SKIN_PLAYINGSOUND, OnSkinPlayingSound);
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ hHookDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged);
+ hHookMouse = SetWindowsHookEx(WH_MOUSE_LL, &OnMouseHook, hInst, 0);
+ //hHookMouse = SetWindowsHookEx(WH_MOUSE, &OnMouseHook, hInst, 0);
+
+ return 0;
+}
+
+int __declspec(dllexport) Unload(void)
+{
+ if(!ServiceExists(MS_SKIN2_ADDICON))
+ {
+ DestroyIcon(hSoundOff);
+ DestroyIcon(hSoundOn);
+ UnhookEvent(hHookSkinIconsChanged);
+ }
+ UnhookEvent(hHookSkinPlayingSound);
+ playSnd::Destroy();
+ return 0;
+}
\ No newline at end of file diff --git a/plugins/!NotAdopted/sndVol/plugin.h b/plugins/!NotAdopted/sndVol/plugin.h new file mode 100644 index 0000000000..529676a289 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/plugin.h @@ -0,0 +1,42 @@ +#include "AggressiveOptimize.h"
+#include <windows.h>
+#include <commctrl.h>
+#include "../../include/newpluginapi.h"
+#include "../../include/m_system.h"
+#include "../../include/m_database.h"
+#include "../../include/m_protomod.h"
+#include "../../include/m_protosvc.h"
+#include "../../include/m_langpack.h"
+#include "../../include/m_clist.h"
+#include "../../include/m_options.h"
+#include "../../include/m_clui.h"
+#include "../../include/m_clc.h"
+#include "../../include/m_utils.h"
+#include "../../include/m_skin.h"
+#include "../../include/m_button.h"
+#include <math.h>
+
+
+#define SERVICENAME "sndVol"
+
+extern HINSTANCE hInst;
+extern bool isEnabled;
+extern HWND hwndFrame, hwndSlider, hwndOptSlider;
+extern HICON hSoundOn, hSoundOff;
+extern int autoPreview;
+
+#define SLIDER_MIN 1
+#define SLIDER_MAX 90
+#define SLIDER_DIV 6
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int __declspec(dllexport) Load( PLUGINLINK *link );
+int __declspec(dllexport) Unload( void );
+__declspec(dllexport) PLUGININFO *MirandaPluginInfo( DWORD dwVersion );
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/plugins/!NotAdopted/sndVol/resource.h b/plugins/!NotAdopted/sndVol/resource.h new file mode 100644 index 0000000000..5d4781b86e --- /dev/null +++ b/plugins/!NotAdopted/sndVol/resource.h @@ -0,0 +1,24 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by sndVol.rc
+//
+#define IDD_OPT 101
+#define IDI_SND_ON 103
+#define IDI_SND_OFF 104
+#define IDC_SLIDER1 1000
+#define IDC_VOLUME 1000
+#define IDC_TEST 1001
+#define IDC_AUTO 1002
+#define IDC_GRP 1003
+#define IDC_MUTE 1004
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 104
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1004
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/plugins/!NotAdopted/sndVol/snd.ico b/plugins/!NotAdopted/sndVol/snd.ico Binary files differnew file mode 100644 index 0000000000..60f5752468 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/snd.ico diff --git a/plugins/!NotAdopted/sndVol/sndVol.dsp b/plugins/!NotAdopted/sndVol/sndVol.dsp new file mode 100644 index 0000000000..aae0d71298 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/sndVol.dsp @@ -0,0 +1,163 @@ +# Microsoft Developer Studio Project File - Name="sndVol" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=sndVol - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sndVol.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sndVol.mak" CFG="sndVol - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "sndVol - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "sndVol - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "sndVol - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sndVol_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sndVol_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib dxerr8.lib dxguid.lib advapi32.lib winmm.lib /nologo /dll /map /machine:I386 /out:"..\..\bin\Release\plugins\sndVol.dll"
+
+!ELSEIF "$(CFG)" == "sndVol - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sndVol_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "sndVol_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dxerr8.lib winmm.lib dxguid.lib /nologo /dll /debug /machine:I386 /out:"..\..\bin\Release\plugins\sndVol.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "sndVol - Win32 Release"
+# Name "sndVol - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\dmutil.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\dxutil.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\optionsdlg.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\playSnd.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\plugin.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\dmutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dxutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\optionsdlg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\playSnd.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\plugin.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\nosnd.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\snd.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\sndVol.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\volume.ico
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/plugins/!NotAdopted/sndVol/sndVol.dsw b/plugins/!NotAdopted/sndVol/sndVol.dsw new file mode 100644 index 0000000000..7e7ac094a5 --- /dev/null +++ b/plugins/!NotAdopted/sndVol/sndVol.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "sndVol"=".\sndVol.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/plugins/!NotAdopted/sndVol/sndVol.rc b/plugins/!NotAdopted/sndVol/sndVol.rc new file mode 100644 index 0000000000..4b359471af --- /dev/null +++ b/plugins/!NotAdopted/sndVol/sndVol.rc @@ -0,0 +1,96 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Russian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+#ifdef _WIN32
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
+#pragma code_page(1251)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_OPT DIALOGEX 0, 0, 296, 64
+STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Sans Serif"
+BEGIN
+ GROUPBOX " Volume ",IDC_GRP,0,0,296,64
+ CONTROL "Slider1",IDC_VOLUME,"msctls_trackbar32",TBS_NOTICKS |
+ WS_TABSTOP,6,13,284,17
+ LTEXT "min",IDC_STATIC,6,27,12,8
+ LTEXT "max",IDC_STATIC,276,27,14,8
+ PUSHBUTTON "Preview",IDC_TEST,10,40,50,14
+ CONTROL "Auto-preview",IDC_AUTO,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,65,40,57,15
+ CONTROL "Mute button",IDC_MUTE,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,220,40,65,15
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_SND_ON ICON DISCARDABLE "snd.ico"
+IDI_SND_OFF ICON DISCARDABLE "nosnd.ico"
+#endif // Russian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
|