| 268 | } |
| 269 | |
| 270 | void LAppModel::PreloadMotionGroup(const csmChar* group) |
| 271 | { |
| 272 | const csmInt32 count = _modelSetting->GetMotionCount(group); |
| 273 | |
| 274 | for (csmInt32 i = 0; i < count; i++) |
| 275 | { |
| 276 | //ex) idle_0 |
| 277 | csmString name = Utils::CubismString::GetFormatedString("%s_%d", group, i); |
| 278 | csmString path = _modelSetting->GetMotionFileName(group, i); |
| 279 | path = _modelHomeDir + path; |
| 280 | |
| 281 | if (_debugMode)LAppPal::PrintLog("[APP]load motion: %s => [%s_%d] ", path.GetRawString(), group, i); |
| 282 | |
| 283 | csmByte* buffer; |
| 284 | csmSizeInt size; |
| 285 | buffer = CreateBuffer(path.GetRawString(), &size); |
| 286 | CubismMotion* tmpMotion = static_cast<CubismMotion*>(LoadMotion(buffer, size, name.GetRawString())); |
| 287 | |
| 288 | csmFloat32 fadeTime = _modelSetting->GetMotionFadeInTimeValue(group, i); |
| 289 | if (fadeTime >= 0.0f) |
| 290 | { |
| 291 | tmpMotion->SetFadeInTime(fadeTime); |
| 292 | } |
| 293 | |
| 294 | fadeTime = _modelSetting->GetMotionFadeOutTimeValue(group, i); |
| 295 | if (fadeTime >= 0.0f) |
| 296 | { |
| 297 | tmpMotion->SetFadeOutTime(fadeTime); |
| 298 | } |
| 299 | tmpMotion->SetEffectIds(_eyeBlinkIds, _lipSyncIds); |
| 300 | |
| 301 | if (_motions[name] != NULL) |
| 302 | { |
| 303 | ACubismMotion::Delete(_motions[name]); |
| 304 | } |
| 305 | _motions[name] = tmpMotion; |
| 306 | |
| 307 | DeleteBuffer(buffer, path.GetRawString()); |
| 308 | |
| 309 | csmString voice = _modelSetting->GetMotionSoundFileName(group, i); |
| 310 | if (strcmp(voice.GetRawString(), "") != 0) |
| 311 | { |
| 312 | csmString path = voice; |
| 313 | path = _modelHomeDir + path; |
| 314 | |
| 315 | #if USE_AUDIO_ENGINE |
| 316 | AudioEngine::preload(path.GetRawString()); |
| 317 | #elif USE_SIMPLE_AUDIO_ENGINE |
| 318 | SimpleAudioEngine::getInstance()->preloadEffect(path.GetRawString()); |
| 319 | #endif |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | void LAppModel::ReleaseMotionGroup(const csmChar* group) const |
| 325 | { |
nothing calls this directly
no test coverage detected