| 32 | // -------------------------------------------------------------------------------------------------------------------- |
| 33 | |
| 34 | CHRTF::CHRTF(CContext* context, |
| 35 | IPLAudioSettings* audioSettings, |
| 36 | IPLHRTFSettings* hrtfSettings) |
| 37 | { |
| 38 | auto _context = context->mHandle.get(); |
| 39 | if (!_context) |
| 40 | throw Exception(Status::Failure); |
| 41 | |
| 42 | HRTFSettings _hrtfSettings{}; |
| 43 | _hrtfSettings.type = static_cast<HRTFMapType>(hrtfSettings->type); |
| 44 | _hrtfSettings.sofaFileName = hrtfSettings->sofaFileName; |
| 45 | |
| 46 | if (Context::isCallerAPIVersionAtLeast(4, 2)) |
| 47 | { |
| 48 | _hrtfSettings.sofaData = hrtfSettings->sofaData; |
| 49 | _hrtfSettings.sofaDataSize = hrtfSettings->sofaDataSize; |
| 50 | _hrtfSettings.volume = Loudness::gainToDB(hrtfSettings->volume); |
| 51 | } |
| 52 | |
| 53 | if (Context::isCallerAPIVersionAtLeast(4, 3)) |
| 54 | { |
| 55 | _hrtfSettings.normType = static_cast<HRTFNormType>(hrtfSettings->normType); |
| 56 | } |
| 57 | |
| 58 | new (&mHandle) Handle<HRTFDatabase>(ipl::make_shared<HRTFDatabase>(_hrtfSettings, audioSettings->samplingRate, audioSettings->frameSize), _context); |
| 59 | } |
| 60 | |
| 61 | IHRTF* CHRTF::retain() |
| 62 | { |