virtualx-engine/scene
hungrymonkey 5080a9cf21 Fix data alignment issues in get_data() in AudioStreamSample
I am fixing the issue by adding DATA_PAD to the return pointer as
suggested by hi-ogawa

When using set_data in AudioStreamSample in PoolByteArray, the data is set
using a DATA_PAD to pad the pointer to the correct place as such

uint8_t *dataptr = (uint8_t *)data;
copymem(dataptr + DATA_PAD, r.ptr(), datalen);
data_bytes = datalen;
godot/scene/resources/audio_stream_sample.cpp#L473

All I am doing is adding a DATA_PAD to the return pointer to
get_data() in AudioStreamSample to change

godot/scene/resources/audio_stream_sample.cpp#L48
PoolVector<uint8_t>::Write w = pv.write();
copymem(w.ptr(), data, data_bytes);

to

PoolVector<uint8_t>::Write w = pv.write();
uint8_t *dataptr = (uint8_t *)data;
copymem(w.ptr(), dataptr + DATA_PAD, data_bytes);

Please review whether or not set or get is correct.
Because this issue seems to be fixable by removing DATA_PAD in set_data()
instead of adding DATA_PAD to get_data(). I have not tested the latter
fix

Fixes #issue, 11873
2017-10-09 11:34:28 -07:00
..
2d Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02:00
3d Fix LINK/UNLINK console spam with navmeshes 2017-10-06 13:36:15 +02:00
animation Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02:00
audio Fixed bug with clearing the stream in AudioPlayerStream 2017-09-27 10:30:08 -03:00
gui Add NIL_IS_VARIANT usage to few definitions 2017-10-05 18:51:22 +07:00
main Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02:00
resources Fix data alignment issues in get_data() in AudioStreamSample 2017-10-09 11:34:28 -07:00
register_scene_types.cpp Fix crash when a custom theme can't be loaded 2017-10-05 15:52:57 -03:00
register_scene_types.h Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
scene_string_names.cpp Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02:00
scene_string_names.h Renamed fixed_process to physics_process 2017-09-30 16:19:07 +02:00
SCsub Dead code tells no tales 2017-08-27 22:13:45 +02:00