Initial commit: ROW Client source code
Game client codebase including: - CharacterActionControl: Character and creature management - GlobalScript: Network, items, skills, quests, utilities - RYLClient: Main client application with GUI and event handlers - Engine: 3D rendering engine (RYLGL) - MemoryManager: Custom memory allocation - Library: Third-party dependencies (DirectX, boost, etc.) - Tools: Development utilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
//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
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#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
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
|
||||
"#ifdef _WIN32\r\n"
|
||||
"LANGUAGE 9, 1\r\n"
|
||||
"#pragma code_page(1252)\r\n"
|
||||
"#endif\r\n"
|
||||
"#include ""afxres.rc"" // Standard components\r\n"
|
||||
"#endif\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON DISCARDABLE "directx.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_MAIN DIALOGEX 0, 0, 315, 257
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "AdjustSound"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Sound &file...",IDC_SOUNDFILE,7,7,46,13
|
||||
LTEXT "Static",IDC_FILENAME,57,7,251,13,SS_CENTERIMAGE,
|
||||
WS_EX_CLIENTEDGE
|
||||
LTEXT "Status",IDC_STATIC,7,24,42,13,SS_CENTERIMAGE
|
||||
LTEXT "Static",IDC_STATUS,57,24,251,13,SS_CENTERIMAGE,
|
||||
WS_EX_CLIENTEDGE
|
||||
LTEXT "Frequency",IDC_STATIC,7,41,42,13,SS_CENTERIMAGE
|
||||
CTEXT "0",IDC_FREQUENCY,57,41,35,13,SS_CENTERIMAGE,
|
||||
WS_EX_STATICEDGE
|
||||
CTEXT "100 Hz",IDC_STATIC,96,41,25,13,SS_CENTERIMAGE
|
||||
CONTROL "Slider1",IDC_FREQUENCY_SLIDER,"msctls_trackbar32",
|
||||
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,120,40,157,15
|
||||
CTEXT "100 kHz",IDC_STATIC,278,41,30,13,SS_CENTERIMAGE
|
||||
LTEXT "Pan",IDC_STATIC,7,59,42,13,SS_CENTERIMAGE
|
||||
CTEXT "0",IDC_PAN,57,59,35,13,SS_CENTERIMAGE,WS_EX_STATICEDGE
|
||||
CTEXT "Left",IDC_STATIC,106,59,15,13,SS_CENTERIMAGE
|
||||
CONTROL "Slider2",IDC_PAN_SLIDER,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,120,58,157,15
|
||||
CTEXT "Right",IDC_STATIC,278,58,30,13,SS_CENTERIMAGE
|
||||
LTEXT "Volume",IDC_STATIC,7,75,42,13,SS_CENTERIMAGE
|
||||
CTEXT "0",IDC_VOLUME,57,75,35,13,SS_CENTERIMAGE,
|
||||
WS_EX_STATICEDGE
|
||||
CTEXT "Low",IDC_STATIC,106,75,15,13,SS_CENTERIMAGE
|
||||
CONTROL "Slider3",IDC_VOLUME_SLIDER,"msctls_trackbar32",TBS_BOTH |
|
||||
TBS_NOTICKS | WS_TABSTOP,120,74,157,15
|
||||
CTEXT "High",IDC_STATIC,278,74,30,13,SS_CENTERIMAGE
|
||||
LTEXT "Focus",IDC_STATIC,12,99,20,8
|
||||
CONTROL "Normal",IDC_FOCUS_NORMAL,"Button",BS_AUTORADIOBUTTON,82,
|
||||
98,38,10
|
||||
CONTROL "Sticky",IDC_FOCUS_STICKY,"Button",BS_AUTORADIOBUTTON,
|
||||
131,98,35,10
|
||||
CONTROL "Global",IDC_FOCUS_GLOBAL,"Button",BS_AUTORADIOBUTTON,
|
||||
177,98,36,10
|
||||
LTEXT "Buffer Mixing",IDC_STATIC,12,110,42,8
|
||||
CONTROL "Default",IDC_MIX_DEFAULT,"Button",BS_AUTORADIOBUTTON,82,
|
||||
109,39,10
|
||||
CONTROL "Hardware",IDC_MIX_HARDWARE,"Button",BS_AUTORADIOBUTTON,
|
||||
131,109,47,10
|
||||
CONTROL "Software",IDC_MIX_SOFTWARE,"Button",BS_AUTORADIOBUTTON,
|
||||
177,109,44,10
|
||||
CONTROL "&Loop sound",IDC_LOOP_CHECK,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,224,53,10
|
||||
PUSHBUTTON "&Play",IDC_PLAY,7,236,50,14,WS_DISABLED
|
||||
PUSHBUTTON "&Stop",IDC_STOP,62,236,50,14,WS_DISABLED
|
||||
PUSHBUTTON "E&xit",IDCANCEL,258,236,50,14
|
||||
GROUPBOX "Expected Behavior",IDC_STATIC,7,126,301,94
|
||||
LTEXT "Static",IDC_BEHAVIOR,13,136,288,77
|
||||
GROUPBOX "Buffer Settings",IDC_STATIC,7,89,301,36
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_MAIN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 308
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 250
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 9, 1
|
||||
#pragma code_page(1252)
|
||||
#endif
|
||||
#include "afxres.rc" // Standard components
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,603 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// File: AdjustSound.cpp
|
||||
//
|
||||
// Desc: AdjustSound sample sample shows how to load and play a wave file using
|
||||
// a DirectSound buffer and adjust its focus, frequency, pan, and volume.
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corp. All rights reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <basetsd.h>
|
||||
#include <mmsystem.h>
|
||||
#include <mmreg.h>
|
||||
#include <dxerr8.h>
|
||||
#include <dsound.h>
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
#include <dsound.h>
|
||||
#include "resource.h"
|
||||
#include "DSUtil.h"
|
||||
#include "DXUtil.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Function-prototypes
|
||||
//-----------------------------------------------------------------------------
|
||||
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
VOID OnInitDialog( HWND hDlg );
|
||||
VOID OnTimer( HWND hDlg );
|
||||
|
||||
VOID OnOpenSoundFile( HWND hDlg );
|
||||
VOID ValidateWaveFile( HWND hDlg, TCHAR* strFileName );
|
||||
|
||||
HRESULT OnPlaySound( HWND hDlg );
|
||||
HRESULT CreateAndFillBuffer( HWND hDlg, DWORD dwCreationFlags );
|
||||
|
||||
VOID UpdateBehaviorText( HWND hDlg );
|
||||
VOID OnSliderChanged( HWND hDlg );
|
||||
VOID SetBufferOptions( LONG lFrequency, LONG lPan, LONG lVolume );
|
||||
VOID EnablePlayUI( HWND hDlg, BOOL bEnable );
|
||||
VOID SetSlidersPos( HWND hDlg, LONG lFreqSlider, LONG lPanSlider, LONG lVolumeSlider );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines, constants, and global variables
|
||||
//-----------------------------------------------------------------------------
|
||||
TCHAR m_strWaveFileName[MAX_PATH];
|
||||
CSoundManager* g_pSoundManager = NULL;
|
||||
CSound* g_pSound = NULL;
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: WinMain()
|
||||
// Desc: Entry point for the application. Since we use a simple dialog for
|
||||
// user interaction we don't need to pump messages.
|
||||
//-----------------------------------------------------------------------------
|
||||
INT APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR pCmdLine, INT nCmdShow )
|
||||
{
|
||||
// Init the common control dll
|
||||
InitCommonControls();
|
||||
|
||||
// Display the main dialog box.
|
||||
DialogBox( hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, MainDlgProc );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: MainDlgProc()
|
||||
// Desc: Handles dialog messages
|
||||
//-----------------------------------------------------------------------------
|
||||
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
switch( msg )
|
||||
{
|
||||
case WM_COMMAND:
|
||||
switch( LOWORD(wParam) )
|
||||
{
|
||||
case IDCANCEL:
|
||||
EndDialog( hDlg, IDCANCEL );
|
||||
break;
|
||||
|
||||
case IDC_SOUNDFILE:
|
||||
OnOpenSoundFile( hDlg );
|
||||
break;
|
||||
|
||||
case IDC_PLAY:
|
||||
if( FAILED( hr = OnPlaySound( hDlg ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("OnPlaySound"), hr );
|
||||
MessageBox( hDlg, "Error playing DirectSound buffer."
|
||||
"Sample will now exit.", "DirectSound Sample",
|
||||
MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, IDABORT );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IDC_STOP:
|
||||
if( g_pSound )
|
||||
{
|
||||
g_pSound->Stop();
|
||||
g_pSound->Reset();
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_MIX_DEFAULT:
|
||||
case IDC_MIX_HARDWARE:
|
||||
case IDC_MIX_SOFTWARE:
|
||||
case IDC_FOCUS_GLOBAL:
|
||||
case IDC_FOCUS_STICKY:
|
||||
case IDC_FOCUS_NORMAL:
|
||||
UpdateBehaviorText( hDlg );
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE; // Didn't handle message
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
OnTimer( hDlg );
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
OnInitDialog( hDlg );
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
OnSliderChanged( hDlg );
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
// Cleanup everything
|
||||
KillTimer( hDlg, 1 );
|
||||
SAFE_DELETE( g_pSound );
|
||||
SAFE_DELETE( g_pSoundManager );
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE; // Didn't handle message
|
||||
}
|
||||
|
||||
return TRUE; // Handled message
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnInitDialog()
|
||||
// Desc: Initializes the dialogs (sets up UI controls, etc.)
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID OnInitDialog( HWND hDlg )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
// Load the icon
|
||||
#ifdef _WIN64
|
||||
HINSTANCE hInst = (HINSTANCE) GetWindowLongPtr( hDlg, GWLP_HINSTANCE );
|
||||
#else
|
||||
HINSTANCE hInst = (HINSTANCE) GetWindowLong( hDlg, GWL_HINSTANCE );
|
||||
#endif
|
||||
HICON hIcon = LoadIcon( hInst, MAKEINTRESOURCE( IDR_MAINFRAME ) );
|
||||
|
||||
// Create a static IDirectSound in the CSound class.
|
||||
// Set coop level to DSSCL_PRIORITY, and set primary buffer
|
||||
// format to stereo, 22kHz and 16-bit output.
|
||||
g_pSoundManager = new CSoundManager();
|
||||
|
||||
if( FAILED( hr = g_pSoundManager->Initialize( hDlg, DSSCL_PRIORITY, 2, 22050, 16 ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("Initialize"), hr );
|
||||
MessageBox( hDlg, "Error initializing DirectSound. Sample will now exit.",
|
||||
"DirectSound Sample", MB_OK | MB_ICONERROR );
|
||||
EndDialog( hDlg, IDABORT );
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the icon for this dialog.
|
||||
PostMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon ); // Set big icon
|
||||
PostMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon ); // Set small icon
|
||||
|
||||
// Create a timer, so we can check for when the soundbuffer is stopped
|
||||
SetTimer( hDlg, 0, 250, NULL );
|
||||
|
||||
// Get handles to dialog items
|
||||
HWND hFreqSlider = GetDlgItem( hDlg, IDC_FREQUENCY_SLIDER );
|
||||
HWND hPanSlider = GetDlgItem( hDlg, IDC_PAN_SLIDER );
|
||||
HWND hVolumeSlider = GetDlgItem( hDlg, IDC_VOLUME_SLIDER );
|
||||
|
||||
// Set the focus to normal by default
|
||||
CheckRadioButton( hDlg, IDC_FOCUS_NORMAL, IDC_FOCUS_NORMAL, IDC_FOCUS_NORMAL );
|
||||
|
||||
// Set the buffer mixing to default
|
||||
CheckRadioButton( hDlg, IDC_MIX_DEFAULT, IDC_MIX_SOFTWARE, IDC_MIX_DEFAULT );
|
||||
|
||||
// Set the range and position of the freq slider from
|
||||
// DSBFREQUENCY_MIN and DSBFREQUENCY_MAX are DirectSound constants
|
||||
PostMessage( hFreqSlider, TBM_SETRANGEMAX, TRUE, DSBFREQUENCY_MAX );
|
||||
PostMessage( hFreqSlider, TBM_SETRANGEMIN, TRUE, DSBFREQUENCY_MIN );
|
||||
|
||||
// Set the range and position of the pan slider from
|
||||
PostMessage( hPanSlider, TBM_SETRANGEMAX, TRUE, ( 10000L/500L) );
|
||||
PostMessage( hPanSlider, TBM_SETRANGEMIN, TRUE, (-10000L/500L) );
|
||||
|
||||
// Set the range and position of the volume slider
|
||||
PostMessage( hVolumeSlider, TBM_SETRANGEMAX, TRUE, 0L );
|
||||
PostMessage( hVolumeSlider, TBM_SETRANGEMIN, TRUE, (-5000L/100L) );
|
||||
|
||||
// Set the position of the sliders
|
||||
SetSlidersPos( hDlg, DSBFREQUENCY_MIN, 0, 0 );
|
||||
|
||||
// Set the UI controls
|
||||
SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("No file loaded.") );
|
||||
UpdateBehaviorText( hDlg );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnOpenSoundFile()
|
||||
// Desc: Called when the user requests to open a sound file
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID OnOpenSoundFile( HWND hDlg )
|
||||
{
|
||||
static TCHAR strFileName[MAX_PATH] = TEXT("");
|
||||
static TCHAR strPath[MAX_PATH] = TEXT("");
|
||||
|
||||
// Setup the OPENFILENAME structure
|
||||
OPENFILENAME ofn = { sizeof(OPENFILENAME), hDlg, NULL,
|
||||
TEXT("Wave Files\0*.wav\0All Files\0*.*\0\0"), NULL,
|
||||
0, 1, strFileName, MAX_PATH, NULL, 0, strPath,
|
||||
TEXT("Open Sound File"),
|
||||
OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, 0, 0,
|
||||
TEXT(".wav"), 0, NULL, NULL };
|
||||
|
||||
// Get the default media path (something like C:\WINDOWS\MEDIA)
|
||||
if( '\0' == strPath[0] )
|
||||
{
|
||||
GetWindowsDirectory( strPath, MAX_PATH );
|
||||
if( strcmp( &strPath[strlen(strPath)], TEXT("\\") ) )
|
||||
strcat( strPath, TEXT("\\") );
|
||||
strcat( strPath, TEXT("MEDIA") );
|
||||
}
|
||||
|
||||
// Update the UI controls to show the sound as loading a file
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_PLAY ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_STOP ), FALSE );
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Loading file...") );
|
||||
|
||||
if( g_pSound )
|
||||
{
|
||||
g_pSound->Stop();
|
||||
g_pSound->Reset();
|
||||
}
|
||||
|
||||
// Display the OpenFileName dialog. Then, try to load the specified file
|
||||
if( TRUE != GetOpenFileName( &ofn ) )
|
||||
{
|
||||
if( g_pSound )
|
||||
{
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_PLAY ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_STOP ), TRUE );
|
||||
}
|
||||
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Load aborted.") );
|
||||
return;
|
||||
}
|
||||
|
||||
SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );
|
||||
|
||||
// Make sure wave file is a valid wav file
|
||||
ValidateWaveFile( hDlg, strFileName );
|
||||
|
||||
// Remember the path for next time
|
||||
strcpy( strPath, strFileName );
|
||||
char* strLastSlash = strrchr( strPath, '\\' );
|
||||
strLastSlash[0] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: ValidateWaveFile()
|
||||
// Desc: Open the wave file with the helper
|
||||
// class CWaveFile to make sure it is valid
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID ValidateWaveFile( HWND hDlg, TCHAR* strFileName )
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
CWaveFile waveFile;
|
||||
|
||||
// Load the wave file
|
||||
if( FAILED( hr = waveFile.Open( strFileName, NULL, WAVEFILE_READ ) ) )
|
||||
{
|
||||
DXTRACE_ERR( TEXT("Open"), hr );
|
||||
waveFile.Close();
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Bad wave file.") );
|
||||
}
|
||||
else // The load call succeeded
|
||||
{
|
||||
// Update the UI controls to show the sound as the file is loaded
|
||||
waveFile.Close();
|
||||
|
||||
EnablePlayUI( hDlg, TRUE );
|
||||
SetDlgItemText( hDlg, IDC_FILENAME, strFileName );
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("File loaded.") );
|
||||
strcpy( m_strWaveFileName, strFileName );
|
||||
|
||||
// Get the samples per sec from the wave file
|
||||
DWORD dwSamplesPerSec = waveFile.m_pwfx->nSamplesPerSec;
|
||||
|
||||
// Set the slider positions
|
||||
SetSlidersPos( hDlg, dwSamplesPerSec, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnPlaySound()
|
||||
// Desc: User hit the "Play" button
|
||||
//-----------------------------------------------------------------------------
|
||||
HRESULT OnPlaySound( HWND hDlg )
|
||||
{
|
||||
HRESULT hr;
|
||||
DWORD dwCreationFlags;
|
||||
|
||||
BOOL bLooped = ( IsDlgButtonChecked( hDlg, IDC_LOOP_CHECK ) == BST_CHECKED );
|
||||
BOOL bFocusSticky = ( IsDlgButtonChecked( hDlg, IDC_FOCUS_STICKY ) == BST_CHECKED );
|
||||
BOOL bFocusGlobal = ( IsDlgButtonChecked( hDlg, IDC_FOCUS_GLOBAL ) == BST_CHECKED );
|
||||
BOOL bMixHardware = ( IsDlgButtonChecked( hDlg, IDC_MIX_HARDWARE ) == BST_CHECKED );
|
||||
BOOL bMixSoftware = ( IsDlgButtonChecked( hDlg, IDC_MIX_SOFTWARE ) == BST_CHECKED );
|
||||
|
||||
// Detrimine the creation flags to use based on the radio buttons
|
||||
dwCreationFlags = 0;
|
||||
if( bFocusGlobal )
|
||||
dwCreationFlags |= DSBCAPS_GLOBALFOCUS;
|
||||
|
||||
if( bFocusSticky )
|
||||
dwCreationFlags |= DSBCAPS_STICKYFOCUS;
|
||||
|
||||
if( bMixHardware )
|
||||
dwCreationFlags |= DSBCAPS_LOCHARDWARE;
|
||||
|
||||
if( bMixSoftware )
|
||||
dwCreationFlags |= DSBCAPS_LOCSOFTWARE;
|
||||
|
||||
// Add extra flags needed for the UI
|
||||
dwCreationFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
|
||||
|
||||
// Free any previous sound
|
||||
SAFE_DELETE( g_pSound );
|
||||
|
||||
// Since the user can change the focus before the sound is played,
|
||||
// we need to create the sound buffer every time the play button is pressed
|
||||
|
||||
// Load the wave file into a DirectSound buffer
|
||||
if( FAILED( hr = g_pSoundManager->Create( &g_pSound, m_strWaveFileName, dwCreationFlags, GUID_NULL ) ) )
|
||||
{
|
||||
// Not a critical failure, so just update the status
|
||||
DXTRACE_ERR_NOMSGBOX( TEXT("Create"), hr );
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Could not create sound buffer.") );
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
// Set the buffer options to what the sliders are set to
|
||||
OnSliderChanged( hDlg );
|
||||
|
||||
// Only if the sound buffer was created perfectly should we update the UI
|
||||
// and play the sound
|
||||
// Play the sound
|
||||
DWORD dwLooped = bLooped ? DSBPLAY_LOOPING : 0L;
|
||||
|
||||
if( FAILED( hr = g_pSound->Play( 0, dwLooped ) ) )
|
||||
return DXTRACE_ERR( TEXT("Play"), hr );
|
||||
|
||||
// Update the UI controls to show the sound as playing
|
||||
EnablePlayUI( hDlg, FALSE );
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Sound playing.") );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnTimer()
|
||||
// Desc: When we think the sound is playing this periodically checks to see if
|
||||
// the sound has stopped. If it has then updates the dialog.
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID OnTimer( HWND hDlg )
|
||||
{
|
||||
if( IsWindowEnabled( GetDlgItem( hDlg, IDC_STOP ) ) )
|
||||
{
|
||||
// We think the sound is playing, so see if it has stopped yet.
|
||||
if( !g_pSound->IsSoundPlaying() )
|
||||
{
|
||||
// Update the UI controls to show the sound as stopped
|
||||
EnablePlayUI( hDlg, TRUE );
|
||||
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Sound stopped.") );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: OnSliderChanged()
|
||||
// Desc: Called when the dialog's slider bars are changed by the user, or need
|
||||
// updating
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID OnSliderChanged( HWND hDlg )
|
||||
{
|
||||
TCHAR strBuffer[10];
|
||||
|
||||
// Get handles to dialog items
|
||||
HWND hFreqSlider = GetDlgItem( hDlg, IDC_FREQUENCY_SLIDER );
|
||||
HWND hPanSlider = GetDlgItem( hDlg, IDC_PAN_SLIDER );
|
||||
HWND hVolumeSlider = GetDlgItem( hDlg, IDC_VOLUME_SLIDER );
|
||||
|
||||
// Get the position of the sliders
|
||||
LONG lFrequency = (LONG)SendMessage( hFreqSlider, TBM_GETPOS, 0, 0 ) * 1L;
|
||||
LONG lPan = (LONG)SendMessage( hPanSlider, TBM_GETPOS, 0, 0 ) * 500L;
|
||||
LONG lVolume = (LONG)SendMessage( hVolumeSlider, TBM_GETPOS, 0, 0 ) * 100L;
|
||||
|
||||
// Set the static text boxes
|
||||
wsprintf( strBuffer, TEXT("%ld"), lFrequency );
|
||||
SetWindowText( GetDlgItem( hDlg, IDC_FREQUENCY ), strBuffer );
|
||||
|
||||
wsprintf( strBuffer, TEXT("%ld"), lPan );
|
||||
SetWindowText( GetDlgItem( hDlg, IDC_PAN ), strBuffer );
|
||||
|
||||
wsprintf( strBuffer, TEXT("%ld"), lVolume );
|
||||
SetWindowText( GetDlgItem( hDlg, IDC_VOLUME ), strBuffer );
|
||||
|
||||
// Set the options in the DirectSound buffer
|
||||
if( g_pSound )
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER pDSB = g_pSound->GetBuffer( 0 );
|
||||
|
||||
if( pDSB )
|
||||
{
|
||||
pDSB->SetFrequency( lFrequency );
|
||||
pDSB->SetPan( lPan );
|
||||
pDSB->SetVolume( lVolume );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: UpdateBehaviorText()
|
||||
// Desc: Figure out what the expected behavoir is based on the dialog,
|
||||
// and display it on the dialog
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID UpdateBehaviorText( HWND hDlg )
|
||||
{
|
||||
TCHAR strExcepted[1024];
|
||||
|
||||
BOOL bLooped = ( IsDlgButtonChecked( hDlg, IDC_LOOP_CHECK ) == BST_CHECKED );
|
||||
BOOL bFocusSticky = ( IsDlgButtonChecked( hDlg, IDC_FOCUS_STICKY ) == BST_CHECKED );
|
||||
BOOL bFocusGlobal = ( IsDlgButtonChecked( hDlg, IDC_FOCUS_GLOBAL ) == BST_CHECKED );
|
||||
BOOL bMixHardware = ( IsDlgButtonChecked( hDlg, IDC_MIX_HARDWARE ) == BST_CHECKED );
|
||||
BOOL bMixSoftware = ( IsDlgButtonChecked( hDlg, IDC_MIX_SOFTWARE ) == BST_CHECKED );
|
||||
|
||||
// Figure what the user should expect based on the dialog choice
|
||||
if( bFocusSticky )
|
||||
{
|
||||
strcpy( strExcepted, "Buffers with \"sticky\" focus will continue to play "
|
||||
"if the user switches to another application not using "
|
||||
"DirectSound. However, if the user switches to another "
|
||||
"DirectSound application, all normal-focus and sticky-focus "
|
||||
"buffers in the previous application are muted." );
|
||||
|
||||
}
|
||||
else if( bFocusGlobal )
|
||||
{
|
||||
strcpy( strExcepted, "Buffers with global focus will continue to play if the user "
|
||||
"switches focus to another application, even if the new application "
|
||||
"uses DirectSound. The one exception is if you switch focus to a "
|
||||
"DirectSound application that uses the DSSCL_WRITEPRIMARY "
|
||||
"cooperative level. In this case, the global-focus buffers from "
|
||||
"other applications will not be audible." );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal focus
|
||||
strcpy( strExcepted, "Buffers with normal focus will mute if the user switches "
|
||||
"focus to any other application" );
|
||||
}
|
||||
|
||||
|
||||
if( bMixHardware )
|
||||
{
|
||||
strcat( strExcepted, "\n\nWith the hardware mixing flag, the new buffer will "
|
||||
"be forced to use hardware mixing. If the device does "
|
||||
"not support hardware mixing or if the required "
|
||||
"hardware resources are not available, the call to the "
|
||||
"IDirectSound::CreateSoundBuffer method will fail." );
|
||||
}
|
||||
else if( bMixSoftware )
|
||||
{
|
||||
strcat( strExcepted, "\n\nWith the software mixing flag, the new buffer will use "
|
||||
"software mixing, even if hardware resources are available." );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Default mixing
|
||||
strcat( strExcepted, "\n\nWith default mixing, the new buffer will use hardware "
|
||||
"mixing if available, otherwise software mixing will be used." );
|
||||
}
|
||||
|
||||
// Tell the user what to expect
|
||||
SetDlgItemText( hDlg, IDC_BEHAVIOR, strExcepted );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: EnablePlayUI()
|
||||
// Desc: Enables or disables the Play UI controls
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID EnablePlayUI( HWND hDlg, BOOL bEnable )
|
||||
{
|
||||
if( bEnable )
|
||||
{
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_LOOP_CHECK ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_PLAY ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_STOP ), FALSE );
|
||||
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_FOCUS_NORMAL ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_FOCUS_STICKY ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_FOCUS_GLOBAL ), TRUE );
|
||||
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_MIX_DEFAULT ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_MIX_HARDWARE ), TRUE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_MIX_SOFTWARE ), TRUE );
|
||||
|
||||
SetFocus( GetDlgItem( hDlg, IDC_PLAY ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_LOOP_CHECK ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_PLAY ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_STOP ), TRUE );
|
||||
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_FOCUS_NORMAL ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_FOCUS_STICKY ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_FOCUS_GLOBAL ), FALSE );
|
||||
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_MIX_DEFAULT ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_MIX_HARDWARE ), FALSE );
|
||||
EnableWindow( GetDlgItem( hDlg, IDC_MIX_SOFTWARE ), FALSE );
|
||||
|
||||
SetFocus( GetDlgItem( hDlg, IDC_STOP ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Name: SetSlidersPos()
|
||||
// Desc: Sets the slider positions
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID SetSlidersPos( HWND hDlg, LONG lFreqSlider, LONG lPanSlider, LONG lVolumeSlider )
|
||||
{
|
||||
HWND hFreqSlider = GetDlgItem( hDlg, IDC_FREQUENCY_SLIDER );
|
||||
HWND hPanSlider = GetDlgItem( hDlg, IDC_PAN_SLIDER );
|
||||
HWND hVolumeSlider = GetDlgItem( hDlg, IDC_VOLUME_SLIDER );
|
||||
|
||||
PostMessage( hFreqSlider, TBM_SETPOS, TRUE, lFreqSlider );
|
||||
PostMessage( hPanSlider, TBM_SETPOS, TRUE, lPanSlider );
|
||||
PostMessage( hVolumeSlider, TBM_SETPOS, TRUE, lVolumeSlider );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
# Microsoft Developer Studio Project File - Name="AdjustSound" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=AdjustSound - 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 "adjustsound.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 "adjustsound.mak" CFG="AdjustSound - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AdjustSound - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AdjustSound - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "AdjustSound - 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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /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 /subsystem:windows /machine:I386
|
||||
# ADD LINK32 comctl32.lib dxerr8.lib winmm.lib dsound.lib dxguid.lib 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 /subsystem:windows /machine:I386 /stack:0x200000,0x200000
|
||||
|
||||
!ELSEIF "$(CFG)" == "AdjustSound - 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 /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /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 /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 comctl32.lib dxerr8.lib winmm.lib dsound.lib dxguid.lib 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 /subsystem:windows /debug /machine:I386 /pdbtype:sept /stack:0x200000,0x200000
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "AdjustSound - Win32 Release"
|
||||
# Name "AdjustSound - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\adjustsound.cpp
|
||||
# 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=.\AdjustSound.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\directx.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winmain.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\dsutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\dsutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\include\dxutil.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "AdjustSound"=.\adjustsound.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
# Microsoft Developer Studio Generated NMAKE File, Based on adjustsound.dsp
|
||||
!IF "$(CFG)" == ""
|
||||
CFG=AdjustSound - Win32 Debug
|
||||
!MESSAGE No configuration specified. Defaulting to AdjustSound - Win32 Debug.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" != "AdjustSound - Win32 Release" && "$(CFG)" != "AdjustSound - Win32 Debug"
|
||||
!MESSAGE Invalid configuration "$(CFG)" specified.
|
||||
!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 "adjustsound.mak" CFG="AdjustSound - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "AdjustSound - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "AdjustSound - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
!ERROR An invalid configuration is specified.
|
||||
!ENDIF
|
||||
|
||||
!IF "$(OS)" == "Windows_NT"
|
||||
NULL=
|
||||
!ELSE
|
||||
NULL=nul
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CFG)" == "AdjustSound - Win32 Release"
|
||||
|
||||
OUTDIR=.\Release
|
||||
INTDIR=.\Release
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Release
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\adjustsound.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\adjustsound.obj"
|
||||
-@erase "$(INTDIR)\AdjustSound.res"
|
||||
-@erase "$(INTDIR)\dsutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(OUTDIR)\adjustsound.exe"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\adjustsound.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\AdjustSound.res" /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\adjustsound.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=comctl32.lib dxerr8.lib winmm.lib dsound.lib dxguid.lib 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 /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\adjustsound.pdb" /machine:I386 /out:"$(OUTDIR)\adjustsound.exe" /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\adjustsound.obj" \
|
||||
"$(INTDIR)\dsutil.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AdjustSound.res"
|
||||
|
||||
"$(OUTDIR)\adjustsound.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ELSEIF "$(CFG)" == "AdjustSound - Win32 Debug"
|
||||
|
||||
OUTDIR=.\Debug
|
||||
INTDIR=.\Debug
|
||||
# Begin Custom Macros
|
||||
OutDir=.\Debug
|
||||
# End Custom Macros
|
||||
|
||||
ALL : "$(OUTDIR)\adjustsound.exe"
|
||||
|
||||
|
||||
CLEAN :
|
||||
-@erase "$(INTDIR)\adjustsound.obj"
|
||||
-@erase "$(INTDIR)\AdjustSound.res"
|
||||
-@erase "$(INTDIR)\dsutil.obj"
|
||||
-@erase "$(INTDIR)\dxutil.obj"
|
||||
-@erase "$(INTDIR)\vc60.idb"
|
||||
-@erase "$(INTDIR)\vc60.pdb"
|
||||
-@erase "$(OUTDIR)\adjustsound.exe"
|
||||
-@erase "$(OUTDIR)\adjustsound.ilk"
|
||||
-@erase "$(OUTDIR)\adjustsound.pdb"
|
||||
|
||||
"$(OUTDIR)" :
|
||||
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
|
||||
|
||||
CPP=cl.exe
|
||||
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)\adjustsound.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
|
||||
|
||||
.c{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.obj::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.c{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cpp{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
.cxx{$(INTDIR)}.sbr::
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) $<
|
||||
<<
|
||||
|
||||
MTL=midl.exe
|
||||
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
RSC=rc.exe
|
||||
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\AdjustSound.res" /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
BSC32_FLAGS=/nologo /o"$(OUTDIR)\adjustsound.bsc"
|
||||
BSC32_SBRS= \
|
||||
|
||||
LINK32=link.exe
|
||||
LINK32_FLAGS=comctl32.lib dxerr8.lib winmm.lib dsound.lib dxguid.lib 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 /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\adjustsound.pdb" /debug /machine:I386 /out:"$(OUTDIR)\adjustsound.exe" /pdbtype:sept /stack:0x200000,0x200000
|
||||
LINK32_OBJS= \
|
||||
"$(INTDIR)\adjustsound.obj" \
|
||||
"$(INTDIR)\dsutil.obj" \
|
||||
"$(INTDIR)\dxutil.obj" \
|
||||
"$(INTDIR)\AdjustSound.res"
|
||||
|
||||
"$(OUTDIR)\adjustsound.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
|
||||
$(LINK32) @<<
|
||||
$(LINK32_FLAGS) $(LINK32_OBJS)
|
||||
<<
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(NO_EXTERNAL_DEPS)" != "1"
|
||||
!IF EXISTS("adjustsound.dep")
|
||||
!INCLUDE "adjustsound.dep"
|
||||
!ELSE
|
||||
!MESSAGE Warning: cannot find "adjustsound.dep"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
!IF "$(CFG)" == "AdjustSound - Win32 Release" || "$(CFG)" == "AdjustSound - Win32 Debug"
|
||||
SOURCE=.\adjustsound.cpp
|
||||
|
||||
"$(INTDIR)\adjustsound.obj" : $(SOURCE) "$(INTDIR)"
|
||||
|
||||
|
||||
SOURCE=.\AdjustSound.rc
|
||||
|
||||
"$(INTDIR)\AdjustSound.res" : $(SOURCE) "$(INTDIR)"
|
||||
$(RSC) $(RSC_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dsutil.cpp
|
||||
|
||||
"$(INTDIR)\dsutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
SOURCE=..\..\common\src\dxutil.cpp
|
||||
|
||||
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
|
||||
$(CPP) $(CPP_PROJ) $(SOURCE)
|
||||
|
||||
|
||||
|
||||
!ENDIF
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,50 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Sample Name: AdjustSound Sample
|
||||
//
|
||||
// Copyright (c) 1999-2001 Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
AdjustSound sample shows how to load and play a wave file using
|
||||
a DirectSound buffer and adjust its focus, frequency, pan, and volume.
|
||||
|
||||
Path
|
||||
====
|
||||
Source: DXSDK\Samples\Multimedia\DSound\AdjustSound
|
||||
|
||||
Executable: DXSDK\Samples\Multimedia\DSound\Bin
|
||||
|
||||
User's Guide
|
||||
============
|
||||
Load a wave file by clicking Sound File. Select Focus and Buffer Mixing
|
||||
options; note that the various settings are explained under Expected Behavior
|
||||
as you select them. Click Play. If you don't hear any sound, check the Status
|
||||
pane. The application might fail to create the buffer in hardware if this
|
||||
option has been selected.
|
||||
|
||||
By using the sliders you can adjust the frequency, pan, and volume dynamically
|
||||
as the buffer is playing.
|
||||
|
||||
Programming Notes
|
||||
=================
|
||||
For a simpler example of how to setup a DirectSound buffer without as many
|
||||
controls, see the PlaySound sample.
|
||||
|
||||
To set the focus of a buffer call IDirectSound::CreateSoundBuffer with
|
||||
DSBCAPS_GLOBALFOCUS or DSBCAPS_STICKYFOCUS or neither of these flags.
|
||||
|
||||
To set the memory location of a buffer call IDirectSound::CreateSoundBuffer
|
||||
with DSBCAPS_LOCHARDWARE or DSBCAPS_LOCSOFTWARE or neither of these flags.
|
||||
|
||||
To control various aspects of DirectSound buffer:
|
||||
To adjust the frequency call IDirectSoundBuffer::SetFrequency
|
||||
To adjust the pan call IDirectSoundBuffer::SetPan
|
||||
To adjust the volume call IDirectSoundBuffer::SetVolume
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by AdjustSound.rc
|
||||
//
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDD_MAIN 130
|
||||
#define IDR_ACCELERATOR1 131
|
||||
#define IDC_PLAY 1000
|
||||
#define IDC_STOP 1001
|
||||
#define IDC_FREQUENCY_SLIDER 1003
|
||||
#define IDC_PAN_SLIDER 1004
|
||||
#define IDC_VOLUME_SLIDER 1005
|
||||
#define IDC_LOOP_CHECK 1009
|
||||
#define IDC_SOUNDFILE 1011
|
||||
#define IDC_FREQUENCY 1012
|
||||
#define IDC_PAN 1013
|
||||
#define IDC_VOLUME 1014
|
||||
#define IDC_FILENAME 1015
|
||||
#define IDC_STATUS 1016
|
||||
#define IDC_FOCUS_NORMAL 1019
|
||||
#define IDC_FOCUS_STICKY 1020
|
||||
#define IDC_FOCUS_GLOBAL 1021
|
||||
#define IDC_MEMORY_DEFAULT 1022
|
||||
#define IDC_MIX_DEFAULT 1022
|
||||
#define IDC_MEMORY_HARDWARE 1023
|
||||
#define IDC_MIX_HARDWARE 1023
|
||||
#define IDC_MEMORY_SOFTWARE 1024
|
||||
#define IDC_MIX_SOFTWARE 1024
|
||||
#define IDC_BEHAVIOR 1033
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 134
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1022
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user