Re: [AD] create_sample patch |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Mon, 2005-07-04 at 15:30 -0700, Chris wrote:
> While playing with create_sample, I wondered if it cleared the data to
> silence or if I had to do it myself. The docs didn't mention whether it
> does or not, but in the source it appeared to set it to 0. However,
> since Allegro's samples use unsigned data, this is obviously wrong.
>
> This patch properly sets the sample data to 0x80 and 0x8000 for 8-bit
> and 16-bit respectively. Perhaps someone should also modify the docs to
> mention that the sample is cleared to silence as well.
Actually, to be consistent with create_bitmap, we shouldn't clear it at
all.
I attached a patch which I think should be applied instead of yours.
--
Elias Pschernig
Index: src/sound.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/sound.c,v
retrieving revision 1.27
diff -u -p -r1.27 sound.c
--- src/sound.c 1 Jul 2005 11:04:15 -0000 1.27
+++ src/sound.c 4 Jul 2005 23:03:27 -0000
@@ -1081,8 +1081,6 @@ SAMPLE *create_sample(int bits, int ster
return NULL;
}
- memset(spl->data, 0, len * ((bits==8) ? 1 : sizeof(short)) * ((stereo) ? 2 : 1));
-
lock_sample(spl);
return spl;
}