SDL Mixer playback pitch incorrect

Hello,

I’m using SDL Mixer to experiment with FM synthesis, but when playing the generated sounds the pitch is incorrect. To me it sounds like it’s playing approximately 2x as fast as it should (sounds like 200hz instead of 100hz).

I’d appreciate some help. Here’s a code snippet that exhibits the behavior.

#include "SDL.h"
#include "SDL_mixer.h"

#pragma comment (lib, "SDL2-2.0.10\\lib\\x64\\SDL2.lib")
#pragma comment (lib, "SDL2-2.0.10\\lib\\x64\\SDL2main.lib")
#pragma comment (lib, "SDL2_mixer-2.0.4\\lib\\x64\\SDL2_mixer.lib")

int main(int argc, char *args[])
{
    int soundRate = 44100;
    
    uint32_t *samples = new uint32_t[soundRate];

    for (int i = 0; i < soundRate; i++)
    {
        float t = ((float)i / (float)soundRate);
        float floatSample = sinf(2.0f * (float)M_PI * 100.0f * t);

        floatSample *= SDL_MAX_UINT32;

        samples[i] = (uint32_t)floatSample;
    }

    SDL_Init(SDL_INIT_EVERYTHING);

    Mix_OpenAudio(soundRate, AUDIO_S32LSB, 1, 4096);

    Mix_Chunk *chunk = Mix_QuickLoad_RAW((Uint8*)samples, sizeof(uint32_t) * soundRate);

    Mix_PlayChannel(0, chunk, 0);

    SDL_Delay(1000);

    Mix_FreeChunk(chunk);

    delete[] samples;

    Mix_CloseAudio();

    SDL_Quit();

    return 0;
}

Thanks in advance for the help