Skip to content

Commit

Permalink
2010-06-22 Krzysztof Kosciuszkiewicz <[email protected]>
Browse files Browse the repository at this point in the history
	* V249
	* sdl.c (av_setup): change sound sample format to 16 bit signed
	* sdl.c (audio_callback): better mixing for 2 audio channels
	* mmfile.c (mm_decode_audio): output 16 bit signed audio samples
  • Loading branch information
drvee committed Oct 21, 2010
1 parent d440d68 commit c87fe58
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 47 deletions.
74 changes: 42 additions & 32 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,82 +1,92 @@
2010-06-22 Krzysztof Kosciuszkiewicz <[email protected]>

* V249

* sdl.c (av_setup): change sound sample format to 16 bit signed

* sdl.c (audio_callback): better mixing for 2 audio channels

* mmfile.c (mm_decode_audio): output 16 bit signed audio samples

2010-10-12 Nicolas Laplume <[email protected]>

*V248
* V248

*start.c: Fixed a bug that prevent crews in 4-man capsule to be broken, even with dead or retired nauts ("Zombie crew bug")
* start.c: Fixed a bug that prevent crews in 4-man capsule to be broken, even with dead or retired nauts ("Zombie crew bug")

*prefs.c, options.c: Added Random Model, displayed only when randomize option is on
* prefs.c, options.c: Added Random Model, displayed only when randomize option is on

2010-10-10 Nicolas Laplume <[email protected]>

*V247
* V247

*mis_c.c, main.c, proto.h, mis_m.c: Added First Lunar EVA screen
* mis_c.c, main.c, proto.h, mis_m.c: Added First Lunar EVA screen

*endgame.c: Modified history screen to display first on the moon and day of landing
* endgame.c: Modified history screen to display first on the moon and day of landing

2010-10-02 Nicolas Laplume <[email protected]>

*V246
* V246

*randomize.c, prefs.c, proto.h, options.c, options.h: Added name change option
* randomize.c, prefs.c, proto.h, options.c, options.h: Added name change option

*randomize.c, prefs.c: Changed randomization algorytm
* randomize.c, prefs.c: Changed randomization algorytm

*endgame.c: Fixed obscure bug where first nauts where displayed incorrectly
* endgame.c: Fixed obscure bug where first nauts where displayed incorrectly

2010-09-07 Nicolas Laplume <[email protected]>

*V245
* V245

*future.c: changed the way the game draws the future mission, so it can be read from a file
* future.c: changed the way the game draws the future mission, so it can be read from a file

*ast4.c: add current equipment safety to damaged equipment screen
* ast4.c: add current equipment safety to damaged equipment screen

*crew.c: fixed the no backup option Leon had made
* crew.c: fixed the no backup option Leon had made

2010-08-30 Nicolas Laplume <[email protected]>

*V244
* V244

*proto.h, randomize.c, prefs.c, Makefile.in: Modify random equipmet files
* proto.h, randomize.c, prefs.c, Makefile.in: Modify random equipmet files

*options.c: Change config file text
* options.c: Change config file text

2010-08-30 Nicolas Laplume <[email protected]>

*V243
* V243

*options.c,options.h: Change no_capsule_training default to 1, add random_eq option
* options.c,options.h: Change no_capsule_training default to 1, add random_eq option

*prefs.c, randomize.c: Add option to randomize equipment
* prefs.c, randomize.c: Add option to randomize equipment

*vab.c: Fixed problem where booster safety was display uncorrectly
* vab.c: Fixed problem where booster safety was display uncorrectly

*readme: Added section about config file
* readme: Added section about config file

2010-08-22 Nicolas Laplume <[email protected]>

*V242
* V242

*vab.c: Fixed EOR kicker-b bug
* vab.c: Fixed EOR kicker-b bug

*rdplex.c, news_sup.c: Damaged equipment improvements
* rdplex.c, news_sup.c: Damaged equipment improvements

*vab.c: Auto-purchase half-off bug fixed
* vab.c: Auto-purchase half-off bug fixed

