| 340 | //----------------------------------------------------------------------------- |
| 341 | |
| 342 | void SSI263::Play(unsigned int nPhoneme) |
| 343 | { |
| 344 | if (m_dbgFirst) |
| 345 | { |
| 346 | m_dbgStartTime = g_nCumulativeCycles; |
| 347 | #if LOG_SSI263 || LOG_SSI263B || LOG_SC01 |
| 348 | LogOutput("1st phoneme = 0x%02X\n", nPhoneme); |
| 349 | #endif |
| 350 | } |
| 351 | |
| 352 | #if LOG_SSI263 || LOG_SSI263B || LOG_SC01 |
| 353 | if (m_currentActivePhoneme != -1 && !(m_currentActivePhoneme & kPhonemeLeadoutFlag)) |
| 354 | LogOutput("Overlapping phonemes: current=%02X, next=%02X\n", m_currentActivePhoneme&0xff, nPhoneme&0xff); |
| 355 | #endif |
| 356 | m_currentActivePhoneme = nPhoneme; |
| 357 | |
| 358 | bool bPause = false; |
| 359 | |
| 360 | if (nPhoneme == 1) |
| 361 | nPhoneme = 2; // Missing this sample, so map to phoneme-2 |
| 362 | |
| 363 | if (nPhoneme == 0) |
| 364 | bPause = true; |
| 365 | else |
| 366 | nPhoneme-=2; // Missing phoneme-1 |
| 367 | |
| 368 | m_phonemeLengthRemaining = g_nPhonemeInfo[nPhoneme].nLength; |
| 369 | |
| 370 | m_phonemeAccurateLengthRemaining = m_phonemeLengthRemaining; |
| 371 | m_phonemePlaybackAndDebugger = (g_nAppMode == MODE_STEPPING || g_nAppMode == MODE_DEBUG); |
| 372 | m_phonemeCompleteByFullSpeed = false; |
| 373 | m_phonemeLeadoutLength = m_phonemeLengthRemaining / 10; // Arbitrary! (TODO: determine a more accurate factor) |
| 374 | |
| 375 | if (bPause) |
| 376 | { |
| 377 | if (!m_pPhonemeData00) |
| 378 | { |
| 379 | // 'pause' length is length of 1st phoneme (arbitrary choice, since don't know real length) |
| 380 | m_pPhonemeData00 = new short [m_phonemeLengthRemaining]; |
| 381 | memset(m_pPhonemeData00, 0x00, m_phonemeLengthRemaining*sizeof(short)); |
| 382 | } |
| 383 | |
| 384 | m_pPhonemeData = m_pPhonemeData00; |
| 385 | } |
| 386 | else |
| 387 | { |
| 388 | m_pPhonemeData = (const short*) &g_nPhonemeData[g_nPhonemeInfo[nPhoneme].nOffset]; |
| 389 | } |
| 390 | |
| 391 | m_currSampleSum = 0; |
| 392 | m_currNumSamples = 0; |
| 393 | m_currSampleMod4 = 0; |
| 394 | |
| 395 | // Set m_lastUpdateCycle, otherwise UpdateAccurateLength() can immediately complete phoneme! (GH#1104) |
| 396 | m_lastUpdateCycle = GetLastCumulativeCycles(); |
| 397 | } |
| 398 | |
| 399 | void SSI263::Stop(void) |
no test coverage detected