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:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

View File

@@ -0,0 +1,765 @@
//-----------------------------------------------------------------------------
// File: 3DAudio.cpp
//
// Desc: Plays a primary segment using DirectMusic
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#define STRICT
#include <windows.h>
#include <basetsd.h>
#include <commdlg.h>
#include <commctrl.h>
#include <dmusicc.h>
#include <dmusici.h>
#include <dxerr8.h>
#include <cguid.h>
#include <math.h>
#include <stdio.h>
#include "resource.h"
#include "DMUtil.h"
#include "DXUtil.h"
//-----------------------------------------------------------------------------
// Function-prototypes
//-----------------------------------------------------------------------------
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
VOID OnInitDialog( HWND hDlg );
HRESULT InitAudio( HWND hDlg );
VOID SetSlidersPos( HWND hDlg, FLOAT fDopplerValue, FLOAT fRolloffValue, FLOAT fMinDistValue, FLOAT fMaxDistValue );
VOID OnOpenAudioFile( HWND hDlg );
HRESULT LoadSegmentFile( HWND hDlg, TCHAR* strFileName );
HRESULT OnPlayAudio( HWND hDlg );
VOID EnablePlayUI( HWND hDlg, BOOL bEnable );
VOID OnMovementTimer( HWND hDlg );
VOID Set3DParameters( FLOAT fDopplerFactor, FLOAT fRolloffFactor, FLOAT fMinDistance, FLOAT fMaxDistance );
VOID EnablePlayUI( HWND hDlg, BOOL bEnable );
VOID SetObjectProperties( D3DVECTOR* pvPosition, D3DVECTOR* pvVelocity );
VOID UpdateGrid( HWND hDlg, FLOAT x, FLOAT y );
VOID OnSliderChanged( HWND hDlg );
VOID SetObjectProperties( D3DVECTOR* pvPosition, D3DVECTOR* pvVelocity );
FLOAT ConvertLinearSliderPosToLogScale( LONG lSliderPos );
LONG ConvertLogScaleToLinearSliderPosTo( FLOAT fValue );
//-----------------------------------------------------------------------------
// Defines, constants, and global variables
//-----------------------------------------------------------------------------
#define ORBIT_MAX_RADIUS 5.0f
#define IDT_MOVEMENT_TIMER 1
CMusicManager* g_pMusicManager = NULL;
CMusicSegment* g_pMusicSegment = NULL;
IDirectMusicAudioPath* g_p3DAudioPath = NULL;
IDirectSound3DBuffer* g_pDS3DBuffer = NULL; // 3D sound buffer
IDirectSound3DListener* g_pDSListener = NULL; // 3D listener object
DS3DBUFFER g_dsBufferParams; // 3D buffer properties
DS3DLISTENER g_dsListenerParams; // Listener properties
HINSTANCE g_hInst = NULL;
BOOL g_bAllowMovementTimer = TRUE;
BOOL g_bDeferSettings = FALSE;
//-----------------------------------------------------------------------------
// 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 )
{
g_hInst = hInst;
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_INITDIALOG:
OnInitDialog( hDlg );
break;
case WM_COMMAND:
switch( LOWORD(wParam) )
{
case IDC_SOUNDFILE:
OnOpenAudioFile( hDlg );
break;
case IDCANCEL:
EndDialog( hDlg, 0 );
break;
case IDC_PLAY:
if( FAILED( hr = OnPlayAudio( hDlg ) ) )
{
DXTRACE_ERR( TEXT("OnPlayAudio"), hr );
MessageBox( hDlg, "Error playing DirectMusic segment. "
"Sample will now exit.", "DirectMusic Sample",
MB_OK | MB_ICONERROR );
EndDialog( hDlg, 0 );
}
break;
case IDC_STOP:
if( g_pMusicSegment )
{
g_pMusicSegment->Stop( DMUS_SEGF_BEAT );
EnablePlayUI( hDlg, TRUE );
}
break;
case IDC_DEFER:
g_bDeferSettings = !g_bDeferSettings;
OnSliderChanged( hDlg );
break;
case IDC_APPLY:
// Call the IDirectSound3DListener::CommitDeferredSettings
// method to execute all of the deferred commands at once.
// This is many times more efficent than recomputing everything
// for every call.
if( g_pDSListener )
g_pDSListener->CommitDeferredSettings();
break;
default:
return FALSE; // Didn't handle message
}
break;
case WM_TIMER:
if( wParam == IDT_MOVEMENT_TIMER )
OnMovementTimer( hDlg );
break;
case WM_NOTIFY:
OnSliderChanged( hDlg );
break;
case WM_DESTROY:
// Cleanup everything
if( g_pMusicSegment )
{
g_pMusicSegment->Unload( g_p3DAudioPath );
SAFE_DELETE( g_pMusicSegment );
}
KillTimer( hDlg, 1 );
SAFE_RELEASE( g_pDSListener );
SAFE_RELEASE( g_pDS3DBuffer );
SAFE_RELEASE( g_p3DAudioPath );
SAFE_DELETE( g_pMusicManager );
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
HICON hIcon = LoadIcon( g_hInst, MAKEINTRESOURCE( IDR_MAINFRAME ) );
// Set the icon for this dialog.
SendMessage( hDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon ); // Set big icon
SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon ); // Set small icon
if( FAILED( hr = InitAudio( hDlg ) ) )
{
DXTRACE_ERR( TEXT("InitAudio"), hr );
MessageBox( hDlg, "Error initializing DirectMusic. Sample will now exit.",
"DirectMusic Sample", MB_OK | MB_ICONERROR );
EndDialog( hDlg, 0 );
return;
}
// Set the default media path (something like C:\MSSDK\SAMPLES\MULTIMEDIA\MEDIA)
// to be used as the search directory for finding DirectMusic content.
g_pMusicManager->SetSearchDirectory( DXUtil_GetDXSDKMediaPath() );
// Load a default music segment
TCHAR strFileName[MAX_PATH];
strcpy( strFileName, DXUtil_GetDXSDKMediaPath() );
strcat( strFileName, "sample.sgt" );
if( S_FALSE == LoadSegmentFile( hDlg, strFileName ) )
{
// Set the UI controls
SetDlgItemText( hDlg, IDC_FILENAME, TEXT("No file loaded.") );
}
// Create a timer to periodically move the 3D object around
SetTimer( hDlg, IDT_MOVEMENT_TIMER, 5, NULL );
// Get handles to dialog items
HWND hDopplerSlider = GetDlgItem( hDlg, IDC_DOPPLER_SLIDER );
HWND hRolloffSlider = GetDlgItem( hDlg, IDC_ROLLOFF_SLIDER );
HWND hMinDistSlider = GetDlgItem( hDlg, IDC_MINDISTANCE_SLIDER );
HWND hMaxDistSlider = GetDlgItem( hDlg, IDC_MAXDISTANCE_SLIDER );
HWND hVertSlider = GetDlgItem( hDlg, IDC_VERTICAL_SLIDER );
HWND hHorzSlider = GetDlgItem( hDlg, IDC_HORIZONTAL_SLIDER );
// Set the range and position of the sliders
PostMessage( hDopplerSlider, TBM_SETRANGEMAX, TRUE, 40L );
PostMessage( hDopplerSlider, TBM_SETRANGEMIN, TRUE, 0L );
PostMessage( hRolloffSlider, TBM_SETRANGEMAX, TRUE, 40L );
PostMessage( hRolloffSlider, TBM_SETRANGEMIN, TRUE, 0L );
PostMessage( hMinDistSlider, TBM_SETRANGEMAX, TRUE, 40L );
PostMessage( hMinDistSlider, TBM_SETRANGEMIN, TRUE, 1L );
PostMessage( hMaxDistSlider, TBM_SETRANGEMAX, TRUE, 40L );
PostMessage( hMaxDistSlider, TBM_SETRANGEMIN, TRUE, 1L );
PostMessage( hVertSlider, TBM_SETRANGEMAX, TRUE, 100L );
PostMessage( hVertSlider, TBM_SETRANGEMIN, TRUE, -100L );
PostMessage( hVertSlider, TBM_SETPOS, TRUE, 10L );
PostMessage( hHorzSlider, TBM_SETRANGEMAX, TRUE, 100L );
PostMessage( hHorzSlider, TBM_SETRANGEMIN, TRUE, -100L );
PostMessage( hHorzSlider, TBM_SETPOS, TRUE, 50L );
// Set the position of the sliders
SetSlidersPos( hDlg, 0.0f, 0.0f, ORBIT_MAX_RADIUS, ORBIT_MAX_RADIUS*2.0f );
}
//-----------------------------------------------------------------------------
// Name: InitAudio()
// Desc: Init both DirectMusic and DirectSound
//-----------------------------------------------------------------------------
HRESULT InitAudio( HWND hDlg )
{
HRESULT hr;
// Initialize the performance. This initializes both DirectMusic and DirectSound
// and optionally sets up the synthesizer and default audio path.
// However, since this app never uses the default audio path, we don't bother
// to do that here.
g_pMusicManager = new CMusicManager();
if( FAILED( hr = g_pMusicManager->Initialize( hDlg ) ) )
return DXTRACE_ERR( TEXT("Initialize"), hr );
IDirectMusicPerformance8* pPerformance = g_pMusicManager->GetPerformance();
// Create a 3D audiopath with a 3d buffer.
// We can then play all segments into this buffer and directly control its
// 3D parameters.
if( FAILED( hr = pPerformance->CreateStandardAudioPath( DMUS_APATH_DYNAMIC_3D,
64, TRUE, &g_p3DAudioPath ) ) )
return DXTRACE_ERR( TEXT("CreateStandardAudioPath"), hr );
// Get the 3D buffer in the audio path.
if( FAILED( hr = g_p3DAudioPath->GetObjectInPath( 0, DMUS_PATH_BUFFER, 0,
GUID_NULL, 0, IID_IDirectSound3DBuffer,
(LPVOID*) &g_pDS3DBuffer ) ) )
return DXTRACE_ERR( TEXT("GetObjectInPath"), hr );
// Get the 3D buffer parameters
g_dsBufferParams.dwSize = sizeof(DS3DBUFFER);
g_pDS3DBuffer->GetAllParameters( &g_dsBufferParams );
// Set new 3D buffer parameters
g_dsBufferParams.dwMode = DS3DMODE_HEADRELATIVE;
g_pDS3DBuffer->SetAllParameters( &g_dsBufferParams, DS3D_IMMEDIATE );
// Get the listener from the in the audio path.
if( FAILED( hr = g_p3DAudioPath->GetObjectInPath( 0, DMUS_PATH_PRIMARY_BUFFER, 0,
GUID_NULL, 0, IID_IDirectSound3DListener,
(LPVOID*) &g_pDSListener ) ) )
return DXTRACE_ERR( TEXT("GetObjectInPath"), hr );
// Get listener parameters
g_dsListenerParams.dwSize = sizeof(DS3DLISTENER);
g_pDSListener->GetAllParameters( &g_dsListenerParams );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: SetSlidersPos()
// Desc: Sets the slider positions
//-----------------------------------------------------------------------------
VOID SetSlidersPos( HWND hDlg, FLOAT fDopplerValue, FLOAT fRolloffValue,
FLOAT fMinDistValue, FLOAT fMaxDistValue )
{
HWND hDopplerSlider = GetDlgItem( hDlg, IDC_DOPPLER_SLIDER );
HWND hRolloffSlider = GetDlgItem( hDlg, IDC_ROLLOFF_SLIDER );
HWND hMinDistSlider = GetDlgItem( hDlg, IDC_MINDISTANCE_SLIDER );
HWND hMaxDistSlider = GetDlgItem( hDlg, IDC_MAXDISTANCE_SLIDER );
LONG lDopplerSlider = ConvertLogScaleToLinearSliderPosTo( fDopplerValue );
LONG lRolloffSlider = ConvertLogScaleToLinearSliderPosTo( fRolloffValue );
LONG lMinDistSlider = ConvertLogScaleToLinearSliderPosTo( fMinDistValue );
LONG lMaxDistSlider = ConvertLogScaleToLinearSliderPosTo( fMaxDistValue );
SendMessage( hDopplerSlider, TBM_SETPOS, TRUE, lDopplerSlider );
SendMessage( hRolloffSlider, TBM_SETPOS, TRUE, lRolloffSlider );
SendMessage( hMinDistSlider, TBM_SETPOS, TRUE, lMinDistSlider );
SendMessage( hMaxDistSlider, TBM_SETPOS, TRUE, lMaxDistSlider );
}
//-----------------------------------------------------------------------------
// Name: OnOpenAudioFile()
// Desc: Called when the user requests to open a sound file
//-----------------------------------------------------------------------------
VOID OnOpenAudioFile( HWND hDlg )
{
static TCHAR strFileName[MAX_PATH] = TEXT("");
static TCHAR strPath[MAX_PATH] = TEXT("");
// Get the default media path (something like C:\MSSDK\SAMPLES\DMUSIC\MEDIA)
if( '\0' == strPath[0] )
{
const TCHAR* szDir = DXUtil_GetDXSDKMediaPath();
strcpy( strPath, szDir );
}
// Setup the OPENFILENAME structure
OPENFILENAME ofn = { sizeof(OPENFILENAME), hDlg, NULL,
TEXT("DirectMusic Content Files\0*.sgt;*.mid;*.rmi\0Wave Files\0*.wav\0All Files\0*.*\0\0"), NULL,
0, 1, strFileName, MAX_PATH, NULL, 0, strPath,
TEXT("Open Content File"),
OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, 0, 0,
TEXT(".sgt"), 0, NULL, NULL };
if( g_pMusicSegment )
g_pMusicSegment->Stop( 0 );
// 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_FILENAME, TEXT("Loading file...") );
// Stop the timer while dialogs are displayed
g_bAllowMovementTimer = FALSE;
// Display the OpenFileName dialog. Then, try to load the specified file
if( TRUE != GetOpenFileName( &ofn ) )
{
SetDlgItemText( hDlg, IDC_FILENAME, TEXT("Load aborted.") );
g_bAllowMovementTimer = TRUE;
return;
}
if( S_FALSE == LoadSegmentFile( hDlg, strFileName ) )
{
// Not a critical failure, so just update the status
SetDlgItemText( hDlg, IDC_FILENAME, TEXT("Could not create segment from file.") );
}
g_bAllowMovementTimer = TRUE;
// Remember the path for next time
strcpy( strPath, strFileName );
char* strLastSlash = strrchr( strPath, '\\' );
strLastSlash[0] = '\0';
}
//-----------------------------------------------------------------------------
// Name: LoadSegmentFile()
// Desc:
//-----------------------------------------------------------------------------
HRESULT LoadSegmentFile( HWND hDlg, TCHAR* strFileName )
{
HRESULT hr;
SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );
// 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();
// 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;
}
// Load the file into a DirectMusic segment, but don't download
// it to the default audio path -- use the 3D audio path instead
if( FAILED( g_pMusicManager->CreateSegmentFromFile( &g_pMusicSegment, strFileName,
FALSE, bMidiFile ) ) )
{
// Not a critical failure, so just update the status
return S_FALSE;
}
// Download the segment on the 3D audio path
if( FAILED( hr = g_pMusicSegment->Download( g_p3DAudioPath ) ) )
return DXTRACE_ERR( TEXT("Download"), hr );
// Update the UI controls to show the segment is loaded
SetDlgItemText( hDlg, IDC_FILENAME, strFileName );
EnablePlayUI( hDlg, TRUE );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: OnPlayAudio()
// Desc:
//-----------------------------------------------------------------------------
HRESULT OnPlayAudio( HWND hDlg )
{
HRESULT hr;
if( g_pMusicSegment == NULL )
return S_FALSE;
// Set the segment to repeat many times
if( FAILED( hr = g_pMusicSegment->SetRepeats( DMUS_SEG_REPEAT_INFINITE ) ) )
return DXTRACE_ERR( TEXT("SetRepeats"), hr );
// 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, g_p3DAudioPath ) ) )
return DXTRACE_ERR( TEXT("Play"), hr );
EnablePlayUI( hDlg, FALSE );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: EnablePlayUI( hDlg,)
// Desc: Enables or disables the Play UI controls
//-----------------------------------------------------------------------------
VOID EnablePlayUI( HWND hDlg, BOOL bEnable )
{
if( bEnable )
{
EnableWindow( GetDlgItem( hDlg, IDC_STOP ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_PLAY ), TRUE );
SetFocus( GetDlgItem( hDlg, IDC_PLAY ) );
}
else
{
EnableWindow( GetDlgItem( hDlg, IDC_STOP ), TRUE );
SetFocus( GetDlgItem( hDlg, IDC_STOP ) );
EnableWindow( GetDlgItem( hDlg, IDC_PLAY ), FALSE );
}
}
//-----------------------------------------------------------------------------
// 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];
FLOAT fDopplerFactor;
FLOAT fRolloffFactor;
FLOAT fMinDistance;
FLOAT fMaxDistance;
// Get handles to dialog items
HWND hDopplerSlider = GetDlgItem( hDlg, IDC_DOPPLER_SLIDER );
HWND hRolloffSlider = GetDlgItem( hDlg, IDC_ROLLOFF_SLIDER );
HWND hMinDistSlider = GetDlgItem( hDlg, IDC_MINDISTANCE_SLIDER );
HWND hMaxDistSlider = GetDlgItem( hDlg, IDC_MAXDISTANCE_SLIDER );
// Get the position of the sliders
fDopplerFactor = ConvertLinearSliderPosToLogScale( (long)SendMessage( hDopplerSlider, TBM_GETPOS, 0, 0 ) );
fRolloffFactor = ConvertLinearSliderPosToLogScale( (long)SendMessage( hRolloffSlider, TBM_GETPOS, 0, 0 ) );
fMinDistance = ConvertLinearSliderPosToLogScale( (long)SendMessage( hMinDistSlider, TBM_GETPOS, 0, 0 ) );
fMaxDistance = ConvertLinearSliderPosToLogScale( (long)SendMessage( hMaxDistSlider, TBM_GETPOS, 0, 0 ) );
// Set the static text boxes
sprintf( strBuffer, TEXT("%.2f"), fDopplerFactor );
SetWindowText( GetDlgItem( hDlg, IDC_DOPPLERFACTOR ), strBuffer );
sprintf( strBuffer, TEXT("%.2f"), fRolloffFactor );
SetWindowText( GetDlgItem( hDlg, IDC_ROLLOFFFACTOR ), strBuffer );
sprintf( strBuffer, TEXT("%.2f"), fMinDistance );
SetWindowText( GetDlgItem( hDlg, IDC_MINDISTANCE ), strBuffer );
sprintf( strBuffer, TEXT("%.2f"), fMaxDistance );
SetWindowText( GetDlgItem( hDlg, IDC_MAXDISTANCE ), strBuffer );
// Set the options in the DirectSound buffer
Set3DParameters( fDopplerFactor, fRolloffFactor, fMinDistance, fMaxDistance );
EnableWindow( GetDlgItem( hDlg, IDC_APPLY ), g_bDeferSettings );
}
//-----------------------------------------------------------------------------
// Name: Set3DParameters()
// Desc: Set the 3D buffer parameters
//-----------------------------------------------------------------------------
VOID Set3DParameters( FLOAT fDopplerFactor, FLOAT fRolloffFactor,
FLOAT fMinDistance, FLOAT fMaxDistance )
{
// Every change to 3-D sound buffer and listener settings causes
// DirectSound to remix, at the expense of CPU cycles.
// To minimize the performance impact of changing 3-D settings,
// use the DS3D_DEFERRED flag in the dwApply parameter of any of
// the IDirectSound3DListener or IDirectSound3DBuffer methods that
// change 3-D settings. Then call the IDirectSound3DListener::CommitDeferredSettings
// method to execute all of the deferred commands at once.
DWORD dwApplyFlag = ( g_bDeferSettings ) ? DS3D_DEFERRED : DS3D_IMMEDIATE;
g_dsListenerParams.flDopplerFactor = fDopplerFactor;
g_dsListenerParams.flRolloffFactor = fRolloffFactor;
if( g_pDSListener )
g_pDSListener->SetAllParameters( &g_dsListenerParams, dwApplyFlag );
g_dsBufferParams.flMinDistance = fMinDistance;
g_dsBufferParams.flMaxDistance = fMaxDistance;
if( g_pDS3DBuffer )
g_pDS3DBuffer->SetAllParameters( &g_dsBufferParams, dwApplyFlag );
}
//-----------------------------------------------------------------------------
// Name: OnMovementTimer()
// Desc: Periodically updates the position of the object
//-----------------------------------------------------------------------------
VOID OnMovementTimer( HWND hDlg )
{
FLOAT fXScale;
FLOAT fYScale;
if( !g_bAllowMovementTimer )
return;
HWND hHorzSlider = GetDlgItem( hDlg, IDC_HORIZONTAL_SLIDER );
HWND hVertSlider = GetDlgItem( hDlg, IDC_VERTICAL_SLIDER );
fXScale = SendMessage( hHorzSlider, TBM_GETPOS, 0, 0 ) / 100.0f;
fYScale = SendMessage( hVertSlider, TBM_GETPOS, 0, 0 ) / 100.0f;
FLOAT t = timeGetTime()/1000.0f;
// Move the sound object around the listener. The maximum radius of the
// orbit is 27.5 units.
D3DVECTOR vPosition;
vPosition.x = ORBIT_MAX_RADIUS * fXScale * (FLOAT)sin(t);
vPosition.y = 0.0f;
vPosition.z = ORBIT_MAX_RADIUS * fYScale * (FLOAT)cos(t);
D3DVECTOR vVelocity;
vVelocity.x = ORBIT_MAX_RADIUS * fXScale * (FLOAT)sin(t+0.05f);
vVelocity.y = 0.0f;
vVelocity.z = ORBIT_MAX_RADIUS * fYScale * (FLOAT)cos(t+0.05f);
// Show the object's position on the dialog's grid control
UpdateGrid( hDlg, vPosition.x, vPosition.z );
// Set the sound buffer velocity and position
SetObjectProperties( &vPosition, &vVelocity );
}
//-----------------------------------------------------------------------------
// Name: UpdateGrid()
// Desc: Draws a red dot in the dialog's grid bitmap at the x,y coordinate.
//-----------------------------------------------------------------------------
VOID UpdateGrid( HWND hDlg, FLOAT x, FLOAT y )
{
static LONG s_lPixel[5] = { 0,0,0,0,0 };
static LONG s_lX = 0;
static LONG s_lY = 0;
HWND hWndGrid = GetDlgItem( hDlg, IDC_RENDER_WINDOW );
HDC hDC = GetDC( hWndGrid );
RECT rc;
// Replace pixels from that were overdrawn last time
SetPixel( hDC, s_lX-1, s_lY+0, s_lPixel[0] );
SetPixel( hDC, s_lX+0, s_lY-1, s_lPixel[1] );
SetPixel( hDC, s_lX+0, s_lY+0, s_lPixel[2] );
SetPixel( hDC, s_lX+0, s_lY+1, s_lPixel[3] );
SetPixel( hDC, s_lX+1, s_lY+0, s_lPixel[4] );
// Convert the world space x,y coordinates to pixel coordinates
GetClientRect( hWndGrid, &rc );
s_lX = (LONG)( ( x/ORBIT_MAX_RADIUS + 1 ) * ( rc.left + rc.right ) / 2 );
s_lY = (LONG)( (-y/ORBIT_MAX_RADIUS + 1 ) * ( rc.top + rc.bottom ) / 2 );
// Save the pixels before drawing the cross hair
s_lPixel[0] = GetPixel( hDC, s_lX-1, s_lY+0 );
s_lPixel[1] = GetPixel( hDC, s_lX+0, s_lY-1 );
s_lPixel[2] = GetPixel( hDC, s_lX+0, s_lY+0 );
s_lPixel[3] = GetPixel( hDC, s_lX+0, s_lY+1 );
s_lPixel[4] = GetPixel( hDC, s_lX+1, s_lY+0 );
// Draw a crosshair object in red pixels
SetPixel( hDC, s_lX-1, s_lY+0, 0x000000ff );
SetPixel( hDC, s_lX+0, s_lY-1, 0x000000ff );
SetPixel( hDC, s_lX+0, s_lY+0, 0x000000ff );
SetPixel( hDC, s_lX+0, s_lY+1, 0x000000ff );
SetPixel( hDC, s_lX+1, s_lY+0, 0x000000ff );
ReleaseDC( hWndGrid, hDC );
}
//-----------------------------------------------------------------------------
// Name: SetObjectProperties()
// Desc: Sets the position and velocity on the 3D buffer
//-----------------------------------------------------------------------------
VOID SetObjectProperties( D3DVECTOR* pvPosition, D3DVECTOR* pvVelocity )
{
// Every change to 3-D sound buffer and listener settings causes
// DirectSound to remix, at the expense of CPU cycles.
// To minimize the performance impact of changing 3-D settings,
// use the DS3D_DEFERRED flag in the dwApply parameter of any of
// the IDirectSound3DListener or IDirectSound3DBuffer methods that
// change 3-D settings. Then call the IDirectSound3DListener::CommitDeferredSettings
// method to execute all of the deferred commands at once.
memcpy( &g_dsBufferParams.vPosition, pvPosition, sizeof(D3DVECTOR) );
memcpy( &g_dsBufferParams.vVelocity, pvVelocity, sizeof(D3DVECTOR) );
if( g_pDS3DBuffer )
{
g_pDS3DBuffer->SetPosition( g_dsBufferParams.vPosition.x,
g_dsBufferParams.vPosition.y,
g_dsBufferParams.vPosition.z, DS3D_IMMEDIATE );
g_pDS3DBuffer->SetVelocity( g_dsBufferParams.vVelocity.x,
g_dsBufferParams.vVelocity.y,
g_dsBufferParams.vVelocity.z, DS3D_IMMEDIATE );
}
}
//-----------------------------------------------------------------------------
// Name: ConvertLinearSliderPosToLogScale()
// Desc: Converts a linear slider position to a quasi logrithmic scale
//-----------------------------------------------------------------------------
FLOAT ConvertLinearSliderPosToLogScale( LONG lSliderPos )
{
if( lSliderPos > 0 && lSliderPos <= 10 )
{
return lSliderPos*0.01f;
}
else if( lSliderPos > 10 && lSliderPos <= 20 )
{
return (lSliderPos-10)*0.1f;
}
else if( lSliderPos > 20 && lSliderPos <= 30 )
{
return (lSliderPos-20)*1.0f;
}
else if( lSliderPos > 30 && lSliderPos <= 40 )
{
return (lSliderPos-30)*10.0f;
}
return 0.0f;
}
//-----------------------------------------------------------------------------
// Name: ConvertLinearSliderPosToLogScale()
// Desc: Converts a quasi logrithmic scale to a slider position
//-----------------------------------------------------------------------------
LONG ConvertLogScaleToLinearSliderPosTo( FLOAT fValue )
{
if( fValue > 0.0f && fValue <= 0.1f )
{
return (LONG)(fValue/0.01f);
}
else if( fValue > 0.1f && fValue <= 1.0f )
{
return (LONG)(fValue/0.1f) + 10;
}
else if( fValue > 1.0f && fValue <= 10.0f )
{
return (LONG)(fValue/1.0f) + 20;
}
else if( fValue > 10.0f && fValue <= 100.0f )
{
return (LONG)(fValue/10.0f) + 30;
}
return 0;
}

