mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-27 14:12:25 +00:00
4b0395e079
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@684 fc73d0e0-1445-4013-8a0c-d673dee63da5
86 lines
1.5 KiB
C
86 lines
1.5 KiB
C
#include "quakedef.h"
|
|
#include "winquake.h"
|
|
|
|
#include <SDL.h>
|
|
|
|
extern cvar_t snd_khz;
|
|
|
|
#define SOUND_BUFFER_SIZE 0x0400
|
|
|
|
int snd_inited;
|
|
|
|
soundcardinfo_t *sndcardinfo;
|
|
|
|
int snd_firsttime = 0;
|
|
|
|
int aimedforguid;
|
|
|
|
void SNDDMA_Submit(soundcardinfo_t *sc)
|
|
{
|
|
}
|
|
void SNDDMA_Shutdown(soundcardinfo_t *sc)
|
|
{
|
|
if (snd_inited)
|
|
{
|
|
snd_inited = false;
|
|
SDL_CloseAudio();
|
|
}
|
|
}
|
|
int SNDDMA_GetDMAPos(soundcardinfo_t *sc)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
void S_UpdateCapture(void) //any ideas how to get microphone input?
|
|
{
|
|
}
|
|
|
|
int SNDDMA_Init(soundcardinfo_t *sc)
|
|
{
|
|
SDL_AudioSpec desired, obtained;
|
|
|
|
MessageBox(NULL, "hello", "fnar", 0);
|
|
|
|
if(SDL_InitSubSystem(SDL_INIT_AUDIO))
|
|
{
|
|
Con_Print("Couldn't initialize SDL audio subsystem\n");
|
|
MessageBox(NULL, "hjkl", "fnar", 0);
|
|
return false;
|
|
}
|
|
|
|
memset(&desired, 0, sizeof(desired));
|
|
|
|
if (!sc->sn.speed)
|
|
{
|
|
if (snd_khz.value >= 45)
|
|
sc->sn.speed = 48000;
|
|
else if (snd_khz.value >= 30) //set by a slider
|
|
sc->sn.speed = 44100;
|
|
else if (snd_khz.value >= 20)
|
|
sc->sn.speed = 22050;
|
|
else
|
|
sc->sn.speed = 11025;
|
|
}
|
|
|
|
desired.freq = sc->sn.speed;
|
|
desired.channels = 2;
|
|
desired.samples = SOUND_BUFFER_SIZE;
|
|
desired.format = AUDIO_S16;
|
|
desired.callback = paint;
|
|
|
|
if ( SDL_OpenAudio(&desired, &obtained) < 0 )
|
|
{
|
|
Con_Printf("SDL: SNDDMA_Init: couldn't open sound device (%s).\n", SDL_GetError());
|
|
MessageBox(NULL, "hello", "fghjfghjfgfnar", 0);
|
|
return false;
|
|
}
|
|
snd_inited = true;
|
|
SDL_PauseAudio(0);
|
|
MessageBox(NULL, "he;'lk'khjllo", "fnghkfghar", 0);
|
|
return true;
|
|
}
|
|
|
|
void SNDDMA_SetUnderWater(qboolean underwater)
|
|
{
|
|
}
|