annotate OpenAL32/alState.c @ 26:56f83c170251

adding hard-to-compile artifacts for other systems
author Robert McIntyre <rlm@mit.edu>
date Sat, 19 Nov 2011 19:17:37 -0700
parents f9476ff7637e
children
rev   line source
rlm@0 1 /**
rlm@0 2 * OpenAL cross platform audio library
rlm@0 3 * Copyright (C) 1999-2000 by authors.
rlm@0 4 * This library is free software; you can redistribute it and/or
rlm@0 5 * modify it under the terms of the GNU Library General Public
rlm@0 6 * License as published by the Free Software Foundation; either
rlm@0 7 * version 2 of the License, or (at your option) any later version.
rlm@0 8 *
rlm@0 9 * This library is distributed in the hope that it will be useful,
rlm@0 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
rlm@0 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
rlm@0 12 * Library General Public License for more details.
rlm@0 13 *
rlm@0 14 * You should have received a copy of the GNU Library General Public
rlm@0 15 * License along with this library; if not, write to the
rlm@0 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rlm@0 17 * Boston, MA 02111-1307, USA.
rlm@0 18 * Or go to http://www.gnu.org/copyleft/lgpl.html
rlm@0 19 */
rlm@0 20
rlm@0 21 #include "config.h"
rlm@0 22
rlm@0 23 #include <stdlib.h>
rlm@0 24 #include "alMain.h"
rlm@0 25 #include "AL/alc.h"
rlm@0 26 #include "AL/alext.h"
rlm@0 27 #include "alError.h"
rlm@0 28 #include "alSource.h"
rlm@0 29 #include "alAuxEffectSlot.h"
rlm@0 30 #include "alState.h"
rlm@0 31
rlm@0 32 static const ALchar alVendor[] = "OpenAL Community";
rlm@0 33 static const ALchar alVersion[] = "1.1 ALSOFT "ALSOFT_VERSION;
rlm@0 34 static const ALchar alRenderer[] = "OpenAL Soft";
rlm@0 35
rlm@0 36 // Error Messages
rlm@0 37 static const ALchar alNoError[] = "No Error";
rlm@0 38 static const ALchar alErrInvalidName[] = "Invalid Name";
rlm@0 39 static const ALchar alErrInvalidEnum[] = "Invalid Enum";
rlm@0 40 static const ALchar alErrInvalidValue[] = "Invalid Value";
rlm@0 41 static const ALchar alErrInvalidOp[] = "Invalid Operation";
rlm@0 42 static const ALchar alErrOutOfMemory[] = "Out of Memory";
rlm@0 43
rlm@0 44 AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
rlm@0 45 {
rlm@0 46 ALCcontext *Context;
rlm@0 47
rlm@0 48 Context = GetLockedContext();
rlm@0 49 if(!Context) return;
rlm@0 50
rlm@0 51 switch(capability)
rlm@0 52 {
rlm@0 53 case AL_SOURCE_DISTANCE_MODEL:
rlm@0 54 Context->SourceDistanceModel = AL_TRUE;
rlm@0 55 Context->UpdateSources = AL_TRUE;
rlm@0 56 break;
rlm@0 57
rlm@0 58 default:
rlm@0 59 alSetError(Context, AL_INVALID_ENUM);
rlm@0 60 break;
rlm@0 61 }
rlm@0 62
rlm@0 63 UnlockContext(Context);
rlm@0 64 }
rlm@0 65
rlm@0 66 AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
rlm@0 67 {
rlm@0 68 ALCcontext *Context;
rlm@0 69
rlm@0 70 Context = GetLockedContext();
rlm@0 71 if(!Context) return;
rlm@0 72
rlm@0 73 switch(capability)
rlm@0 74 {
rlm@0 75 case AL_SOURCE_DISTANCE_MODEL:
rlm@0 76 Context->SourceDistanceModel = AL_FALSE;
rlm@0 77 Context->UpdateSources = AL_TRUE;
rlm@0 78 break;
rlm@0 79
rlm@0 80 default:
rlm@0 81 alSetError(Context, AL_INVALID_ENUM);
rlm@0 82 break;
rlm@0 83 }
rlm@0 84
rlm@0 85 UnlockContext(Context);
rlm@0 86 }
rlm@0 87
rlm@0 88 AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability)
rlm@0 89 {
rlm@0 90 ALCcontext *Context;
rlm@0 91 ALboolean value=AL_FALSE;
rlm@0 92
rlm@0 93 Context = GetLockedContext();
rlm@0 94 if(!Context) return AL_FALSE;
rlm@0 95
rlm@0 96 switch(capability)
rlm@0 97 {
rlm@0 98 case AL_SOURCE_DISTANCE_MODEL:
rlm@0 99 value = Context->SourceDistanceModel;
rlm@0 100 break;
rlm@0 101
rlm@0 102 default:
rlm@0 103 alSetError(Context, AL_INVALID_ENUM);
rlm@0 104 break;
rlm@0 105 }
rlm@0 106
rlm@0 107 UnlockContext(Context);
rlm@0 108
rlm@0 109 return value;
rlm@0 110 }
rlm@0 111
rlm@0 112 AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname)
rlm@0 113 {
rlm@0 114 ALCcontext *Context;
rlm@0 115 ALboolean value=AL_FALSE;
rlm@0 116
rlm@0 117 Context = GetLockedContext();
rlm@0 118 if(!Context) return AL_FALSE;
rlm@0 119
rlm@0 120 switch(pname)
rlm@0 121 {
rlm@0 122 case AL_DOPPLER_FACTOR:
rlm@0 123 if(Context->DopplerFactor != 0.0f)
rlm@0 124 value = AL_TRUE;
rlm@0 125 break;
rlm@0 126
rlm@0 127 case AL_DOPPLER_VELOCITY:
rlm@0 128 if(Context->DopplerVelocity != 0.0f)
rlm@0 129 value = AL_TRUE;
rlm@0 130 break;
rlm@0 131
rlm@0 132 case AL_DISTANCE_MODEL:
rlm@0 133 if(Context->DistanceModel == AL_INVERSE_DISTANCE_CLAMPED)
rlm@0 134 value = AL_TRUE;
rlm@0 135 break;
rlm@0 136
rlm@0 137 case AL_SPEED_OF_SOUND:
rlm@0 138 if(Context->flSpeedOfSound != 0.0f)
rlm@0 139 value = AL_TRUE;
rlm@0 140 break;
rlm@0 141
rlm@0 142 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 143 value = Context->DeferUpdates;
rlm@0 144 break;
rlm@0 145
rlm@0 146 default:
rlm@0 147 alSetError(Context, AL_INVALID_ENUM);
rlm@0 148 break;
rlm@0 149 }
rlm@0 150
rlm@0 151 UnlockContext(Context);
rlm@0 152
rlm@0 153 return value;
rlm@0 154 }
rlm@0 155
rlm@0 156 AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname)
rlm@0 157 {
rlm@0 158 ALCcontext *Context;
rlm@0 159 ALdouble value = 0.0;
rlm@0 160
rlm@0 161 Context = GetLockedContext();
rlm@0 162 if(!Context) return 0.0;
rlm@0 163
rlm@0 164 switch(pname)
rlm@0 165 {
rlm@0 166 case AL_DOPPLER_FACTOR:
rlm@0 167 value = (double)Context->DopplerFactor;
rlm@0 168 break;
rlm@0 169
rlm@0 170 case AL_DOPPLER_VELOCITY:
rlm@0 171 value = (double)Context->DopplerVelocity;
rlm@0 172 break;
rlm@0 173
rlm@0 174 case AL_DISTANCE_MODEL:
rlm@0 175 value = (double)Context->DistanceModel;
rlm@0 176 break;
rlm@0 177
rlm@0 178 case AL_SPEED_OF_SOUND:
rlm@0 179 value = (double)Context->flSpeedOfSound;
rlm@0 180 break;
rlm@0 181
rlm@0 182 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 183 value = (ALdouble)Context->DeferUpdates;
rlm@0 184 break;
rlm@0 185
rlm@0 186 default:
rlm@0 187 alSetError(Context, AL_INVALID_ENUM);
rlm@0 188 break;
rlm@0 189 }
rlm@0 190
rlm@0 191 UnlockContext(Context);
rlm@0 192
rlm@0 193 return value;
rlm@0 194 }
rlm@0 195
rlm@0 196 AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname)
rlm@0 197 {
rlm@0 198 ALCcontext *Context;
rlm@0 199 ALfloat value = 0.0f;
rlm@0 200
rlm@0 201 Context = GetLockedContext();
rlm@0 202 if(!Context) return 0.0f;
rlm@0 203
rlm@0 204 switch(pname)
rlm@0 205 {
rlm@0 206 case AL_DOPPLER_FACTOR:
rlm@0 207 value = Context->DopplerFactor;
rlm@0 208 break;
rlm@0 209
rlm@0 210 case AL_DOPPLER_VELOCITY:
rlm@0 211 value = Context->DopplerVelocity;
rlm@0 212 break;
rlm@0 213
rlm@0 214 case AL_DISTANCE_MODEL:
rlm@0 215 value = (float)Context->DistanceModel;
rlm@0 216 break;
rlm@0 217
rlm@0 218 case AL_SPEED_OF_SOUND:
rlm@0 219 value = Context->flSpeedOfSound;
rlm@0 220 break;
rlm@0 221
rlm@0 222 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 223 value = (ALfloat)Context->DeferUpdates;
rlm@0 224 break;
rlm@0 225
rlm@0 226 default:
rlm@0 227 alSetError(Context, AL_INVALID_ENUM);
rlm@0 228 break;
rlm@0 229 }
rlm@0 230
rlm@0 231 UnlockContext(Context);
rlm@0 232
rlm@0 233 return value;
rlm@0 234 }
rlm@0 235
rlm@0 236 AL_API ALint AL_APIENTRY alGetInteger(ALenum pname)
rlm@0 237 {
rlm@0 238 ALCcontext *Context;
rlm@0 239 ALint value = 0;
rlm@0 240
rlm@0 241 Context = GetLockedContext();
rlm@0 242 if(!Context) return 0;
rlm@0 243
rlm@0 244 switch(pname)
rlm@0 245 {
rlm@0 246 case AL_DOPPLER_FACTOR:
rlm@0 247 value = (ALint)Context->DopplerFactor;
rlm@0 248 break;
rlm@0 249
rlm@0 250 case AL_DOPPLER_VELOCITY:
rlm@0 251 value = (ALint)Context->DopplerVelocity;
rlm@0 252 break;
rlm@0 253
rlm@0 254 case AL_DISTANCE_MODEL:
rlm@0 255 value = (ALint)Context->DistanceModel;
rlm@0 256 break;
rlm@0 257
rlm@0 258 case AL_SPEED_OF_SOUND:
rlm@0 259 value = (ALint)Context->flSpeedOfSound;
rlm@0 260 break;
rlm@0 261
rlm@0 262 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 263 value = (ALint)Context->DeferUpdates;
rlm@0 264 break;
rlm@0 265
rlm@0 266 default:
rlm@0 267 alSetError(Context, AL_INVALID_ENUM);
rlm@0 268 break;
rlm@0 269 }
rlm@0 270
rlm@0 271 UnlockContext(Context);
rlm@0 272
rlm@0 273 return value;
rlm@0 274 }
rlm@0 275
rlm@0 276 AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname,ALboolean *data)
rlm@0 277 {
rlm@0 278 ALCcontext *Context;
rlm@0 279
rlm@0 280 if(data)
rlm@0 281 {
rlm@0 282 switch(pname)
rlm@0 283 {
rlm@0 284 case AL_DOPPLER_FACTOR:
rlm@0 285 case AL_DOPPLER_VELOCITY:
rlm@0 286 case AL_DISTANCE_MODEL:
rlm@0 287 case AL_SPEED_OF_SOUND:
rlm@0 288 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 289 *data = alGetBoolean(pname);
rlm@0 290 return;
rlm@0 291 }
rlm@0 292 }
rlm@0 293
rlm@0 294 Context = GetLockedContext();
rlm@0 295 if(!Context) return;
rlm@0 296
rlm@0 297 if(data)
rlm@0 298 {
rlm@0 299 switch(pname)
rlm@0 300 {
rlm@0 301 default:
rlm@0 302 alSetError(Context, AL_INVALID_ENUM);
rlm@0 303 break;
rlm@0 304 }
rlm@0 305 }
rlm@0 306 else
rlm@0 307 {
rlm@0 308 // data is a NULL pointer
rlm@0 309 alSetError(Context, AL_INVALID_VALUE);
rlm@0 310 }
rlm@0 311
rlm@0 312 UnlockContext(Context);
rlm@0 313 }
rlm@0 314
rlm@0 315 AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname,ALdouble *data)
rlm@0 316 {
rlm@0 317 ALCcontext *Context;
rlm@0 318
rlm@0 319 if(data)
rlm@0 320 {
rlm@0 321 switch(pname)
rlm@0 322 {
rlm@0 323 case AL_DOPPLER_FACTOR:
rlm@0 324 case AL_DOPPLER_VELOCITY:
rlm@0 325 case AL_DISTANCE_MODEL:
rlm@0 326 case AL_SPEED_OF_SOUND:
rlm@0 327 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 328 *data = alGetDouble(pname);
rlm@0 329 return;
rlm@0 330 }
rlm@0 331 }
rlm@0 332
rlm@0 333 Context = GetLockedContext();
rlm@0 334 if(!Context) return;
rlm@0 335
rlm@0 336 if(data)
rlm@0 337 {
rlm@0 338 switch(pname)
rlm@0 339 {
rlm@0 340 default:
rlm@0 341 alSetError(Context, AL_INVALID_ENUM);
rlm@0 342 break;
rlm@0 343 }
rlm@0 344 }
rlm@0 345 else
rlm@0 346 {
rlm@0 347 // data is a NULL pointer
rlm@0 348 alSetError(Context, AL_INVALID_VALUE);
rlm@0 349 }
rlm@0 350
rlm@0 351 UnlockContext(Context);
rlm@0 352 }
rlm@0 353
rlm@0 354 AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname,ALfloat *data)
rlm@0 355 {
rlm@0 356 ALCcontext *Context;
rlm@0 357
rlm@0 358 if(data)
rlm@0 359 {
rlm@0 360 switch(pname)
rlm@0 361 {
rlm@0 362 case AL_DOPPLER_FACTOR:
rlm@0 363 case AL_DOPPLER_VELOCITY:
rlm@0 364 case AL_DISTANCE_MODEL:
rlm@0 365 case AL_SPEED_OF_SOUND:
rlm@0 366 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 367 *data = alGetFloat(pname);
rlm@0 368 return;
rlm@0 369 }
rlm@0 370 }
rlm@0 371
rlm@0 372 Context = GetLockedContext();
rlm@0 373 if(!Context) return;
rlm@0 374
rlm@0 375 if(data)
rlm@0 376 {
rlm@0 377 switch(pname)
rlm@0 378 {
rlm@0 379 default:
rlm@0 380 alSetError(Context, AL_INVALID_ENUM);
rlm@0 381 break;
rlm@0 382 }
rlm@0 383 }
rlm@0 384 else
rlm@0 385 {
rlm@0 386 // data is a NULL pointer
rlm@0 387 alSetError(Context, AL_INVALID_VALUE);
rlm@0 388 }
rlm@0 389
rlm@0 390 UnlockContext(Context);
rlm@0 391 }
rlm@0 392
rlm@0 393 AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname,ALint *data)
rlm@0 394 {
rlm@0 395 ALCcontext *Context;
rlm@0 396
rlm@0 397 if(data)
rlm@0 398 {
rlm@0 399 switch(pname)
rlm@0 400 {
rlm@0 401 case AL_DOPPLER_FACTOR:
rlm@0 402 case AL_DOPPLER_VELOCITY:
rlm@0 403 case AL_DISTANCE_MODEL:
rlm@0 404 case AL_SPEED_OF_SOUND:
rlm@0 405 case AL_DEFERRED_UPDATES_SOFT:
rlm@0 406 *data = alGetInteger(pname);
rlm@0 407 return;
rlm@0 408 }
rlm@0 409 }
rlm@0 410
rlm@0 411 Context = GetLockedContext();
rlm@0 412 if(!Context) return;
rlm@0 413
rlm@0 414 if(data)
rlm@0 415 {
rlm@0 416 switch(pname)
rlm@0 417 {
rlm@0 418 default:
rlm@0 419 alSetError(Context, AL_INVALID_ENUM);
rlm@0 420 break;
rlm@0 421 }
rlm@0 422 }
rlm@0 423 else
rlm@0 424 {
rlm@0 425 // data is a NULL pointer
rlm@0 426 alSetError(Context, AL_INVALID_VALUE);
rlm@0 427 }
rlm@0 428
rlm@0 429 UnlockContext(Context);
rlm@0 430 }
rlm@0 431
rlm@0 432 AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname)
rlm@0 433 {
rlm@0 434 const ALchar *value;
rlm@0 435 ALCcontext *pContext;
rlm@0 436
rlm@0 437 pContext = GetLockedContext();
rlm@0 438 if(!pContext) return NULL;
rlm@0 439
rlm@0 440 switch(pname)
rlm@0 441 {
rlm@0 442 case AL_VENDOR:
rlm@0 443 value=alVendor;
rlm@0 444 break;
rlm@0 445
rlm@0 446 case AL_VERSION:
rlm@0 447 value=alVersion;
rlm@0 448 break;
rlm@0 449
rlm@0 450 case AL_RENDERER:
rlm@0 451 value=alRenderer;
rlm@0 452 break;
rlm@0 453
rlm@0 454 case AL_EXTENSIONS:
rlm@0 455 value=pContext->ExtensionList;//alExtensions;
rlm@0 456 break;
rlm@0 457
rlm@0 458 case AL_NO_ERROR:
rlm@0 459 value=alNoError;
rlm@0 460 break;
rlm@0 461
rlm@0 462 case AL_INVALID_NAME:
rlm@0 463 value=alErrInvalidName;
rlm@0 464 break;
rlm@0 465
rlm@0 466 case AL_INVALID_ENUM:
rlm@0 467 value=alErrInvalidEnum;
rlm@0 468 break;
rlm@0 469
rlm@0 470 case AL_INVALID_VALUE:
rlm@0 471 value=alErrInvalidValue;
rlm@0 472 break;
rlm@0 473
rlm@0 474 case AL_INVALID_OPERATION:
rlm@0 475 value=alErrInvalidOp;
rlm@0 476 break;
rlm@0 477
rlm@0 478 case AL_OUT_OF_MEMORY:
rlm@0 479 value=alErrOutOfMemory;
rlm@0 480 break;
rlm@0 481
rlm@0 482 default:
rlm@0 483 value=NULL;
rlm@0 484 alSetError(pContext, AL_INVALID_ENUM);
rlm@0 485 break;
rlm@0 486 }
rlm@0 487
rlm@0 488 UnlockContext(pContext);
rlm@0 489
rlm@0 490 return value;
rlm@0 491 }
rlm@0 492
rlm@0 493 AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
rlm@0 494 {
rlm@0 495 ALCcontext *Context;
rlm@0 496
rlm@0 497 Context = GetLockedContext();
rlm@0 498 if(!Context) return;
rlm@0 499
rlm@0 500 if(value >= 0.0f && isfinite(value))
rlm@0 501 {
rlm@0 502 Context->DopplerFactor = value;
rlm@0 503 Context->UpdateSources = AL_TRUE;
rlm@0 504 }
rlm@0 505 else
rlm@0 506 alSetError(Context, AL_INVALID_VALUE);
rlm@0 507
rlm@0 508 UnlockContext(Context);
rlm@0 509 }
rlm@0 510
rlm@0 511 AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
rlm@0 512 {
rlm@0 513 ALCcontext *Context;
rlm@0 514
rlm@0 515 Context = GetLockedContext();
rlm@0 516 if(!Context) return;
rlm@0 517
rlm@0 518 if(value > 0.0f && isfinite(value))
rlm@0 519 {
rlm@0 520 Context->DopplerVelocity=value;
rlm@0 521 Context->UpdateSources = AL_TRUE;
rlm@0 522 }
rlm@0 523 else
rlm@0 524 alSetError(Context, AL_INVALID_VALUE);
rlm@0 525
rlm@0 526 UnlockContext(Context);
rlm@0 527 }
rlm@0 528
rlm@0 529 AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat flSpeedOfSound)
rlm@0 530 {
rlm@0 531 ALCcontext *pContext;
rlm@0 532
rlm@0 533 pContext = GetLockedContext();
rlm@0 534 if(!pContext) return;
rlm@0 535
rlm@0 536 if(flSpeedOfSound > 0.0f && isfinite(flSpeedOfSound))
rlm@0 537 {
rlm@0 538 pContext->flSpeedOfSound = flSpeedOfSound;
rlm@0 539 pContext->UpdateSources = AL_TRUE;
rlm@0 540 }
rlm@0 541 else
rlm@0 542 alSetError(pContext, AL_INVALID_VALUE);
rlm@0 543
rlm@0 544 UnlockContext(pContext);
rlm@0 545 }
rlm@0 546
rlm@0 547 AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
rlm@0 548 {
rlm@0 549 ALCcontext *Context;
rlm@0 550
rlm@0 551 Context = GetLockedContext();
rlm@0 552 if(!Context) return;
rlm@0 553
rlm@0 554 switch(value)
rlm@0 555 {
rlm@0 556 case AL_NONE:
rlm@0 557 case AL_INVERSE_DISTANCE:
rlm@0 558 case AL_INVERSE_DISTANCE_CLAMPED:
rlm@0 559 case AL_LINEAR_DISTANCE:
rlm@0 560 case AL_LINEAR_DISTANCE_CLAMPED:
rlm@0 561 case AL_EXPONENT_DISTANCE:
rlm@0 562 case AL_EXPONENT_DISTANCE_CLAMPED:
rlm@0 563 Context->DistanceModel = value;
rlm@0 564 Context->UpdateSources = AL_TRUE;
rlm@0 565 break;
rlm@0 566
rlm@0 567 default:
rlm@0 568 alSetError(Context, AL_INVALID_VALUE);
rlm@0 569 break;
rlm@0 570 }
rlm@0 571
rlm@0 572 UnlockContext(Context);
rlm@0 573 }
rlm@0 574
rlm@0 575
rlm@0 576 AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
rlm@0 577 {
rlm@0 578 ALCcontext *Context;
rlm@0 579
rlm@0 580 Context = GetLockedContext();
rlm@0 581 if(!Context) return;
rlm@0 582
rlm@0 583 if(!Context->DeferUpdates)
rlm@0 584 {
rlm@0 585 ALboolean UpdateSources;
rlm@0 586 ALsource **src, **src_end;
rlm@0 587 ALeffectslot *ALEffectSlot;
rlm@0 588 ALsizei e;
rlm@0 589
rlm@0 590 Context->DeferUpdates = AL_TRUE;
rlm@0 591
rlm@0 592 /* Make sure all pending updates are performed */
rlm@0 593 UpdateSources = Context->UpdateSources;
rlm@0 594 Context->UpdateSources = AL_FALSE;
rlm@0 595
rlm@0 596 src = Context->ActiveSources;
rlm@0 597 src_end = src + Context->ActiveSourceCount;
rlm@0 598 while(src != src_end)
rlm@0 599 {
rlm@0 600 if((*src)->state != AL_PLAYING)
rlm@0 601 {
rlm@0 602 Context->ActiveSourceCount--;
rlm@0 603 *src = *(--src_end);
rlm@0 604 continue;
rlm@0 605 }
rlm@0 606
rlm@0 607 if((*src)->NeedsUpdate || UpdateSources)
rlm@0 608 {
rlm@0 609 (*src)->NeedsUpdate = AL_FALSE;
rlm@0 610 ALsource_Update(*src, Context);
rlm@0 611 }
rlm@0 612 src++;
rlm@0 613 }
rlm@0 614
rlm@0 615 for(e = 0;e < Context->EffectSlotMap.size;e++)
rlm@0 616 {
rlm@0 617 ALEffectSlot = Context->EffectSlotMap.array[e].value;
rlm@0 618 if(ALEffectSlot->NeedsUpdate)
rlm@0 619 {
rlm@0 620 ALEffectSlot->NeedsUpdate = AL_FALSE;
rlm@0 621 ALEffect_Update(ALEffectSlot->EffectState, Context, ALEffectSlot);
rlm@0 622 }
rlm@0 623 }
rlm@0 624 }
rlm@0 625
rlm@0 626 UnlockContext(Context);
rlm@0 627 }
rlm@0 628
rlm@0 629 AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
rlm@0 630 {
rlm@0 631 ALCcontext *Context;
rlm@0 632
rlm@0 633 Context = GetLockedContext();
rlm@0 634 if(!Context) return;
rlm@0 635
rlm@0 636 if(Context->DeferUpdates)
rlm@0 637 {
rlm@0 638 ALsizei pos;
rlm@0 639
rlm@0 640 Context->DeferUpdates = AL_FALSE;
rlm@0 641
rlm@0 642 for(pos = 0;pos < Context->SourceMap.size;pos++)
rlm@0 643 {
rlm@0 644 ALsource *Source = Context->SourceMap.array[pos].value;
rlm@0 645 ALenum new_state;
rlm@0 646
rlm@0 647 if(Source->lOffset != -1)
rlm@0 648 ApplyOffset(Source);
rlm@0 649
rlm@0 650 new_state = Source->new_state;
rlm@0 651 Source->new_state = AL_NONE;
rlm@0 652 if(new_state)
rlm@0 653 SetSourceState(Source, Context, new_state);
rlm@0 654 }
rlm@0 655 }
rlm@0 656
rlm@0 657 UnlockContext(Context);
rlm@0 658 }