2010-08-10 Nicolas Laplume <[email protected]>

*V241
* V241

*aimis.c, main.c, newmis.c, vab.c, mis_m.c: Changed booster's safety.
* aimis.c, main.c, newmis.c, vab.c, mis_m.c: Changed booster's safety.

*mc2.c, newmis.c, ast4.c, options.h, options.c, news_sup.c: Fixed damaged equipment bug.
* mc2.c, newmis.c, ast4.c, options.h, options.c, news_sup.c: Fixed damaged equipment bug.

*rdplex.c, proto.h: Show DM in R&D, esthetic changes.
* rdplex.c, proto.h: Show DM in R&D, esthetic changes.

*options.h, options.c, ast1.c, aipur.c: Nauts compatiblity and randomization options.
* options.h, options.c, ast1.c, aipur.c: Nauts compatiblity and randomization options.

*options.h, options.c, crew.c: Skip Capsule Training option.
* options.h, options.c, crew.c: Skip Capsule Training option.


2010-08-09 Leon Baradat <[email protected]>
Expand Down
12 changes: 6 additions & 6 deletions mmfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,14 @@ mm_decode_video(mm_file * mf, SDL_Overlay * ovl)
return 1;
}

/* for now just 8bit unsigned values, mono channels FIXME
/* for now just 16bit signed values, mono channels FIXME
* maybe use SDL_AudioConvert() for this */
int
mm_decode_audio(mm_file * mf, void *buf, int buflen)
{
const int max_val = UCHAR_MAX;
const int min_val = 0;
const int bytes_per_sample = 1;
const int max_val = INT16_MAX;
const int min_val = INT16_MIN;
const int bytes_per_sample = 2;

int rv = 0, samples = 0, left = 0, total = 0;
unsigned channels = 0;
Expand Down Expand Up @@ -602,13 +602,13 @@ mm_decode_audio(mm_file * mf, void *buf, int buflen)
for (ch = 0; ch < channels; ++ch)
{
/* XXX: lrint requires C99 */
int val = lrint((pcm[ch][i] + 1.0) / 2.0 * max_val);
int val = lrint(pcm[ch][i] * max_val);

if (val > max_val)
val = max_val;
if (val < min_val)
val = min_val;
*((uint8_t *) buf + (total + i) * channels + ch) = val;
*((int16_t *) buf + (total + i) * channels + ch) = val;
}
}

Expand Down
19 changes: 11 additions & 8 deletions sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ audio_callback(void *userdata, Uint8 * stream, int len)
{
int ch = 0;

memset(stream, 0, len);

for (ch = 0; ch < AV_NUM_CHANNELS; ++ch)
{
int pos = 0;
Expand All @@ -134,13 +136,14 @@ audio_callback(void *userdata, Uint8 * stream, int len)
int bytes =
min(len - pos, (int) ac->size - (int) chp->offset);

/*
* SDL docs say that this should not be used to mix more than
* 2 channels, BUT SDL_mixer library just does that for each
* stream! Anyway, we have 2 channels so no worries ;)
*/
SDL_MixAudio(stream + pos, ((Uint8 *)ac->data) + chp->offset,
bytes, chp->volume);
int i = 0;
int16_t* dst = (int16_t*) (stream + pos);
const int16_t* src = (int16_t*)((uint8_t*) ac->data + chp->offset);

for (i = 0; i < bytes/2; ++i)
{
dst[i] += src[i] * chp->volume / AV_MAX_VOLUME / AV_NUM_CHANNELS;
}

pos += bytes;
chp->offset += bytes;
Expand Down Expand Up @@ -380,7 +383,7 @@ av_setup(void)
int i = 0;

audio_desired.freq = 11025;
audio_desired.format = AUDIO_U8;
audio_desired.format = AUDIO_S16SYS;
audio_desired.channels = 1;
/* audio was unresponsive on win32 so let's use shorter buffer */
audio_desired.samples = 2048; /* was 8192 */
Expand Down
2 changes: 1 addition & 1 deletion version.c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
248
249

0 comments on commit c87fe58

Please sign in to comment.