Sfoglia il codice sorgente

Fixed some incorrect SDL_AUDIO_F32 uses

Brick 1 anno fa
parent
commit
47bcb078f5
2 ha cambiato i file con 7 aggiunte e 7 eliminazioni
  1. 1 1
      src/audio/SDL_audio.c
  2. 6 6
      test/testautomation_audio.c

+ 1 - 1
src/audio/SDL_audio.c

@@ -765,7 +765,7 @@ SDL_bool SDL_OutputAudioThreadIterate(SDL_AudioDevice *device)
 
             case MIXSTRATEGY_MIX: {
                 //SDL_Log("MIX STRATEGY: MIX");
-                float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer);
+                float *mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32SYS) ? device_buffer : device->mix_buffer);
                 const int needed_samples = buffer_size / (SDL_AUDIO_BITSIZE(device->spec.format) / 8);
                 const int work_buffer_size = needed_samples * sizeof (float);
                 SDL_AudioSpec outspec;

+ 6 - 6
test/testautomation_audio.c

@@ -842,14 +842,14 @@ static int audio_resampleLoss(void *arg)
     SDLTest_AssertPass("Test resampling of %i s %i Hz %f phase sine wave from sampling rate of %i Hz to %i Hz",
                        spec->time, spec->freq, spec->phase, spec->rate_in, spec->rate_out);
 
-    tmpspec1.format = SDL_AUDIO_F32;
+    tmpspec1.format = SDL_AUDIO_F32SYS;
     tmpspec1.channels = num_channels;
     tmpspec1.freq = spec->rate_in;
-    tmpspec2.format = SDL_AUDIO_F32;
+    tmpspec2.format = SDL_AUDIO_F32SYS;
     tmpspec2.channels = num_channels;
     tmpspec2.freq = spec->rate_out;
     stream = SDL_CreateAudioStream(&tmpspec1, &tmpspec2);
-    SDLTest_AssertPass("Call to SDL_CreateAudioStream(SDL_AUDIO_F32, 1, %i, SDL_AUDIO_F32, 1, %i)", spec->rate_in, spec->rate_out);
+    SDLTest_AssertPass("Call to SDL_CreateAudioStream(SDL_AUDIO_F32SYS, 1, %i, SDL_AUDIO_F32SYS, 1, %i)", spec->rate_in, spec->rate_out);
     SDLTest_AssertCheck(stream != NULL, "Expected SDL_CreateAudioStream to succeed.");
     if (stream == NULL) {
       return TEST_ABORTED;
@@ -1020,13 +1020,13 @@ static int audio_convertAccuracy(void *arg)
         float target_max_delta = (bits > 23) ? 0.0f : (1.0f / (float)(1 << bits));
         float target_min_delta = -target_max_delta;
 
-        src_spec.format = SDL_AUDIO_F32;
+        src_spec.format = SDL_AUDIO_F32SYS;
         src_spec.channels = 1;
-        src_spec.freq = 44800;
+        src_spec.freq = 44100;
 
         tmp_spec.format = format;
         tmp_spec.channels = 1;
-        tmp_spec.freq = 44800;
+        tmp_spec.freq = 44100;
 
         convert_begin = SDL_GetPerformanceCounter();