ref: d2c5206b1489770c37504426c6d7e9448287479e
parent: a053707f271981151070a2c5f9d975d4490ae6bb
author: Simon Howard <fraggle@gmail.com>
date: Fri Aug 5 13:53:07 EDT 2005
More sensible defaults Subversion-branch: /trunk/chocolate-doom Subversion-revision: 42
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_sound.c 39 2005-08-04 21:48:32Z fraggle $
+// $Id: i_sound.c 42 2005-08-05 17:53:07Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.7 2005/08/05 17:53:07 fraggle
+// More sensible defaults
+//
// Revision 1.6 2005/08/04 21:48:32 fraggle
// Turn on compiler optimisation and warning options
// Add SDL_mixer sound code
@@ -48,7 +51,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_sound.c 39 2005-08-04 21:48:32Z fraggle $";
+rcsid[] = "$Id: i_sound.c 42 2005-08-05 17:53:07Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -78,7 +81,7 @@
if (samplerate == 11025)
{
- // need to expand to 2 channels, and expand 8 bit samples to 16 bits
+ // need to expand to 2 channels, and expand 11025->22050
result = Z_Malloc(length * 4, PU_STATIC, NULL);
@@ -94,10 +97,9 @@
result = Z_Malloc(length * 2, PU_STATIC, NULL);
- for (i=0; i<length / 2; ++i)
+ for (i=0; i<length; ++i)
{
- result[i * 4] = result[i * 4 + 2] = data[i * 2];
- result[i * 4 + 1] = result[i * 4 + 3] = data[i * 2 + 1];
+ result[i * 2] = result[i * 2 + 1] = data[i];
}
}
else
@@ -128,7 +130,7 @@
sound_chunks[sound].allocated = 1;
sound_chunks[sound].abuf = expand_sound_data(data + 8, samplerate, length);
sound_chunks[sound].alen = (length * 2 * 22050) / samplerate;
- sound_chunks[sound].volume = 128;
+ sound_chunks[sound].volume = 32;
}
return &sound_chunks[sound];
@@ -300,6 +302,8 @@
{
printf("Error initialising SDL_mixer: %s\n", SDL_GetError());
}
+
+ Mix_AllocateChannels(16);
sound_initialised = 1;