MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / postinit

Method postinit

extlibs/soloud/src/core/soloud.cpp:503–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501 }
502
503 void Soloud::postinit(unsigned int aSamplerate, unsigned int aBufferSize, unsigned int aFlags, unsigned int aChannels)
504 {
505 mGlobalVolume = 1;
506 mChannels = aChannels;
507 mSamplerate = aSamplerate;
508 mBufferSize = aBufferSize;
509 mScratchSize = aBufferSize;
510 if (mScratchSize < SAMPLE_GRANULARITY * 2) mScratchSize = SAMPLE_GRANULARITY * 2;
511 if (mScratchSize < 4096) mScratchSize = 4096;
512 mScratchNeeded = mScratchSize;
513 mScratch.init(mScratchSize * MAX_CHANNELS);
514 mOutputScratch.init(mScratchSize * MAX_CHANNELS);
515 mResampleData = new AlignedFloatBuffer[mMaxActiveVoices * 2];
516 mResampleDataOwner = new AudioSourceInstance*[mMaxActiveVoices];
517 unsigned int i;
518 for (i = 0; i < mMaxActiveVoices * 2; i++)
519 mResampleData[i].init(SAMPLE_GRANULARITY * MAX_CHANNELS);
520 for (i = 0; i < mMaxActiveVoices; i++)
521 mResampleDataOwner[i] = NULL;
522 mFlags = aFlags;
523 mPostClipScaler = 0.95f;
524 switch (mChannels)
525 {
526 case 1:
527 m3dSpeakerPosition[0 * 3 + 0] = 0;
528 m3dSpeakerPosition[0 * 3 + 1] = 0;
529 m3dSpeakerPosition[0 * 3 + 2] = 1;
530 break;
531 case 2:
532 m3dSpeakerPosition[0 * 3 + 0] = 2;
533 m3dSpeakerPosition[0 * 3 + 1] = 0;
534 m3dSpeakerPosition[0 * 3 + 2] = 1;
535 m3dSpeakerPosition[1 * 3 + 0] = -2;
536 m3dSpeakerPosition[1 * 3 + 1] = 0;
537 m3dSpeakerPosition[1 * 3 + 2] = 1;
538 break;
539 case 4:
540 m3dSpeakerPosition[0 * 3 + 0] = 2;
541 m3dSpeakerPosition[0 * 3 + 1] = 0;
542 m3dSpeakerPosition[0 * 3 + 2] = 1;
543 m3dSpeakerPosition[1 * 3 + 0] = -2;
544 m3dSpeakerPosition[1 * 3 + 1] = 0;
545 m3dSpeakerPosition[1 * 3 + 2] = 1;
546 // I suppose technically the second pair should be straight left & right,
547 // but I prefer moving them a bit back to mirror the front speakers.
548 m3dSpeakerPosition[2 * 3 + 0] = 2;
549 m3dSpeakerPosition[2 * 3 + 1] = 0;
550 m3dSpeakerPosition[2 * 3 + 2] = -1;
551 m3dSpeakerPosition[3 * 3 + 0] = -2;
552 m3dSpeakerPosition[3 * 3 + 1] = 0;
553 m3dSpeakerPosition[3 * 3 + 2] = -1;
554 break;
555 case 6:
556 m3dSpeakerPosition[0 * 3 + 0] = 2;
557 m3dSpeakerPosition[0 * 3 + 1] = 0;
558 m3dSpeakerPosition[0 * 3 + 2] = 1;
559 m3dSpeakerPosition[1 * 3 + 0] = -2;
560 m3dSpeakerPosition[1 * 3 + 1] = 0;

Callers 15

portaudio_initFunction · 0.80
null_initFunction · 0.80
opensles_initFunction · 0.80
winmm_initFunction · 0.80
alsa_initFunction · 0.80
oss_initFunction · 0.80
openal_initFunction · 0.80
xaudio2_initFunction · 0.80
sdl1_initFunction · 0.80
sdl2_initFunction · 0.80
wasapi_initFunction · 0.80
sdl2static_initFunction · 0.80

Calls 1

initMethod · 0.45

Tested by

no test coverage detected