mixer.c
author tron
Sun, 21 May 2006 13:51:36 +0000
changeset 3884 793081f80381
parent 2977 97c1c76b499a
child 5120 1ff65e874ce3
permissions -rw-r--r--
(svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 1891
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 1891
diff changeset
     2
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
     3
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1498
diff changeset
     4
#include "openttd.h"
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
     5
#include "mixer.h"
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
     6
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
     7
struct MixerChannel {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
     8
	bool active;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
     9
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    10
	// pointer to allocated buffer memory
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    11
	int8 *memory;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    12
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    13
	// current position in memory
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    14
	uint32 pos;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    15
	uint32 frac_pos;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    16
	uint32 frac_speed;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    17
	uint32 samples_left;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    18
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    19
	// Mixing volume
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    20
	uint volume_left;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    21
	uint volume_right;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    22
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    23
	uint flags;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    24
};
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    25
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
    26
static MixerChannel _channels[8];
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
    27
static uint32 _play_rate;
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    28
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    29
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    30
static void mix_int8_to_int16(MixerChannel *sc, int16 *buffer, uint samples)
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    31
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    32
	int8 *b;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    33
	uint32 frac_pos;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    34
	uint32 frac_speed;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    35
	uint volume_left;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    36
	uint volume_right;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    37
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    38
	if (samples > sc->samples_left) samples = sc->samples_left;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    39
	sc->samples_left -= samples;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    40
	assert(samples > 0);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    41
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    42
	b = sc->memory + sc->pos;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    43
	frac_pos = sc->frac_pos;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    44
	frac_speed = sc->frac_speed;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    45
	volume_left = sc->volume_left;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    46
	volume_right = sc->volume_right;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    47
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    48
	if (frac_speed == 0x10000) {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    49
		// Special case when frac_speed is 0x10000
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    50
		do {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    51
			buffer[0] += *b * volume_left >> 8;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    52
			buffer[1] += *b * volume_right >> 8;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    53
			b++;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    54
			buffer += 2;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    55
		} while (--samples > 0);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    56
	} else {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    57
		do {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    58
			buffer[0] += *b * volume_left >> 8;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    59
			buffer[1] += *b * volume_right >> 8;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    60
			buffer += 2;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    61
			frac_pos += frac_speed;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    62
			b += frac_pos >> 16;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    63
			frac_pos &= 0xffff;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    64
		} while (--samples > 0);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    65
	}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    66
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    67
	sc->frac_pos = frac_pos;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    68
	sc->pos = b - sc->memory;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    69
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    70
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    71
static void MxCloseChannel(MixerChannel *mc)
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    72
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    73
	if (mc->flags & MX_AUTOFREE) free(mc->memory);
1497
4fc9f620d3e0 (svn r2001) Resolve a race condition which could lead to dropped a sound and a memory leak
tron
parents: 1496
diff changeset
    74
	mc->active = false;
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    75
	mc->memory = NULL;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    76
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    77
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
    78
void MxMixSamples(void *buffer, uint samples)
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    79
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    80
	MixerChannel *mc;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    81
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    82
	// Clear the buffer
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    83
	memset(buffer, 0, sizeof(int16) * 2 * samples);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    84
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    85
	// Mix each channel
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
    86
	for (mc = _channels; mc != endof(_channels); mc++) {
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    87
		if (mc->active) {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    88
			mix_int8_to_int16(mc, buffer, samples);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    89
			if (mc->samples_left == 0) MxCloseChannel(mc);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    90
		}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    91
	}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    92
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    93
	#if 0
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    94
	{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    95
		static FILE *out = NULL;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    96
		if (out == NULL)
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    97
			out = fopen("d:\\dump.raw", "wb");
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    98
		fwrite(buffer, samples * 4, 1, out);
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
    99
	}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   100
	#endif
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   101
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   102
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
   103
MixerChannel *MxAllocateChannel(void)
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   104
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   105
	MixerChannel *mc;
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
   106
	for (mc = _channels; mc != endof(_channels); mc++)
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   107
		if (mc->memory == NULL) {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   108
			mc->active = false;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   109
			return mc;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   110
		}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   111
	return NULL;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   112
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   113
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   114
void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags)
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   115
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   116
	mc->memory = mem;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   117
	mc->flags = flags;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   118
	mc->frac_pos = 0;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   119
	mc->pos = 0;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   120
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
   121
	mc->frac_speed = (rate << 16) / _play_rate;
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   122
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   123
	// adjust the magnitude to prevent overflow
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   124
	while (size & 0xFFFF0000) {
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   125
		size >>= 1;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   126
		rate = (rate >> 1) + 1;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   127
	}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   128
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
   129
	mc->samples_left = size * _play_rate / rate;
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   130
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   131
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   132
void MxSetChannelVolume(MixerChannel *mc, uint left, uint right)
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   133
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   134
	mc->volume_left = left;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   135
	mc->volume_right = right;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   136
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   137
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   138
1498
508395d0639a (svn r2002) Rename MxActivate to MxActivateChannel, which is more appropriate
tron
parents: 1497
diff changeset
   139
void MxActivateChannel(MixerChannel* mc)
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   140
{
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   141
	mc->active = true;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   142
}
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   143
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   144
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   145
bool MxInitialize(uint rate)
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   146
{
2977
97c1c76b499a (svn r3552) Remove the global variable _mixer
tron
parents: 2186
diff changeset
   147
	_play_rate = rate;
1496
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   148
	return true;
15d859a626e8 (svn r2000) Split the sound system into backend (mixer.[ch]) and frontend (sound.[ch])
tron
parents:
diff changeset
   149
}