shithub: npe

Download patch

ref: 0868679b9edd13f31d774ab6176ae4e10cc7e543
parent: 10d8d4ff5dad3dc3a62eefba9d6abfa8243fb348
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Mar 18 10:24:26 EDT 2021

sdl2: SDL_audio.h

--- a/include/npe/SDL2/SDL.h
+++ b/include/npe/SDL2/SDL.h
@@ -1,17 +1,22 @@
-#ifndef _SDL_h_
-#define _SDL_h_
+#ifndef _npe_SDL_h_
+#define _npe_SDL_h_
 
+#define SDL_MAJOR_VERSION 2
+#define SDL_MINOR_VERSION 0
+#define SDL_PATCHLEVEL 14
+
+#pragma lib "libnpe_sdl2.a"
+
 #include <npe.h>
 #include <keyboard.h>
 
-#pragma lib "libnpe_sdl2.a"
+typedef u8int Uint8;
+typedef u16int Uint16;
+typedef u32int Uint32;
+typedef enum {SDL_FALSE, SDL_TRUE} SDL_bool;
 
-#define SDL_MAJOR_VERSION 2
-#define SDL_MINOR_VERSION 0
-#define SDL_PATCHLEVEL 14
+#include "SDL2/SDL_audio.h"
 
-typedef int SDL_AudioDeviceID;
-typedef struct SDL_AudioSpec SDL_AudioSpec;
 typedef struct SDL_Window SDL_Window;
 typedef struct SDL_Renderer SDL_Renderer;
 typedef struct SDL_Texture SDL_Texture;
@@ -21,9 +26,6 @@
 typedef int SDL_Scancode;
 typedef int SDL_Keymod;
 typedef struct SDL_Event SDL_Event;
-typedef u8int Uint8;
-typedef u16int Uint16;
-typedef u32int Uint32;
 typedef int SDL_BlendMode;
 typedef struct SDL_Thread SDL_Thread;
 typedef int (*SDL_ThreadFunction)(void *);
@@ -42,7 +44,6 @@
 #pragma incomplete SDL_Thread
 #pragma incomplete SDL_Window
 
-typedef enum {SDL_FALSE, SDL_TRUE} SDL_bool;
 #define SDLCALL
 
 void SDL_StopTextInput(void);
@@ -51,14 +52,7 @@
 int SDL_Init(int);
 int SDL_EventState(Uint32, int);
 SDL_Keymod SDL_GetModState(void);
-char *SDL_GetAudioDeviceName(int, SDL_bool);
-int SDL_GetNumAudioDevices(int iscapture);
 int SDL_ShowCursor(int toggle);
-void SDL_LockAudioDevice(SDL_AudioDeviceID);
-void SDL_UnlockAudioDevice(SDL_AudioDeviceID);
-void SDL_PauseAudioDevice(SDL_AudioDeviceID, SDL_bool);
-void SDL_CloseAudioDevice(SDL_AudioDeviceID);
-SDL_AudioDeviceID SDL_OpenAudioDevice(char *, int, SDL_AudioSpec *, SDL_AudioSpec *, u32int);
 u64int SDL_GetPerformanceFrequency(void);
 u64int SDL_GetPerformanceCounter(void);
 char *SDL_GetError(void);
@@ -139,33 +133,6 @@
 int SDL_RenderSetIntegerScale(SDL_Renderer *r, SDL_bool enable);
 
 enum {
-	AUDIO_U8 = 1,
-	AUDIO_S8,
-	AUDIO_U16LSB,
-	AUDIO_S16LSB,
-	AUDIO_U16MSB,
-	AUDIO_S16MSB,
-	AUDIO_S32LSB,
-	AUDIO_S32MSB,
-	AUDIO_F32LSB,
-	AUDIO_F32MSB,
-	AUDIO_NUM_FORMATS,
-	/* show me that BIG endian device of yours */
-	AUDIO_U16 = AUDIO_U16LSB,
-	AUDIO_S16 = AUDIO_S16LSB,
-	AUDIO_S32 = AUDIO_S32LSB,
-	AUDIO_F32 = AUDIO_F32LSB,
-	AUDIO_U16SYS = AUDIO_U16,
-	AUDIO_S16SYS = AUDIO_S16,
-	AUDIO_S32SYS = AUDIO_S32,
-	AUDIO_F32SYS = AUDIO_F32,
-
-	SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 1<<0,
-	SDL_AUDIO_ALLOW_FORMAT_CHANGE = 1<<1,
-	SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 1<<2,
-	SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 1<<3,
-	SDL_AUDIO_ALLOW_ANY_CHANGE = ~0,
-
 	SDL_THREAD_PRIORITY_HIGH = 1,
 
 	SDL_QUERY = -1,
@@ -457,15 +424,6 @@
 #define SDL_HINT_RENDER_SCALE_QUALITY "SDL_HINT_RENDER_SCALE_QUALITY"
 #define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4"
 #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH"
-
-struct SDL_AudioSpec {
-	void (*callback)(void *, Uint8 *, int);
-	void *userdata;
-	int freq;
-	int format;
-	int channels;
-	int samples;
-};
 
 struct SDL_Point {
 	int x, y;
--- /dev/null
+++ b/include/npe/SDL2/SDL_audio.h
@@ -1,0 +1,55 @@
+#ifndef _npe_SDL_audio_h_
+#define _npe_SDL_audio_h_
+
+enum {
+	AUDIO_U8 = 1,
+	AUDIO_S8,
+	AUDIO_U16LSB,
+	AUDIO_S16LSB,
+	AUDIO_U16MSB,
+	AUDIO_S16MSB,
+	AUDIO_S32LSB,
+	AUDIO_S32MSB,
+	AUDIO_F32LSB,
+	AUDIO_F32MSB, /* FIXME not supported */
+	AUDIO_NUM_FORMATS,
+	/* show me that BIG endian device of yours */
+	AUDIO_U16 = AUDIO_U16LSB,
+	AUDIO_S16 = AUDIO_S16LSB,
+	AUDIO_S32 = AUDIO_S32LSB,
+	AUDIO_F32 = AUDIO_F32LSB,
+	AUDIO_U16SYS = AUDIO_U16,
+	AUDIO_S16SYS = AUDIO_S16,
+	AUDIO_S32SYS = AUDIO_S32,
+	AUDIO_F32SYS = AUDIO_F32,
+
+	SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 1<<0,
+	SDL_AUDIO_ALLOW_FORMAT_CHANGE = 1<<1,
+	SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 1<<2,
+	SDL_AUDIO_ALLOW_SAMPLES_CHANGE = 1<<3,
+	SDL_AUDIO_ALLOW_ANY_CHANGE = ~0,
+};
+
+typedef struct SDL_AudioSpec SDL_AudioSpec;
+typedef int SDL_AudioDeviceID;
+
+struct SDL_AudioSpec {
+	void (*callback)(void *, Uint8 *, int);
+	void *userdata;
+	int freq;
+	int format;
+	int channels;
+	int samples;
+};
+
+char *SDL_GetAudioDeviceName(int, SDL_bool);
+int SDL_GetNumAudioDevices(int);
+
+void SDL_LockAudioDevice(SDL_AudioDeviceID);
+void SDL_UnlockAudioDevice(SDL_AudioDeviceID);
+
+SDL_AudioDeviceID SDL_OpenAudioDevice(char *, int, SDL_AudioSpec *, SDL_AudioSpec *, u32int);
+void SDL_PauseAudioDevice(SDL_AudioDeviceID, SDL_bool);
+void SDL_CloseAudioDevice(SDL_AudioDeviceID);
+
+#endif