~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/mixer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: mixer.cpp 13708 2008-07-16 10:07:38Z rubidium $ */
 
1
/* $Id: mixer.cpp 15299 2009-01-31 20:16:06Z smatz $ */
2
2
 
3
 
/** @file mixer.cpp*/
 
3
/** @file mixer.cpp Mixing of sound samples. */
4
4
 
5
5
#include "stdafx.h"
6
 
#include "openttd.h"
7
6
#include "mixer.h"
8
7
#include "core/math_func.hpp"
9
8
 
113
112
        return NULL;
114
113
}
115
114
 
116
 
void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags)
 
115
void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, uint flags)
117
116
{
118
117
        mc->memory = mem;
119
118
        mc->flags = flags;
123
122
        mc->frac_speed = (rate << 16) / _play_rate;
124
123
 
125
124
        /* adjust the magnitude to prevent overflow */
126
 
        while (size & 0xFFFF0000) {
 
125
        while (size & ~0xFFFF) {
127
126
                size >>= 1;
128
127
                rate = (rate >> 1) + 1;
129
128
        }
130
129
 
131
 
        mc->samples_left = size * _play_rate / rate;
 
130
        mc->samples_left = (uint)size * _play_rate / rate;
132
131
}
133
132
 
134
133
void MxSetChannelVolume(MixerChannel *mc, uint left, uint right)
138
137
}
139
138
 
140
139
 
141
 
void MxActivateChannel(MixerChannel* mc)
 
140
void MxActivateChannel(MixerChannel *mc)
142
141
{
143
142
        mc->active = true;
144
143
}