<commit_before>/*
	sdl: audio output via SDL cross-platform API

	copyright 2006 by the mpg123 project - free software under the terms of the LGPL 2.1
	see COPYING and AUTHORS files in distribution or http://mpg123.org
	initially written by <NAME>
*/

#include <math.h>

#include <SDL.h>

#include "audio.h"
#include "mpg123app.h"

/* Including the sfifo code locally, to avoid module linkage issues. */
#define SFIFO_STATIC
#include "sfifo.c"

#include "debug.h"


#define SAMPLE_SIZE			(2)
#define FRAMES_PER_BUFFER	(256)
#define FIFO_DURATION		(0.5f)




/* The audio function callback takes the following parameters:
       stream:  A pointer to the audio buffer to be filled
       len:     The length (in bytes) of the audio buffer
*/
static void audio_callback_sdl(void *udata, Uint8 *stream, int len)
{
	audio_output_t *ao = (audio_output_t*)udata;
	sfifo_t *fifo = (sfifo_t*)ao->userptr;
	int bytes_read;

	/* Only play if we have data left */
	if ( sfifo_used( fifo ) < len ) {
		warning("Didn't have any audio data for SDL (buffer underflow)");
		SDL_PauseAudio(1);<commit_msg>include windows.h for Sleep()<commit_after>/*
	sdl: audio output via SDL cross-platform API

	copyright 2006 by the mpg123 project - free software under the terms of the LGPL 2.1
	see COPYING and AUTHORS files in distribution or http://mpg123.org
	initially written by <NAME>
*/

#include <math.h>

#include <SDL.h>

#include "audio.h"
#include "mpg123app.h"
#ifdef WIN32
#include <windows.h>
#endif

/* Including the sfifo code locally, to avoid module linkage issues. */
#define SFIFO_STATIC
#include "sfifo.c"

#include "debug.h"


#define SAMPLE_SIZE			(2)
#define FRAMES_PER_BUFFER	(256)
#define FIFO_DURATION		(0.5f)




/* The audio function callback takes the following parameters:
       stream:  A pointer to the audio buffer to be filled
       len:     The length (in bytes) of the audio buffer
*/
static void audio_callback_sdl(void *udata, Uint8 *stream, int len)
{
	audio_output_t *ao = (audio_output_t*)udata;
	sfifo_t *fifo = (sfifo_t*)ao->userptr;
	int bytes_read;

	/* Only play if we have data left */
	if ( sfifo_used( fifo ) < len ) {
		warning("Didn't have any audio data for SDL (buffer underflow)");
		SDL_PauseAudio(1);
{'fraction_non_alphanumeric': 0.1025526197939991, 'fraction_numerical': 0.021495745633676667, 'mean_word_length': 3.975501113585746, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6226707', 'n_tokens_mistral': 844, 'n_tokens_neox': 772, 'n_words': 273}