View File

@@ -0,0 +1,143 @@
# Microsoft Developer Studio Project File - Name="3DAudio" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=3DAudio - 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 "3DAudio.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 "3DAudio.mak" CFG="3DAudio - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "3DAudio - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "3DAudio - 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)" == "3DAudio - 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" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\common\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /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 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)" == "3DAudio - 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" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\common\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /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 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 "3DAudio - Win32 Release"
# Name "3DAudio - Win32 Debug"
# Begin Group "Source"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\3DAudio.cpp
# End Source File
# End Group
# Begin Group "Resource"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\3DAudio.rc
# End Source File
# Begin Source File
SOURCE=.\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\directx.ico
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\common\src\dmutil.cpp
# End Source File
# Begin Source File
SOURCE=..\..\common\include\dmutil.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

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "3DAudio"=.\3DAudio.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,221 @@
# Microsoft Developer Studio Generated NMAKE File, Based on 3DAudio.dsp
!IF "$(CFG)" == ""
CFG=3DAudio - Win32 Debug
!MESSAGE No configuration specified. Defaulting to 3DAudio - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "3DAudio - Win32 Release" && "$(CFG)" != "3DAudio - 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 "3DAudio.mak" CFG="3DAudio - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "3DAudio - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "3DAudio - 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)" == "3DAudio - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\3DAudio.exe"
CLEAN :
-@erase "$(INTDIR)\3DAudio.obj"
-@erase "$(INTDIR)\3DAudio.res"
-@erase "$(INTDIR)\dmutil.obj"
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\3DAudio.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" /Fp"$(INTDIR)\3DAudio.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 /o "NUL" /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\3DAudio.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\3DAudio.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=comctl32.lib dxerr8.lib winmm.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)\3DAudio.pdb" /machine:I386 /out:"$(OUTDIR)\3DAudio.exe" /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\3DAudio.obj" \
"$(INTDIR)\dmutil.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\3DAudio.res"
"$(OUTDIR)\3DAudio.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "3DAudio - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\3DAudio.exe"
CLEAN :
-@erase "$(INTDIR)\3DAudio.obj"
-@erase "$(INTDIR)\3DAudio.res"
-@erase "$(INTDIR)\dmutil.obj"
-@erase "$(INTDIR)\dxutil.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\3DAudio.exe"
-@erase "$(OUTDIR)\3DAudio.ilk"
-@erase "$(OUTDIR)\3DAudio.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" /Fp"$(INTDIR)\3DAudio.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 /o "NUL" /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\3DAudio.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\3DAudio.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=comctl32.lib dxerr8.lib winmm.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)\3DAudio.pdb" /debug /machine:I386 /out:"$(OUTDIR)\3DAudio.exe" /pdbtype:sept /stack:0x200000,0x200000
LINK32_OBJS= \
"$(INTDIR)\3DAudio.obj" \
"$(INTDIR)\dmutil.obj" \
"$(INTDIR)\dxutil.obj" \
"$(INTDIR)\3DAudio.res"
"$(OUTDIR)\3DAudio.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("3DAudio.dep")
!INCLUDE "3DAudio.dep"
!ELSE
!MESSAGE Warning: cannot find "3DAudio.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "3DAudio - Win32 Release" || "$(CFG)" == "3DAudio - Win32 Debug"
SOURCE=.\3DAudio.cpp
"$(INTDIR)\3DAudio.obj" : $(SOURCE) "$(INTDIR)"
SOURCE=.\3DAudio.rc
"$(INTDIR)\3DAudio.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=..\..\common\src\dmutil.cpp
"$(INTDIR)\dmutil.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\common\src\dxutil.cpp
"$(INTDIR)\dxutil.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

