本文整理汇总了C++中SDL_NAME函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_NAME函数的具体用法?C++ SDL_NAME怎么用?C++ SDL_NAME使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_NAME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Audio_Available
static int Audio_Available(void)
{
pa_sample_spec paspec;
pa_simple *connection;
int available;
available = 0;
if ( LoadPulseLibrary() < 0 ) {
return available;
}
/* Connect with a dummy format. */
paspec.format = PA_SAMPLE_U8;
paspec.rate = 11025;
paspec.channels = 1;
connection = SDL_NAME(pa_simple_new)(
SDL_getenv("PASERVER"), /* server */
"Test stream", /* application name */
PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */
"Simple DirectMedia Layer", /* stream description */
&paspec, /* sample format spec */
NULL, /* channel map */
NULL, /* buffering attributes */
NULL /* error code */
);
if ( connection != NULL ) {
available = 1;
SDL_NAME(pa_simple_free)(connection);
}
UnloadPulseLibrary();
return(available);
}
示例2: DGA_Available
static int DGA_Available(void)
{
const char *display;
Display *dpy;
int available;
/* The driver is available is available if the display is local
and the DGA 2.0+ extension is available, and we can map mem.
*/
available = 0;
display = NULL;
if ( (strncmp(XDisplayName(display), ":", 1) == 0) ||
(strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
dpy = XOpenDisplay(display);
if ( dpy ) {
int events, errors, major, minor;
if ( SDL_NAME(XDGAQueryExtension)(dpy, &events, &errors) &&
SDL_NAME(XDGAQueryVersion)(dpy, &major, &minor) ) {
int screen;
screen = DefaultScreen(dpy);
if ( (major >= 2) &&
SDL_NAME(XDGAOpenFramebuffer)(dpy, screen) ) {
available = 1;
SDL_NAME(XDGACloseFramebuffer)(dpy, screen);
}
}
XCloseDisplay(dpy);
}
}
return(available);
}
示例3: Audio_Available
static int Audio_Available(void)
{
pa_sample_spec paspec;
pa_simple *connection;
int available;
available = 0;
if ( LoadPulseLibrary() < 0 ) {
return available;
}
paspec.format = PA_SAMPLE_U8;
paspec.rate = 11025;
paspec.channels = 1;
connection = SDL_NAME(pa_simple_new)(
NULL,
"Test stream",
PA_STREAM_PLAYBACK,
NULL,
"Simple DirectMedia Layer",
&paspec,
NULL,
NULL,
NULL
);
if ( connection != NULL ) {
available = 1;
SDL_NAME(pa_simple_free)(connection);
}
UnloadPulseLibrary();
return(available);
}
示例4: ALSA_PlayAudio
static void ALSA_PlayAudio(_THIS)
{
int status;
snd_pcm_uframes_t frames_left;
const Uint8 *sample_buf = (const Uint8 *) mixbuf;
const int frame_size = (((int) (this->spec.format & 0xFF)) / 8) * this->spec.channels;
swizzle_alsa_channels(this);
frames_left = ((snd_pcm_uframes_t) this->spec.samples);
while ( frames_left > 0 && this->enabled ) {
/* This works, but needs more testing before going live */
/*SDL_NAME(snd_pcm_wait)(pcm_handle, -1);*/
status = SDL_NAME(snd_pcm_writei)(pcm_handle, sample_buf, frames_left);
if ( status < 0 ) {
if ( status == -EAGAIN ) {
/* Apparently snd_pcm_recover() doesn't handle this case - does it assume snd_pcm_wait() above? */
SDL_Delay(1);
continue;
}
status = SDL_NAME(snd_pcm_recover)(pcm_handle, status, 0);
if ( status < 0 ) {
/* Hmm, not much we can do - abort */
fprintf(stderr, "ALSA write failed (unrecoverable): %s\n", SDL_NAME(snd_strerror)(status));
this->enabled = 0;
return;
}
continue;
}
sample_buf += status * frame_size;
frames_left -= status;
}
}
示例5: ESD_Init
static int
ESD_Init(SDL_AudioDriverImpl * impl)
{
if (LoadESDLibrary() < 0) {
return 0;
} else {
int connection = 0;
/* Don't start ESD if it's not running */
SDL_setenv("ESD_NO_SPAWN", "1", 0);
connection = SDL_NAME(esd_open_sound) (NULL);
if (connection < 0) {
UnloadESDLibrary();
SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
return 0;
}
SDL_NAME(esd_close) (connection);
}
/* Set the function pointers */
impl->OpenDevice = ESD_OpenDevice;
impl->PlayDevice = ESD_PlayDevice;
impl->WaitDevice = ESD_WaitDevice;
impl->GetDeviceBuf = ESD_GetDeviceBuf;
impl->CloseDevice = ESD_CloseDevice;
impl->Deinitialize = ESD_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
return 1; /* this audio target is available. */
}
示例6: ARTS_Suspend
static int ARTS_Suspend(void)
{
const Uint32 abortms = SDL_GetTicks() + 3000;
while ( (!SDL_NAME(arts_suspended)()) && (SDL_GetTicks() < abortms) ) {
if ( SDL_NAME(arts_suspend)() ) {
break;
}
}
return SDL_NAME(arts_suspended)();
}
示例7: PULSE_CloseAudio
static void PULSE_CloseAudio(_THIS)
{
if ( mixbuf != NULL ) {
SDL_FreeAudioMem(mixbuf);
mixbuf = NULL;
}
if ( stream != NULL ) {
SDL_NAME(pa_simple_drain)(stream, NULL);
SDL_NAME(pa_simple_free)(stream);
stream = NULL;
}
}
示例8: ALSA_CloseAudio
static void ALSA_CloseAudio(_THIS)
{
if ( mixbuf != NULL ) {
SDL_FreeAudioMem(mixbuf);
mixbuf = NULL;
}
if ( pcm_handle ) {
SDL_NAME(snd_pcm_drain)(pcm_handle);
SDL_NAME(snd_pcm_close)(pcm_handle);
pcm_handle = NULL;
}
}
示例9: ARTSC_CloseAudio
static void ARTSC_CloseAudio(_THIS)
{
if ( mixbuf != NULL ) {
SDL_FreeAudioMem(mixbuf);
mixbuf = NULL;
}
if ( stream ) {
SDL_NAME(arts_close_stream)(stream);
stream = 0;
}
SDL_NAME(arts_free)();
}
示例10: DGA_DispatchEvent
static int DGA_DispatchEvent(_THIS)
{
int posted;
SDL_NAME(XDGAEvent) xevent;
XNextEvent(DGA_Display, (XEvent *)&xevent);
posted = 0;
xevent.type -= DGA_event_base;
switch (xevent.type) {
/* Mouse motion? */
case MotionNotify: {
if ( SDL_VideoSurface ) {
posted = SDL_PrivateMouseMotion(0, 1,
xevent.xmotion.dx, xevent.xmotion.dy);
}
}
break;
/* Mouse button press? */
case ButtonPress: {
posted = SDL_PrivateMouseButton(SDL_PRESSED,
xevent.xbutton.button, 0, 0);
}
break;
/* Mouse button release? */
case ButtonRelease: {
posted = SDL_PrivateMouseButton(SDL_RELEASED,
xevent.xbutton.button, 0, 0);
}
break;
/* Key press or release? */
case KeyPress:
case KeyRelease: {
SDL_keysym keysym;
XKeyEvent xkey;
SDL_NAME(XDGAKeyEventToXKeyEvent)(&xevent.xkey, &xkey);
posted = SDL_PrivateKeyboard((xevent.type == KeyPress),
X11_TranslateKey(DGA_Display,
&xkey, xkey.keycode,
&keysym));
}
break;
}
return(posted);
}
示例11: X11_SetGammaNoLock
static int X11_SetGammaNoLock(_THIS, float red, float green, float blue)
{
#if SDL_VIDEO_DRIVER_X11_VIDMODE
if (use_vidmode >= 200) {
SDL_NAME(XF86VidModeGamma) gamma;
Bool succeeded;
/* Clamp the gamma values */
if ( red < MIN_GAMMA ) {
gamma.red = MIN_GAMMA;
} else
if ( red > MAX_GAMMA ) {
gamma.red = MAX_GAMMA;
} else {
gamma.red = red;
}
if ( green < MIN_GAMMA ) {
gamma.green = MIN_GAMMA;
} else
if ( green > MAX_GAMMA ) {
gamma.green = MAX_GAMMA;
} else {
gamma.green = green;
}
if ( blue < MIN_GAMMA ) {
gamma.blue = MIN_GAMMA;
} else
if ( blue > MAX_GAMMA ) {
gamma.blue = MAX_GAMMA;
} else {
gamma.blue = blue;
}
if ( SDL_GetAppState() & SDL_APPACTIVE ) {
succeeded = SDL_NAME(XF86VidModeSetGamma)(SDL_Display, SDL_Screen, &gamma);
XSync(SDL_Display, False);
} else {
gamma_saved[0] = gamma.red;
gamma_saved[1] = gamma.green;
gamma_saved[2] = gamma.blue;
succeeded = True;
}
if ( succeeded ) {
++gamma_changed;
}
return succeeded ? 0 : -1;
}
#endif
SDL_SetError("Gamma correction not supported");
return -1;
}
示例12: PULSE_WaitAudio
static void PULSE_WaitAudio(_THIS)
{
int size;
while(1) {
if (SDL_NAME(pa_context_get_state)(context) != PA_CONTEXT_READY ||
SDL_NAME(pa_stream_get_state)(stream) != PA_STREAM_READY ||
SDL_NAME(pa_mainloop_iterate)(mainloop, 1, NULL) < 0) {
this->enabled = 0;
return;
}
size = SDL_NAME(pa_stream_writable_size)(stream);
if (size >= mixlen)
return;
}
}
示例13: SDL_NAME
Bool SDL_NAME(XF86DGAGetVideoLL)(
Display* dpy,
int screen,
int *offset,
int *width,
int *bank_size,
int *ram_size
){
XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
xXF86DGAGetVideoLLReply rep;
xXF86DGAGetVideoLLReq *req;
XF86DGACheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XF86DGAGetVideoLL, req);
req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XF86DGAGetVideoLL;
req->screen = screen;
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
*offset = /*(char *)*/rep.offset;
*width = rep.width;
*bank_size = rep.bank_size;
*ram_size = rep.ram_size;
UnlockDisplay(dpy);
SyncHandle();
return True;
}
示例14: X11_GetGammaNoLock
static int X11_GetGammaNoLock(_THIS, float *red, float *green, float *blue)
{
#ifdef XFREE86_VMGAMMA
if (use_vidmode >= 200) {
SDL_NAME(XF86VidModeGamma) gamma;
if (SDL_NAME(XF86VidModeGetGamma)(SDL_Display, SDL_Screen, &gamma)) {
*red = gamma.red;
*green = gamma.green;
*blue = gamma.blue;
return 0;
}
return -1;
}
#endif
return -1;
}
示例15: SDL_FS_Init
static int
SDL_FS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadFusionSoundLibrary() < 0) {
return 0;
} else {
DirectResult ret;
ret = SDL_NAME(FusionSoundInit) (NULL, NULL);
if (ret) {
UnloadFusionSoundLibrary();
SDL_SetError
("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
ret);
return 0;
}
}
/* Set the function pointers */
impl->OpenDevice = SDL_FS_OpenDevice;
impl->PlayDevice = SDL_FS_PlayDevice;
impl->WaitDevice = SDL_FS_WaitDevice;
impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
impl->CloseDevice = SDL_FS_CloseDevice;
impl->WaitDone = SDL_FS_WaitDone;
impl->Deinitialize = SDL_FS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
return 1; /* this audio target is available. */
}