샘플 50,000에서 재생을 시작하고 100,000에서 끝내려면 사운드 파일 샘플링 속도와 시스템 샘플 속도가 같다고 가정하면 다음을 수행 할 수 있습니다. DSP 출력 클럭은 시스템 출력 샘플에서 작동하므로 최종 샘플을 출력 속도와 관련하여 조정해야 할 수도 있습니다. 사운드 샘플 레이트는 Sound :: getDefaults를, 시스템 레이트는 System :: getSoftwareFormat를 참조하십시오.
unsigned int sysHi, sysLo;
// ... create sound, play sound paused ...
// Seek the data to the desired start offset
channel->setPosition(50000, FMOD_TIMEUNIT_PCM);
// For accurate sample playback get the current system "tick"
system->getDSPClock(&sysHi, &sysLo);
// Set start offset to a couple of "mixes" in the future, 2048 samples is far enough in the future to avoid issues with mixer timings
FMOD_64BIT_ADD(sysHi, sysLo, 0, 2048);
channel->setDelay(FMOD_DELAYTYPE_DSPCLOCK_START, sysHi, sysLo);
// Set end offset for 50,000 samples from our start time, which means the end sample will be 100,000
FMOD_64BIT_ADD(sysHi, sysLo, 0, 50000);
channel->setDelay(FMOD_DELAYTYPE_DSPCLOCK_END, sysHi, sysLo);
// ... unpause sound ...
감사합니다. 확인하기 위해이 두 가지 방법 모두 정확하지 않습니까? 그들은 언제 * 정지 스트림 코드에 도달했는지에 달려 있습니다. 일정한 간격을 정확하게 재생할 방법이 없습니까? –