View File

@@ -0,0 +1,151 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#define IDC_STATIC -1
/////////////////////////////////////////////////////////////////////////////
#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
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_MAIN DIALOGEX 0, 0, 294, 146
STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
CAPTION "DirectX 3D Audio Sample"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "Open &file...",IDC_SOUNDFILE,7,7,54,13
PUSHBUTTON "&Play",IDC_PLAY,7,123,50,14,WS_DISABLED
PUSHBUTTON "&Stop",IDC_STOP,57,123,50,14,WS_DISABLED
PUSHBUTTON "E&xit",IDCANCEL,237,123,50,14
EDITTEXT IDC_FILENAME,66,7,221,14,ES_AUTOHSCROLL | ES_READONLY
GROUPBOX "Sound properties",IDC_STATIC,7,25,200,94
RTEXT "Doppler factor (%)",IDC_STATIC,13,41,58,13,
SS_CENTERIMAGE
CTEXT "0",IDC_DOPPLERFACTOR,75,41,32,13,SS_CENTERIMAGE,
WS_EX_STATICEDGE
CONTROL "Slider1",IDC_DOPPLER_SLIDER,"msctls_trackbar32",
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,112,42,90,10
RTEXT "Rolloff factor (%)",IDC_STATIC,13,55,58,13,
SS_CENTERIMAGE
CTEXT "0",IDC_ROLLOFFFACTOR,75,55,32,13,SS_CENTERIMAGE,
WS_EX_STATICEDGE
CONTROL "Slider2",IDC_ROLLOFF_SLIDER,"msctls_trackbar32",
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,112,56,90,10
RTEXT "Min distance (m)",IDC_STATIC,13,70,58,13,SS_CENTERIMAGE
CTEXT "0",IDC_MINDISTANCE,75,70,32,13,SS_CENTERIMAGE,
WS_EX_STATICEDGE
CONTROL "Slider3",IDC_MINDISTANCE_SLIDER,"msctls_trackbar32",
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,112,71,90,10
RTEXT "Max distance (m)",IDC_STATIC,13,86,58,13,SS_CENTERIMAGE
CTEXT "0",IDC_MAXDISTANCE,75,86,32,13,SS_CENTERIMAGE,
WS_EX_STATICEDGE
CONTROL "Slider3",IDC_MAXDISTANCE_SLIDER,"msctls_trackbar32",
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,112,87,90,10
CONTROL "Defer Settings",IDC_DEFER,"Button",BS_AUTOCHECKBOX |
BS_PUSHLIKE | WS_TABSTOP,49,102,53,11
GROUPBOX "Sound movement",IDC_STATIC,212,25,75,94,BS_LEFT
CONTROL 130,IDC_RENDER_WINDOW,"Static",SS_BITMAP,222,46,46,42,
WS_EX_CLIENTEDGE
CONTROL "Slider1",IDC_VERTICAL_SLIDER,"msctls_trackbar32",
TBS_VERT | TBS_TOP | TBS_NOTICKS | WS_TABSTOP,272,41,10,
50
CONTROL "Slider1",IDC_HORIZONTAL_SLIDER,"msctls_trackbar32",
TBS_TOP | TBS_NOTICKS | WS_TABSTOP,217,90,55,10
PUSHBUTTON "Apply Settings",IDC_APPLY,121,102,53,11
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 287
TOPMARGIN, 7
BOTTOMMARGIN, 137
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include <windows.h>\r\n"
"#define IDC_STATIC -1\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.
IDR_MAINFRAME ICON DISCARDABLE "directx.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_GRID_BITMAP BITMAP DISCARDABLE "bitmap1.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,53 @@
//-----------------------------------------------------------------------------
//
// Sample Name: 3DAudio Sample
//
// Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved.
//
// GM/GS<47> Sound Set Copyright <20>1996, Roland Corporation U.S.
//
//-----------------------------------------------------------------------------
Description
===========
The 3DAudio sample application shows how to create a 3-D audiopath in
a DirectMusic performance, how to obtain an interface to a 3-D buffer
and listener in that path, and how to modify the parameters of the buffer
and listener.
Path
====
Source: DXSDK\Samples\Multimedia\DirectMusic\3DAudio
Executable: DXSDK\Samples\Multimedia\DirectMusic\Bin
User's Guide
============
Click Segment File and load a wave, MIDI, or DirectMusic Producer segment
file. Play the segment. The position of the sound source is shown as a red
dot on the graph, where the x-axis is from left to right and the z-axis is
from bottom to top. Change the range of movement on the two axes by using the
sliders.
The listener is located at the center of the graph, and has its default
orientation, looking along the positive z-axis; that is, toward the top of
the screen. The sound source moves to the listener's left and right and to
the listener's front and rear, but does not move above and below the listener.
The sliders in the center of the window control the properties of the listener;
that is, the global sound properties. If you click Defer Settings, changes are
not applied until you click Apply Settings.
Programming Notes
=================
The 3DAudio sample is very similar in form to the PlayAudio sample. For
detailed programming notes on the basics this sample, refer to Programming
Notes section of the PlayAudio sample.

View File

@@ -0,0 +1,35 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by 3DAudio.rc
//
#define IDD_MAIN 101
#define IDR_MAINFRAME 102
#define IDB_GRID_BITMAP 130
#define IDC_PLAY 1002
#define IDC_STOP 1003
#define IDC_FILENAME 1004
#define IDC_MINDISTANCE_SLIDER 1005
#define IDC_MAXDISTANCE_SLIDER 1006
#define IDC_APPLY 1007
#define IDC_DOPPLER_SLIDER 1010
#define IDC_SOUNDFILE 1011
#define IDC_DOPPLERFACTOR 1012
#define IDC_ROLLOFFFACTOR 1013
#define IDC_ROLLOFF_SLIDER 1014
#define IDC_MINDISTANCE 1015
#define IDC_RENDER_WINDOW 1018
#define IDC_VERTICAL_SLIDER 1019
#define IDC_HORIZONTAL_SLIDER 1020
#define IDC_DEFER 1024
#define IDC_MAXDISTANCE 1025
// 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 1008
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif