1818 */
1919
2020#include < string>
21- #include < string.h>
22-
2321#define SOUND_QUEUE_IMPORT
2422#include " sound_queue.h"
2523#include " utils.h"
@@ -32,14 +30,12 @@ static bool sound_queue_sound_open;
3230static int sound_queue_max_queued_bytes;
3331static int sound_queue_buffer_size;
3432static int sound_queue_bytes_per_second;
35- static s16* sound_queue_last_written;
3633
3734static bool is_running_in_wsl (void );
3835
3936void sound_queue_init (void )
4037{
4138 InitPointer (sound_queue_stream);
42- InitPointer (sound_queue_last_written);
4339 sound_queue_sound_open = false ;
4440
4541 int audio_drivers_count = SDL_GetNumAudioDrivers ();
@@ -98,9 +94,6 @@ bool sound_queue_start(int sample_rate, int channel_count, int buffer_size, int
9894 sound_queue_max_queued_bytes = buffer_size * buffer_count * (int )sizeof (s16);
9995 sound_queue_bytes_per_second = sample_rate * channel_count * (int )sizeof (s16);
10096
101- sound_queue_last_written = new s16[buffer_size];
102- memset (sound_queue_last_written, 0 , buffer_size * sizeof (s16));
103-
10497 SDL_AudioSpec spec;
10598 spec.freq = sample_rate;
10699 spec.format = SDL_AUDIO_S16 ;
@@ -140,8 +133,6 @@ void sound_queue_stop(void)
140133
141134 Debug (" Sound Queue: Stopped" );
142135 }
143-
144- SafeDeleteArray (sound_queue_last_written);
145136}
146137
147138int sound_queue_get_sample_count (void )
@@ -151,11 +142,6 @@ int sound_queue_get_sample_count(void)
151142 return SDL_GetAudioStreamQueued (sound_queue_stream) / (int )sizeof (s16);
152143}
153144
154- s16* sound_queue_get_currently_playing (void )
155- {
156- return sound_queue_last_written;
157- }
158-
159145bool sound_queue_is_open (void )
160146{
161147 return sound_queue_sound_open;
@@ -201,9 +187,6 @@ void sound_queue_write(s16* samples, int count, bool sync)
201187 }
202188
203189 SDL_PutAudioStreamData (sound_queue_stream, samples, bytes);
204-
205- int copy_count = count < sound_queue_buffer_size ? count : sound_queue_buffer_size;
206- memcpy (sound_queue_last_written, samples + (count - copy_count), copy_count * sizeof (s16));
207190}
208191
209192static bool is_running_in_wsl (void )
0 commit comments