summaryrefslogtreecommitdiffhomepage
path: root/Stars45/SoundD3D.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/SoundD3D.cpp')
-rw-r--r--Stars45/SoundD3D.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/Stars45/SoundD3D.cpp b/Stars45/SoundD3D.cpp
index a148e69..66e4733 100644
--- a/Stars45/SoundD3D.cpp
+++ b/Stars45/SoundD3D.cpp
@@ -77,7 +77,7 @@ SoundCardD3D::SoundCardD3D(HWND hwnd)
#ifdef DIRECT_SOUND_3D
CoInitialize(NULL);
- err = CoCreateInstance(CLSID_A3d, NULL, CLSCTX_INPROC_SERVER,
+ err = CoCreateInstance(CLSID_A3d, NULL, CLSCTX_INPROC_SERVER,
IID_IDirectSound, (VOID **)&soundcard);
if (SUCCEEDED(err)) {
@@ -87,7 +87,7 @@ SoundCardD3D::SoundCardD3D(HWND hwnd)
else {
SoundD3DError("Could not initialize Aureal3D Sound", err);
SoundD3DError("Proceding with standard DirectSoundCreate", 0);
-#endif
+#endif
err = DirectSoundCreate(0, &soundcard, 0);
if (FAILED(err)) {
@@ -534,7 +534,7 @@ SoundD3D::Update()
// into the streaming buffer:
if (flags & STREAMED) {
buffer->GetCurrentPosition(&r, 0);
-
+
DWORD data_left;
if (w > r)
data_left = w - r;
@@ -706,7 +706,7 @@ SoundD3D::Localize()
}
// Compute pan and volume from scratch:
-
+
if ((flags & LOC_3D) && creator) {
Vec3 loc = location;
@@ -714,7 +714,7 @@ SoundD3D::Localize()
Camera& listener = ears->listener;
Vec3 ear_loc = listener.Pos(); ear_loc.SwapYZ();
Vec3 direction = loc - ear_loc;
-
+
loc.x = direction * listener.vrt();
loc.y = direction * listener.vup();
loc.z = direction * listener.vpn();
@@ -761,16 +761,16 @@ SoundD3D::Localize()
sprintf_s(warn, "Warning: could not set volume on buffer to %f", vol);
SoundD3DError(warn, hr);
}
-
+
// if not too far to hear...
if ((flags & DOPPLER) && (d2 < maxd2)) {
// COMPUTE DOPPLER SHIFT:
const float c = 10000.0f;
-
+
direction.Normalize();
float v_L = ears->velocity * direction;
float v_S = velocity * direction;
-
+
DWORD f_shift = wfex.nSamplesPerSec;
if (v_L != v_S) {
@@ -786,10 +786,10 @@ SoundD3D::Localize()
DWORD roll_off = (DWORD) (80 * dist/max_dist);
f_shift -= roll_off;
-
+
if (f_shift < 100) f_shift = 100;
if (f_shift > 100000) f_shift = 100000;
-
+
hr = buffer->SetFrequency(f_shift);
if (!SUCCEEDED(hr)) {
char warn[512];
@@ -1022,7 +1022,7 @@ SoundD3D::AllocateBuffer(DWORD bytes)
if (soundcard) {
hr = soundcard->CreateSoundBuffer(&dsbd, &buffer, NULL);
-
+
if (FAILED(hr)) {
SoundD3DError("AllocateBuffer: could not create buffer", hr);