home *** CD-ROM | disk | FTP | other *** search
- /*
- Company: Sensaura Ltd
- Copyright: (C) 1999
-
- File Name: buffrdlg.cpp
- File Description: Source file for implementation of BufferDlg class which creates a
- DirectSound3D buffer with ZoomFX support controlled by a dialog box
- interface
- Author: Adam Philp
- Last Update: 04-JAN-00
-
- Target Compiler: Microsoft Visual C++ Version 5.0
- */
-
- /////////////////////// Included files ////////////////////////////////////////////////////////////
-
- #include <windows.h>
- #include <commctrl.h>
- #include <stdio.h>
-
- #include "buffrdlg.h"
- #include "debug.h"
- #include "resource.h"
-
- /////////////////////// Definitions ///////////////////////////////////////////////////////////////
-
- #define XYZ_SLIDER_MAX 100
- #define XYZ_SLIDER_MIN (-XYZ_SLIDER_MAX)
- #define DS3D_MAXDISTANCE 100.0f
-
- /////////////////////// Constants /////////////////////////////////////////////////////////////////
-
- DS3DBUFFER Default3DBuffer = // Default DirectSound3D buffer parameters
- {
- sizeof(DS3DBUFFER),
- { 0.0f, 0.0f, 0.0f },
- { 0.0f, 0.0f, 0.0f },
- DS3D_DEFAULTCONEANGLE, DS3D_DEFAULTCONEANGLE,
- { 0.0f, 0.0f, 1.0f },
- DS3D_DEFAULTCONEOUTSIDEVOLUME,
- DS3D_DEFAULTMINDISTANCE, DS3D_MAXDISTANCE,
- DS3DMODE_NORMAL
- };
-
- ZOOMFX_BOX DefaultExtent = // Default ZoomFX extent
- {
- { 0.0f, 0.0f, 0.0f },
- { 0.0f, 0.0f, 0.0f }
- };
- // Default ZoomFX orientation
- ZOOMFX_ORIENTATION DefaultOrientation =
- {
- { 0.0f, 0.0f, 1.0f },
- { 0.0f, 1.0f, 0.0f }
- };
-
- /////////////////////// BufferDlg class implementation ////////////////////////////////////////////
-
- BufferDlg::BufferDlg():Buffer()
- {
- PTRACE("BufferDlg::BufferDlg()");
-
- m_hWnd = NULL;
- m_pParent = NULL;
- m_bZoomFXEnabled = false;
- m_bZoomFXSymmetrical = true;
-
- m_hPlayBtn = NULL;
- m_hLoopedBtn = NULL;
- m_hDefaultBtn = NULL;
- m_hEnableZoomFXBtn = NULL;
- m_hFormatStatic = NULL;
- m_hPlayCursorStatic = NULL;
- m_hWriteCursorStatic = NULL;
- m_hFrequencySlider = NULL;
- m_hVolumeSlider = NULL;
- m_hFrequencyStatic = NULL;
- m_hVolumeStatic = NULL;
- m_hNormalBtn = NULL;
- m_hHeadRelativeBtn = NULL;
- m_hDisabledBtn = NULL;
- m_hMinDistanceSlider = NULL;
- m_hMaxDistanceSlider = NULL;
- m_hMinDistanceStatic = NULL;
- m_hMaxDistanceStatic = NULL;
- m_hPositionXSlider = NULL;
- m_hPositionYSlider = NULL;
- m_hPositionZSlider = NULL;
- m_hPositionXStatic = NULL;
- m_hPositionYStatic = NULL;
- m_hPositionZStatic = NULL;
- m_hVelocityXSlider = NULL;
- m_hVelocityYSlider = NULL;
- m_hVelocityZSlider = NULL;
- m_hVelocityXStatic = NULL;
- m_hVelocityYStatic = NULL;
- m_hVelocityZStatic = NULL;
- m_hInnerConeAngleSlider = NULL;
- m_hOuterConeAngleSlider = NULL;
- m_hInnerConeAngleStatic = NULL;
- m_hOuterConeAngleStatic = NULL;
- m_hOuterVolumeSlider = NULL;
- m_hOuterVolumeStatic = NULL;
- m_hZoomFXMaxXSlider = NULL;
- m_hZoomFXMaxYSlider = NULL;
- m_hZoomFXMaxZSlider = NULL;
- m_hZoomFXMaxXStatic = NULL;
- m_hZoomFXMaxYStatic = NULL;
- m_hZoomFXMaxZStatic = NULL;
- m_hZoomFXMinXSlider = NULL;
- m_hZoomFXMinYSlider = NULL;
- m_hZoomFXMinZSlider = NULL;
- m_hZoomFXMinXStatic = NULL;
- m_hZoomFXMinYStatic = NULL;
- m_hZoomFXMinZStatic = NULL;
- m_hZoomFXSymmetricalBtn = NULL;
- m_hZoomFXFrontXSlider = NULL;
- m_hZoomFXFrontYSlider = NULL;
- m_hZoomFXFrontZSlider = NULL;
- m_hZoomFXFrontXStatic = NULL;
- m_hZoomFXFrontYStatic = NULL;
- m_hZoomFXFrontZStatic = NULL;
- m_hZoomFXTopXSlider = NULL;
- m_hZoomFXTopYSlider = NULL;
- m_hZoomFXTopZSlider = NULL;
- m_hZoomFXTopXStatic = NULL;
- m_hZoomFXTopYStatic = NULL;
- m_hZoomFXTopZStatic = NULL;
- m_hZoomFXCommitOrientationBtn = NULL;
- }
-
- BufferDlg::~BufferDlg()
- {
- PTRACE("BufferDlg::~BufferDlg()");
-
- Destroy();
- }
-
- /////////////////////// BufferDlg public member functions /////////////////////////////////////////
-
- bool BufferDlg::Create(Application* pApp, const char* pFileName, LPDIRECTSOUND pDirectSound)
- {
- ASSERT(m_hWnd == NULL);
- if(m_hWnd != NULL)
- {
- MessageBox(NULL, "Buffer dialog already created", pApp->GetName(), MB_OK|MB_ICONSTOP);
- return false;
- }
-
- m_pParent = pApp->GetMainWindow();
- if(m_pParent == NULL)
- return false;
-
- if(!Buffer::Create(pFileName, pDirectSound))
- return false;
- if(!SetAllParameters(&Default3DBuffer, DS3D_IMMEDIATE))
- return false;
- m_bZoomFXEnabled = CanDoZoomFX();
-
- m_hWnd = CreateDialogParam(pApp->GetInstance(), MAKEINTRESOURCE(IDD_BUFFER),
- m_pParent->m_hWnd,
- (DLGPROC)BufferDlgProc, (LPARAM)this);
- if(m_hWnd == NULL)
- {
- MessageBox(NULL, "Cannot create buffer dialog", pApp->GetName(), MB_OK|MB_ICONSTOP);
- return false;
- }
-
- InitControlRanges(pDirectSound);
- if(!InitControls())
- return false;
-
- SetWindowText(m_hWnd, pFileName);
- m_pParent->CascadeWindow(m_hWnd);
- ::ShowWindow(m_hWnd, SW_SHOW);
-
- return true;
- }
-
- void BufferDlg::Destroy()
- {
- if(m_hWnd)
- {
- DestroyWindow(m_hWnd);
- m_hWnd = NULL;
- }
- Buffer::Destroy();
- }
-
- bool BufferDlg::Update()
- {
- static bool bWasPlaying = false;
- bool bIsPlaying;
- DWORD dwPlayCursor = 0, dwWriteCursor = 0;
- char str[100];
-
- bIsPlaying = IsPlaying();
- if(bIsPlaying != bWasPlaying)
- {
- if(!bIsPlaying)
- Rewind();
-
- SetWindowText(m_hPlayBtn, bIsPlaying ? "Stop" : "Play");
- bWasPlaying = bIsPlaying;
- }
- GetCurrentPosition(&dwPlayCursor, &dwWriteCursor);
- sprintf(str, "%d", dwPlayCursor);
- SetWindowText(m_hPlayCursorStatic, str);
- sprintf(str, "%d", dwWriteCursor);
- SetWindowText(m_hWriteCursorStatic, str);
-
- return true;
- }
-
- BOOL CALLBACK BufferDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
- {
- BufferDlg* pDlg;
-
- switch(message)
- {
- case WM_INITDIALOG:
- ASSERT(lParam != NULL);
- pDlg = (BufferDlg*)lParam;
- SetWindowLong(hDlg, DWL_USER, (LONG)pDlg);
-
- if(!pDlg->OnInitDialog(hDlg, wParam, lParam))
- DestroyWindow(hDlg);
- return TRUE;
-
- case WM_HSCROLL:
- pDlg = (BufferDlg*)GetWindowLong(hDlg, DWL_USER);
- ASSERT(pDlg != NULL);
- return !pDlg->OnHScroll(LOWORD(wParam), (LONG)HIWORD(wParam), (HWND)lParam);
-
- case WM_COMMAND:
- pDlg = (BufferDlg*)GetWindowLong(hDlg, DWL_USER);
- // It's possible to get child notifications before the
- // INITDIALOG message, so we'll handle a NULL class item
- // here a less stringently
- if(!pDlg)
- return FALSE;
- return !pDlg->OnCommand(wParam, lParam);
-
- case WM_DESTROY:
- pDlg = (BufferDlg*)GetWindowLong(hDlg, DWL_USER);
- ASSERT(pDlg != NULL);
- pDlg->OnDestroy();
- return TRUE;
-
- default:
- return FALSE;
- }
- }
-
- /////////////////////// BufferDlg protected member functions //////////////////////////////////////
-
- BOOL BufferDlg::OnInitDialog(HWND hDlg, WPARAM, LPARAM lParam)
- {
- m_hPlayBtn = GetDlgItem(hDlg, IDC_PLAY);
- m_hLoopedBtn = GetDlgItem(hDlg, IDC_LOOPED);
- m_hDefaultBtn = GetDlgItem(hDlg, IDC_DEFAULT);
- m_hEnableZoomFXBtn = GetDlgItem(hDlg, IDC_ENABLEZOOMFX);
- m_hFormatStatic = GetDlgItem(hDlg, IDC_FORMATSTATIC);
- m_hPlayCursorStatic = GetDlgItem(hDlg, IDC_PLAYCURSORSTATIC);
- m_hWriteCursorStatic = GetDlgItem(hDlg, IDC_WRITECURSORSTATIC);
- m_hFrequencySlider = GetDlgItem(hDlg, IDC_FREQUENCY);
- m_hVolumeSlider = GetDlgItem(hDlg, IDC_VOLUME);
- m_hFrequencyStatic = GetDlgItem(hDlg, IDC_FREQUENCYSTATIC);
- m_hVolumeStatic = GetDlgItem(hDlg, IDC_VOLUMESTATIC);
- m_hNormalBtn = GetDlgItem(hDlg, IDC_NORMAL);
- m_hHeadRelativeBtn = GetDlgItem(hDlg, IDC_HEADRELATIVE);
- m_hDisabledBtn = GetDlgItem(hDlg, IDC_DISABLED);
- m_hMinDistanceSlider = GetDlgItem(hDlg, IDC_MINDISTANCE);
- m_hMaxDistanceSlider = GetDlgItem(hDlg, IDC_MAXDISTANCE);
- m_hMinDistanceStatic = GetDlgItem(hDlg, IDC_MINDISTANCESTATIC);
- m_hMaxDistanceStatic = GetDlgItem(hDlg, IDC_MAXDISTANCESTATIC);
- m_hPositionXSlider = GetDlgItem(hDlg, IDC_POSITIONX);
- m_hPositionYSlider = GetDlgItem(hDlg, IDC_POSITIONY);
- m_hPositionZSlider = GetDlgItem(hDlg, IDC_POSITIONZ);
- m_hPositionXStatic = GetDlgItem(hDlg, IDC_POSITIONXSTATIC);
- m_hPositionYStatic = GetDlgItem(hDlg, IDC_POSITIONYSTATIC);
- m_hPositionZStatic = GetDlgItem(hDlg, IDC_POSITIONZSTATIC);
- m_hVelocityXSlider = GetDlgItem(hDlg, IDC_VELOCITYX);
- m_hVelocityYSlider = GetDlgItem(hDlg, IDC_VELOCITYY);
- m_hVelocityZSlider = GetDlgItem(hDlg, IDC_VELOCITYZ);
- m_hVelocityXStatic = GetDlgItem(hDlg, IDC_VELOCITYXSTATIC);
- m_hVelocityYStatic = GetDlgItem(hDlg, IDC_VELOCITYYSTATIC);
- m_hVelocityZStatic = GetDlgItem(hDlg, IDC_VELOCITYZSTATIC);
- m_hInnerConeAngleSlider = GetDlgItem(hDlg, IDC_INNERCONEANGLE);
- m_hOuterConeAngleSlider = GetDlgItem(hDlg, IDC_OUTERCONEANGLE);
- m_hInnerConeAngleStatic = GetDlgItem(hDlg, IDC_INNERCONEANGLESTATIC);
- m_hOuterConeAngleStatic = GetDlgItem(hDlg, IDC_OUTERCONEANGLESTATIC);
- m_hOuterVolumeSlider = GetDlgItem(hDlg, IDC_OUTERVOLUME);
- m_hOuterVolumeStatic = GetDlgItem(hDlg, IDC_OUTERVOLUMESTATIC);
- m_hZoomFXMaxXSlider = GetDlgItem(hDlg, IDC_ZOOMFXMAXX);
- m_hZoomFXMaxYSlider = GetDlgItem(hDlg, IDC_ZOOMFXMAXY);
- m_hZoomFXMaxZSlider = GetDlgItem(hDlg, IDC_ZOOMFXMAXZ);
- m_hZoomFXMaxXStatic = GetDlgItem(hDlg, IDC_ZOOMFXMAXXSTATIC);
- m_hZoomFXMaxYStatic = GetDlgItem(hDlg, IDC_ZOOMFXMAXYSTATIC);
- m_hZoomFXMaxZStatic = GetDlgItem(hDlg, IDC_ZOOMFXMAXZSTATIC);
- m_hZoomFXMinXSlider = GetDlgItem(hDlg, IDC_ZOOMFXMINX);
- m_hZoomFXMinYSlider = GetDlgItem(hDlg, IDC_ZOOMFXMINY);
- m_hZoomFXMinZSlider = GetDlgItem(hDlg, IDC_ZOOMFXMINZ);
- m_hZoomFXMinXStatic = GetDlgItem(hDlg, IDC_ZOOMFXMINXSTATIC);
- m_hZoomFXMinYStatic = GetDlgItem(hDlg, IDC_ZOOMFXMINYSTATIC);
- m_hZoomFXMinZStatic = GetDlgItem(hDlg, IDC_ZOOMFXMINZSTATIC);
- m_hZoomFXSymmetricalBtn = GetDlgItem(hDlg, IDC_ZOOMFXSYMMETRICAL);
- m_hZoomFXFrontXSlider = GetDlgItem(hDlg, IDC_ZOOMFXFRONTX);
- m_hZoomFXFrontYSlider = GetDlgItem(hDlg, IDC_ZOOMFXFRONTY);
- m_hZoomFXFrontZSlider = GetDlgItem(hDlg, IDC_ZOOMFXFRONTZ);
- m_hZoomFXFrontXStatic = GetDlgItem(hDlg, IDC_ZOOMFXFRONTXSTATIC);
- m_hZoomFXFrontYStatic = GetDlgItem(hDlg, IDC_ZOOMFXFRONTYSTATIC);
- m_hZoomFXFrontZStatic = GetDlgItem(hDlg, IDC_ZOOMFXFRONTZSTATIC);
- m_hZoomFXTopXSlider = GetDlgItem(hDlg, IDC_ZOOMFXTOPX);
- m_hZoomFXTopYSlider = GetDlgItem(hDlg, IDC_ZOOMFXTOPY);
- m_hZoomFXTopZSlider = GetDlgItem(hDlg, IDC_ZOOMFXTOPZ);
- m_hZoomFXTopXStatic = GetDlgItem(hDlg, IDC_ZOOMFXTOPXSTATIC);
- m_hZoomFXTopYStatic = GetDlgItem(hDlg, IDC_ZOOMFXTOPYSTATIC);
- m_hZoomFXTopZStatic = GetDlgItem(hDlg, IDC_ZOOMFXTOPZSTATIC);
- m_hZoomFXCommitOrientationBtn = GetDlgItem(hDlg, IDC_COMMITZOOMFXORIENTATION);
-
- return TRUE;
- }
-
- BOOL BufferDlg::OnCommand(WPARAM wParam, LPARAM/* lParam*/)
- {
- if(HIWORD(wParam) == BN_CLICKED)
- {
- switch(LOWORD(wParam))
- {
- case IDCANCEL:
- DestroyWindow(m_hWnd);
- m_hWnd = NULL;
- break;
-
- case IDC_PLAY:
- if(IsPlaying())
- {
- Stop();
- Rewind();
- }
- else
- Play(IsDlgButtonChecked(m_hWnd, IDC_LOOPED) ? true : false);
-
- case IDC_DEFAULT:
- RestoreDefaults();
- break;
-
- case IDC_ENABLEZOOMFX:
- EnableZoomFX(!m_bZoomFXEnabled);
- break;
-
- case IDC_NORMAL:
- case IDC_HEADRELATIVE:
- case IDC_DISABLED:
- UpdateMode(LOWORD(wParam));
- break;
-
- case IDC_ZOOMFXSYMMETRICAL:
- UpdateZoomFXExtentSymmetrical(IsDlgButtonChecked(m_hWnd, IDC_ZOOMFXSYMMETRICAL) ? true : false);
- break;
-
- case IDC_COMMITZOOMFXORIENTATION:
- CommitZoomFXOrientation();
- break;
-
- }
- }
- return TRUE;
- }
-
- BOOL BufferDlg::OnHScroll(WORD wNotifyCode, LONG lPos, HWND hwndCtl)
- {
- int id;
-
- ASSERT(hwndCtl);
- id = GetDlgCtrlID(hwndCtl);
- switch(id)
- {
- case IDC_FREQUENCY:
- UpdateFrequency();
- break;
-
- case IDC_VOLUME:
- UpdateVolume();
- break;
-
- case IDC_MINDISTANCE:
- UpdateMinDistance();
- break;
-
- case IDC_MAXDISTANCE:
- UpdateMaxDistance();
- break;
-
- case IDC_POSITIONX:
- case IDC_POSITIONY:
- case IDC_POSITIONZ:
- UpdatePosition();
- break;
-
- case IDC_VELOCITYX:
- case IDC_VELOCITYY:
- case IDC_VELOCITYZ:
- UpdateVelocity();
- break;
-
- case IDC_INNERCONEANGLE:
- UpdateInnerConeAngle();
- break;
-
- case IDC_OUTERCONEANGLE:
- UpdateOuterConeAngle();
- break;
-
- case IDC_OUTERVOLUME:
- UpdateOuterVolume();
- break;
-
- case IDC_ZOOMFXMAXX:
- case IDC_ZOOMFXMAXY:
- case IDC_ZOOMFXMAXZ:
- case IDC_ZOOMFXMINX:
- case IDC_ZOOMFXMINY:
- case IDC_ZOOMFXMINZ:
- UpdateZoomFXExtent();
- break;
-
- case IDC_ZOOMFXFRONTX:
- case IDC_ZOOMFXFRONTY:
- case IDC_ZOOMFXFRONTZ:
- case IDC_ZOOMFXTOPX:
- case IDC_ZOOMFXTOPY:
- case IDC_ZOOMFXTOPZ:
- UpdateZoomFXOrientation();
- break;
- }
- return TRUE;
- }
-
- void BufferDlg::OnDestroy()
- {
- m_pParent->DestroyChild(m_hWnd);
- }
-
- BOOL BufferDlg::InitControlRanges(LPDIRECTSOUND pDirectSound)
- {
- DSCAPS dsc;
-
- dsc.dwSize = sizeof(DSCAPS);
- if(pDirectSound->GetCaps(&dsc) != DS_OK)
- return FALSE;
-
- SendMessage(m_hFrequencySlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(dsc.dwMinSecondarySampleRate/10, dsc.dwMaxSecondarySampleRate/10));
- SendMessage(m_hVolumeSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, DSBVOLUME_MAX-(DSBVOLUME_MIN)));
- SendMessage(m_hMinDistanceSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(DS3D_DEFAULTMINDISTANCE, DS3D_MAXDISTANCE));
- SendMessage(m_hMaxDistanceSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(DS3D_DEFAULTMINDISTANCE, DS3D_MAXDISTANCE));
- SendMessage(m_hPositionXSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hPositionXSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hPositionYSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hPositionYSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hPositionZSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hPositionZSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hVelocityXSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hVelocityXSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hVelocityYSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hVelocityYSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hVelocityZSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hVelocityZSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hInnerConeAngleSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 360));
- SendMessage(m_hOuterConeAngleSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, 360));
- SendMessage(m_hOuterVolumeSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, DSBVOLUME_MAX-(DSBVOLUME_MIN)));
-
- SendMessage(m_hZoomFXMaxXSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXMaxYSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXMaxZSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXMinXSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXMinYSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXMinZSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(0, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXFrontXSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXFrontXSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hZoomFXFrontYSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXFrontYSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hZoomFXFrontZSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXFrontZSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
-
- SendMessage(m_hZoomFXTopXSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXTopXSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hZoomFXTopYSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXTopYSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
- SendMessage(m_hZoomFXTopZSlider, TBM_SETRANGE, (WPARAM)FALSE, (LPARAM)MAKELONG(XYZ_SLIDER_MIN, XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXTopZSlider, TBM_SETTICFREQ, (WPARAM)XYZ_SLIDER_MAX, 0);
-
- return TRUE;
- }
-
- bool BufferDlg::InitControls()
- {
- WAVEFORMATEX wfx;
- DWORD dwFrequency;
- long lVolume;
- DS3DBUFFER params;
- char str[100];
- ZOOMFX_BUFFERPROPERTIES zoomfx;
-
- if(!GetFormat(&wfx) || !GetFrequency(&dwFrequency) || !GetVolume(&lVolume) || !GetAllParameters(¶ms))
- return false;
-
- sprintf(str, "%d Hz, %d-bit, %s", wfx.nSamplesPerSec, wfx.wBitsPerSample, wfx.nChannels == 1 ? "Mono" : wfx.nChannels == 2 ? "Stereo" : "");
- SetWindowText(m_hFormatStatic, str);
- SendMessage(m_hFrequencySlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)dwFrequency/10);
- sprintf(str, "%d Hz", dwFrequency);
- SetWindowText(m_hFrequencyStatic, str);
- SendMessage(m_hVolumeSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)lVolume-DSBVOLUME_MIN);
- sprintf(str, "%.2f dB", ((float)lVolume)/100.0f);
- SetWindowText(m_hVolumeStatic, str);
-
- CheckRadioButton(m_hWnd, IDC_NORMAL, IDC_DISABLED, params.dwMode == DS3DMODE_NORMAL ? IDC_NORMAL :
- params.dwMode == DS3DMODE_HEADRELATIVE ? IDC_HEADRELATIVE : IDC_DISABLED);
-
- SendMessage(m_hMinDistanceSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.flMinDistance);
- SendMessage(m_hMaxDistanceSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.flMaxDistance);
- UpdateDistanceStatics(params.flMinDistance, params.flMaxDistance);
-
- SendMessage(m_hPositionXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.vPosition.x);
- SendMessage(m_hPositionYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.vPosition.y);
- SendMessage(m_hPositionZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.vPosition.z);
- UpdatePositionStatics(¶ms.vPosition);
-
- SendMessage(m_hVelocityXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.vVelocity.x);
- SendMessage(m_hVelocityYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.vVelocity.y);
- SendMessage(m_hVelocityZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.vVelocity.z);
- UpdateVelocityStatics(¶ms.vVelocity);
-
- SendMessage(m_hInnerConeAngleSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.dwInsideConeAngle);
- SendMessage(m_hOuterConeAngleSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)params.dwOutsideConeAngle);
- UpdateConeAngleStatics(params.dwInsideConeAngle, params.dwOutsideConeAngle);
- SendMessage(m_hOuterVolumeSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(params.lConeOutsideVolume-(DSBVOLUME_MIN)));
- sprintf(str, "%d", params.lConeOutsideVolume);
- SetWindowText(m_hOuterVolumeStatic, str);
-
- EnableZoomFXControls();
- if(CanDoZoomFX())
- {
- EnableWindow(m_hEnableZoomFXBtn, TRUE);
- GetAllZoomFX(&zoomfx);
- m_Orientation = zoomfx.orientation;
- SendMessage(m_hZoomFXMaxXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)zoomfx.box.vMax.x);
- SendMessage(m_hZoomFXMaxYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)zoomfx.box.vMax.y);
- SendMessage(m_hZoomFXMaxZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)zoomfx.box.vMax.z);
- SendMessage(m_hZoomFXMinXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-zoomfx.box.vMin.x);
- SendMessage(m_hZoomFXMinYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-zoomfx.box.vMin.y);
- SendMessage(m_hZoomFXMinZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-zoomfx.box.vMin.z);
- sprintf(str, "X:%d", zoomfx.box.vMax.x);
- SetWindowText(m_hZoomFXMaxXStatic, str);
- sprintf(str, "Y:%d", zoomfx.box.vMax.y);
- SetWindowText(m_hZoomFXMaxYStatic, str);
- sprintf(str, "Z:%d", zoomfx.box.vMax.z);
- SetWindowText(m_hZoomFXMaxZStatic, str);
- sprintf(str, "X:%d", zoomfx.box.vMin.x);
- SetWindowText(m_hZoomFXMinXStatic, str);
- sprintf(str, "Y:%d", zoomfx.box.vMin.y);
- SetWindowText(m_hZoomFXMinYStatic, str);
- sprintf(str, "Z:%d", zoomfx.box.vMin.z);
- SetWindowText(m_hZoomFXMinZStatic, str);
-
- CheckDlgButton(m_hWnd, IDC_ZOOMFXSYMMETRICAL, m_bZoomFXSymmetrical);
-
- SendMessage(m_hZoomFXFrontXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(zoomfx.orientation.vFront.x*XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXFrontYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(zoomfx.orientation.vFront.y*XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXFrontZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(zoomfx.orientation.vFront.z*XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXTopXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(zoomfx.orientation.vTop.x*XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXTopYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(zoomfx.orientation.vTop.y*XYZ_SLIDER_MAX));
- SendMessage(m_hZoomFXTopZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(zoomfx.orientation.vTop.z*XYZ_SLIDER_MAX));
- sprintf(str, "X:%.2f", zoomfx.orientation.vFront.x);
- SetWindowText(m_hZoomFXFrontXStatic, str);
- sprintf(str, "Y:%.2f", zoomfx.orientation.vFront.y);
- SetWindowText(m_hZoomFXFrontYStatic, str);
- sprintf(str, "Z:%.2f", zoomfx.orientation.vFront.z);
- SetWindowText(m_hZoomFXFrontZStatic, str);
- sprintf(str, "X:%.2f", zoomfx.orientation.vTop.x);
- SetWindowText(m_hZoomFXTopXStatic, str);
- sprintf(str, "Y:%.2f", zoomfx.orientation.vTop.y);
- SetWindowText(m_hZoomFXTopYStatic, str);
- sprintf(str, "Z:%.2f", zoomfx.orientation.vTop.z);
- SetWindowText(m_hZoomFXTopZStatic, str);
- }
- else
- EnableWindow(m_hEnableZoomFXBtn, FALSE);
- return Update();
- }
-
- void BufferDlg::EnableZoomFXControls()
- {
- HWND hCtl;
-
- SetWindowText(m_hEnableZoomFXBtn, m_bZoomFXEnabled ? "Disable ZoomFX" : "Enable ZoomFX");
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXPROPERTIES);
- EnableWindow(hCtl, m_bZoomFXEnabled);
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXEXTENT);
- EnableWindow(hCtl, m_bZoomFXEnabled);
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXMAX);
- EnableWindow(hCtl, m_bZoomFXEnabled);
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXMIN);
- EnableWindow(hCtl, m_bZoomFXEnabled);
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXORIENTATION);
- EnableWindow(hCtl, m_bZoomFXEnabled);
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXFRONT);
- EnableWindow(hCtl, m_bZoomFXEnabled);
- hCtl = GetDlgItem(m_hWnd, IDC_ZOOMFXTOP);
- EnableWindow(hCtl, m_bZoomFXEnabled);
-
- EnableWindow(m_hZoomFXMaxXSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMaxYSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMaxZSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMaxXStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMaxYStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMaxZStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMinXSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMinYSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMinZSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMinXStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMinYStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXMinZStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXSymmetricalBtn, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXFrontXSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXFrontYSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXFrontZSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXFrontXStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXFrontYStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXFrontZStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXTopXSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXTopYSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXTopZSlider, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXTopXStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXTopYStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXTopZStatic, m_bZoomFXEnabled);
- EnableWindow(m_hZoomFXCommitOrientationBtn, m_bZoomFXEnabled);
- }
-
- bool BufferDlg::UpdateFrequency()
- {
- DWORD dwFrequency;
- char str[20];
-
- dwFrequency = SendMessage(m_hFrequencySlider, TBM_GETPOS, 0, 0)*10;
- sprintf(str, "%d Hz", dwFrequency);
- SetWindowText(m_hFrequencyStatic, str);
- return SetFrequency(dwFrequency);
- }
-
- bool BufferDlg::UpdateVolume()
- {
- long lVolume;
- char str[20];
-
- lVolume = SendMessage(m_hVolumeSlider, TBM_GETPOS, 0, 0)+DSBVOLUME_MIN;
- sprintf(str, "%.2f dB", ((float)lVolume)/100.0f);
- SetWindowText(m_hVolumeStatic, str);
- return SetVolume(lVolume);
- }
-
- bool BufferDlg::RestoreDefaults()
- {
- WAVEFORMATEX wfx;
-
- GetFormat(&wfx);
- SetFrequency(wfx.nSamplesPerSec);
- SetVolume(0);
- SetAllParameters(&Default3DBuffer, DS3D_IMMEDIATE);
-
- if(CanDoZoomFX())
- {
- m_Extent = DefaultExtent;
- m_Orientation = DefaultOrientation;
-
- if(!SetZoomFXExtent(&m_Extent))
- return false;
- if(!SetZoomFXOrientation(&m_Orientation))
- return false;
- }
- m_bZoomFXSymmetrical = true;
-
- return InitControls();
- }
-
- bool BufferDlg::EnableZoomFX(bool bEnable)
- {
- if(!CanDoZoomFX())
- return false;
-
- if(bEnable)
- {
- if(SetZoomFXExtent(&m_Extent))
- m_bZoomFXEnabled = true;
- }
- else
- {
- SetZoomFXExtent(&DefaultExtent);
- m_bZoomFXEnabled = false;
- }
- EnableZoomFXControls();
- return true;
- }
-
- bool BufferDlg::UpdateMode(WORD wMode)
- {
- DWORD dwMode = wMode == IDC_NORMAL ? DS3DMODE_NORMAL :
- wMode == IDC_HEADRELATIVE ? DS3DMODE_HEADRELATIVE :
- DS3DMODE_DISABLE;
- return SetMode(dwMode, DS3D_IMMEDIATE);
- }
-
- bool BufferDlg::UpdateMinDistance()
- {
- D3DVALUE flMinDistance;
- D3DVALUE flMaxDistance;
-
- flMinDistance = (D3DVALUE)SendMessage(m_hMinDistanceSlider, TBM_GETPOS, 0, 0);
- flMaxDistance = (D3DVALUE)SendMessage(m_hMaxDistanceSlider, TBM_GETPOS, 0, 0);
- if(!SetMinDistance(flMinDistance, DS3D_IMMEDIATE))
- return false;
-
- if(flMinDistance > flMaxDistance)
- {
- flMaxDistance = flMinDistance;
- SendMessage(m_hMaxDistanceSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)flMaxDistance);
- if(!SetMaxDistance(flMaxDistance, DS3D_IMMEDIATE))
- return false;
- }
- UpdateDistanceStatics(flMinDistance, flMaxDistance);
-
- return true;
- }
-
- bool BufferDlg::UpdateMaxDistance()
- {
- D3DVALUE flMinDistance;
- D3DVALUE flMaxDistance;
-
- flMaxDistance = (D3DVALUE)SendMessage(m_hMaxDistanceSlider, TBM_GETPOS, 0, 0);
- flMinDistance = (D3DVALUE)SendMessage(m_hMinDistanceSlider, TBM_GETPOS, 0, 0);
- if(!SetMaxDistance(flMaxDistance, DS3D_IMMEDIATE))
- return false;
-
- if(flMinDistance > flMaxDistance)
- {
- flMinDistance = flMaxDistance;
- SendMessage(m_hMinDistanceSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)flMinDistance);
- if(!SetMinDistance(flMinDistance, DS3D_IMMEDIATE))
- return false;
- }
- UpdateDistanceStatics(flMinDistance, flMaxDistance);
-
- return true;
- }
-
- bool BufferDlg::UpdatePosition()
- {
- D3DVECTOR p;
-
- p.x = (D3DVALUE)SendMessage(m_hPositionXSlider, TBM_GETPOS, 0, 0);
- p.y = (D3DVALUE)SendMessage(m_hPositionYSlider, TBM_GETPOS, 0, 0);
- p.z = (D3DVALUE)SendMessage(m_hPositionZSlider, TBM_GETPOS, 0, 0);
- UpdatePositionStatics(&p);
-
- return SetPosition(p.x, p.y, p.z, DS3D_IMMEDIATE);
- }
-
- bool BufferDlg::UpdateVelocity()
- {
- D3DVECTOR v;
-
- v.x = (D3DVALUE)SendMessage(m_hVelocityXSlider, TBM_GETPOS, 0, 0);
- v.y = (D3DVALUE)SendMessage(m_hVelocityYSlider, TBM_GETPOS, 0, 0);
- v.z = (D3DVALUE)SendMessage(m_hVelocityZSlider, TBM_GETPOS, 0, 0);
- UpdateVelocityStatics(&v);
-
- return SetVelocity(v.x, v.y, v.z, DS3D_IMMEDIATE);
- }
-
- bool BufferDlg::UpdateInnerConeAngle()
- {
- DWORD dwInsideConeAngle;
- DWORD dwOutsideConeAngle;
-
- dwInsideConeAngle = SendMessage(m_hInnerConeAngleSlider, TBM_GETPOS, 0, 0);
- dwOutsideConeAngle = SendMessage(m_hOuterConeAngleSlider, TBM_GETPOS, 0, 0);
- if(dwInsideConeAngle > dwOutsideConeAngle)
- {
- dwOutsideConeAngle = dwInsideConeAngle;
- SendMessage(m_hOuterConeAngleSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)dwOutsideConeAngle);
- }
- UpdateConeAngleStatics(dwInsideConeAngle, dwOutsideConeAngle);
-
- return SetConeAngles(dwInsideConeAngle, dwOutsideConeAngle, DS3D_IMMEDIATE);
- }
-
- bool BufferDlg::UpdateOuterConeAngle()
- {
- DWORD dwInsideConeAngle;
- DWORD dwOutsideConeAngle;
-
- dwOutsideConeAngle = SendMessage(m_hOuterConeAngleSlider, TBM_GETPOS, 0, 0);
- dwInsideConeAngle = SendMessage(m_hInnerConeAngleSlider, TBM_GETPOS, 0, 0);
- if(dwInsideConeAngle > dwOutsideConeAngle)
- {
- dwInsideConeAngle = dwOutsideConeAngle;
- SendMessage(m_hInnerConeAngleSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)dwInsideConeAngle);
- }
- UpdateConeAngleStatics(dwInsideConeAngle, dwOutsideConeAngle);
-
- return SetConeAngles(dwInsideConeAngle, dwOutsideConeAngle, DS3D_IMMEDIATE);
- }
-
- bool BufferDlg::UpdateOuterVolume()
- {
- long lVolume;
- char str[20];
-
- lVolume = SendMessage(m_hOuterVolumeSlider, TBM_GETPOS, 0, 0)+DSBVOLUME_MIN;
- sprintf(str, "%.2f dB", ((float)lVolume)/100.0f);
- SetWindowText(m_hOuterVolumeStatic, str);
- return SetConeOutsideVolume(lVolume, DS3D_IMMEDIATE);
- }
-
- bool BufferDlg::UpdateZoomFXExtent()
- {
- ZOOMFX_BOX extent;
- char str[20];
-
- extent.vMax.x = (D3DVALUE)SendMessage(m_hZoomFXMaxXSlider, TBM_GETPOS, 0, 0);
- extent.vMax.y = (D3DVALUE)SendMessage(m_hZoomFXMaxYSlider, TBM_GETPOS, 0, 0);
- extent.vMax.z = (D3DVALUE)SendMessage(m_hZoomFXMaxZSlider, TBM_GETPOS, 0, 0);
- if(m_bZoomFXSymmetrical)
- {
- extent.vMin.x = -extent.vMax.x;
- extent.vMin.y = -extent.vMax.y;
- extent.vMin.z = -extent.vMax.z;
- SendMessage(m_hZoomFXMinXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-extent.vMin.x);
- SendMessage(m_hZoomFXMinYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-extent.vMin.y);
- SendMessage(m_hZoomFXMinZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-extent.vMin.z);
- }
- else
- {
- extent.vMin.x = -(D3DVALUE)SendMessage(m_hZoomFXMinXSlider, TBM_GETPOS, 0, 0);
- extent.vMin.y = -(D3DVALUE)SendMessage(m_hZoomFXMinYSlider, TBM_GETPOS, 0, 0);
- extent.vMin.z = -(D3DVALUE)SendMessage(m_hZoomFXMinZSlider, TBM_GETPOS, 0, 0);
- }
- sprintf(str, "X:%.0f", extent.vMax.x);
- SetWindowText(m_hZoomFXMaxXStatic, str);
- sprintf(str, "Y:%.0f", extent.vMax.y);
- SetWindowText(m_hZoomFXMaxYStatic, str);
- sprintf(str, "Z:%.0f", extent.vMax.z);
- SetWindowText(m_hZoomFXMaxZStatic, str);
- sprintf(str, "X:%.0f", extent.vMin.x);
- SetWindowText(m_hZoomFXMinXStatic, str);
- sprintf(str, "Y:%.0f", extent.vMin.y);
- SetWindowText(m_hZoomFXMinYStatic, str);
- sprintf(str, "Z:%.0f", extent.vMin.z);
- SetWindowText(m_hZoomFXMinZStatic, str);
-
- return SetZoomFXExtent(&extent);
- }
-
- bool BufferDlg::UpdateZoomFXExtentSymmetrical(bool bSymmetrical)
- {
- ZOOMFX_BOX extent;
- char str[20];
-
- m_bZoomFXSymmetrical = bSymmetrical;
-
- if(m_bZoomFXSymmetrical)
- {
- extent.vMax.x = (D3DVALUE)SendMessage(m_hZoomFXMaxXSlider, TBM_GETPOS, 0, 0);
- extent.vMax.y = (D3DVALUE)SendMessage(m_hZoomFXMaxYSlider, TBM_GETPOS, 0, 0);
- extent.vMax.z = (D3DVALUE)SendMessage(m_hZoomFXMaxZSlider, TBM_GETPOS, 0, 0);
- extent.vMin.x = -extent.vMax.x;
- extent.vMin.y = -extent.vMax.y;
- extent.vMin.z = -extent.vMax.z;
- SendMessage(m_hZoomFXMinXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-extent.vMin.x);
- SendMessage(m_hZoomFXMinYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-extent.vMin.y);
- SendMessage(m_hZoomFXMinZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)-extent.vMin.z);
- sprintf(str, "X:%.0f", extent.vMin.x);
- SetWindowText(m_hZoomFXMinXStatic, str);
- sprintf(str, "Y:%.0f", extent.vMin.y);
- SetWindowText(m_hZoomFXMinYStatic, str);
- sprintf(str, "Z:%.0f", extent.vMin.z);
- SetWindowText(m_hZoomFXMinZStatic, str);
- return SetZoomFXExtent(&extent);
- }
- return true;
- }
-
- void BufferDlg::UpdateZoomFXOrientation()
- {
- char str[20];
-
- m_Orientation.vFront.x = (D3DVALUE)SendMessage(m_hZoomFXFrontXSlider, TBM_GETPOS, 0, 0)/100.0f;
- m_Orientation.vFront.y = (D3DVALUE)SendMessage(m_hZoomFXFrontYSlider, TBM_GETPOS, 0, 0)/100.0f;
- m_Orientation.vFront.z = (D3DVALUE)SendMessage(m_hZoomFXFrontZSlider, TBM_GETPOS, 0, 0)/100.0f;
- m_Orientation.vTop.x = (D3DVALUE)SendMessage(m_hZoomFXTopXSlider, TBM_GETPOS, 0, 0)/100.0f;
- m_Orientation.vTop.y = (D3DVALUE)SendMessage(m_hZoomFXTopYSlider, TBM_GETPOS, 0, 0)/100.0f;
- m_Orientation.vTop.z = (D3DVALUE)SendMessage(m_hZoomFXTopZSlider, TBM_GETPOS, 0, 0)/100.0f;
- sprintf(str, "X:%.2f", m_Orientation.vFront.x);
- SetWindowText(m_hZoomFXFrontXStatic, str);
- sprintf(str, "Y:%.2f", m_Orientation.vFront.y);
- SetWindowText(m_hZoomFXFrontYStatic, str);
- sprintf(str, "Z:%.2f", m_Orientation.vFront.z);
- SetWindowText(m_hZoomFXFrontZStatic, str);
- sprintf(str, "X:%.2f", m_Orientation.vTop.x);
- SetWindowText(m_hZoomFXTopXStatic, str);
- sprintf(str, "Y:%.2f", m_Orientation.vTop.y);
- SetWindowText(m_hZoomFXTopYStatic, str);
- sprintf(str, "Z:%.2f", m_Orientation.vTop.z);
- SetWindowText(m_hZoomFXTopZStatic, str);
- }
-
- bool BufferDlg::CommitZoomFXOrientation()
- {
- char str[20];
-
- if(!SetZoomFXOrientation(&m_Orientation))
- return false;
-
- if(!GetZoomFXOrientation(&m_Orientation))
- return false;
-
- SendMessage(m_hZoomFXFrontXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(m_Orientation.vFront.x*100.0f));
- SendMessage(m_hZoomFXFrontYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(m_Orientation.vFront.y*100.0f));
- SendMessage(m_hZoomFXFrontZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(m_Orientation.vFront.z*100.0f));
- SendMessage(m_hZoomFXTopXSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(m_Orientation.vTop.x*100.0f));
- SendMessage(m_hZoomFXTopYSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(m_Orientation.vTop.y*100.0f));
- SendMessage(m_hZoomFXTopZSlider, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(m_Orientation.vTop.z*100.0f));
- sprintf(str, "X:%.2f", m_Orientation.vFront.x);
- SetWindowText(m_hZoomFXFrontXStatic, str);
- sprintf(str, "Y:%.2f", m_Orientation.vFront.y);
- SetWindowText(m_hZoomFXFrontYStatic, str);
- sprintf(str, "Z:%.2f", m_Orientation.vFront.z);
- SetWindowText(m_hZoomFXFrontZStatic, str);
- sprintf(str, "X:%.2f", m_Orientation.vTop.x);
- SetWindowText(m_hZoomFXTopXStatic, str);
- sprintf(str, "Y:%.2f", m_Orientation.vTop.y);
- SetWindowText(m_hZoomFXTopYStatic, str);
- sprintf(str, "Z:%.2f", m_Orientation.vTop.z);
- SetWindowText(m_hZoomFXTopZStatic, str);
-
- return true;
- }
-
- void BufferDlg::UpdateDistanceStatics(D3DVALUE flMinDistance, D3DVALUE flMaxDistance)
- {
- char str[20];
-
- sprintf(str, "%.0f", flMinDistance);
- SetWindowText(m_hMinDistanceStatic, str);
- sprintf(str, "%.0f", flMaxDistance);
- SetWindowText(m_hMaxDistanceStatic, str);
- }
-
- void BufferDlg::UpdatePositionStatics(LPD3DVECTOR p)
- {
- char str[20];
-
- sprintf(str, "X:%.0f", p->x);
- SetWindowText(m_hPositionXStatic, str);
- sprintf(str, "Y:%.0f", p->y);
- SetWindowText(m_hPositionYStatic, str);
- sprintf(str, "Z:%.0f", p->z);
- SetWindowText(m_hPositionZStatic, str);
- }
-
- void BufferDlg::UpdateVelocityStatics(LPD3DVECTOR v)
- {
- char str[20];
-
- sprintf(str, "X:%.0f", v->x);
- SetWindowText(m_hVelocityXStatic, str);
- sprintf(str, "Y:%.0f", v->y);
- SetWindowText(m_hVelocityYStatic, str);
- sprintf(str, "Z:%.0f", v->z);
- SetWindowText(m_hVelocityZStatic, str);
- }
-
- void BufferDlg::UpdateConeAngleStatics(DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle)
- {
- char str[20];
-
- sprintf(str, "%d", dwInsideConeAngle);
- SetWindowText(m_hInnerConeAngleStatic, str);
- sprintf(str, "%d", dwOutsideConeAngle);
- SetWindowText(m_hOuterConeAngleStatic, str);
- }
-
-