SoundEditorAccessor.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #include "SoundEditorAccessor.h"
  2. #ifndef _XBOX
  3. #ifndef NO_TOOLS
  4. CREATE_SERVICE_NAMED("SoundEditorAccessor", SoundEditorAccessor, 1000)
  5. SoundEditorAccessor::SoundEditorAccessor()
  6. {
  7. soundService = null;
  8. }
  9. SoundEditorAccessor::~SoundEditorAccessor()
  10. {
  11. }
  12. bool SoundEditorAccessor::Init()
  13. {
  14. soundService = (SoundService *)api->GetService("SoundService");
  15. return (soundService != null);
  16. }
  17. //Разрешить-запретить создавать звуки с временных данных
  18. void SoundEditorAccessor::EditEnablePreview(bool isEnable)
  19. {
  20. soundService->EditEnablePreview(isEnable);
  21. }
  22. //Зарегистрировать звук для предпрослушивания
  23. void SoundEditorAccessor::EditRegistrySound(SoundBankFileSound * sbfs)
  24. {
  25. soundService->EditRegistrySound(sbfs);
  26. }
  27. //Отменить регистрацию звука для предпрослушивания
  28. bool SoundEditorAccessor::EditUnregistrySound(SoundBankFileSound * sbfs)
  29. {
  30. return soundService->EditUnregistrySound(sbfs);
  31. }
  32. //Обновить параметры звука
  33. bool SoundEditorAccessor::EditPatchSound(EditPatchSoundData & data, bool isCheckWaves)
  34. {
  35. return soundService->EditPatchSound(data, isCheckWaves);
  36. }
  37. //Остановить проигрывание всех звуков
  38. void SoundEditorAccessor::EditStopAllSounds(const char * sceneOvner)
  39. {
  40. soundService->EditStopAllSounds(sceneOvner);
  41. }
  42. //Запустить волну на проигрывание 16бит (для звукового редактора)
  43. bool SoundEditorAccessor::EditPrewiewPlay(const dword userId[4], EditPrewiewWaveParams * mainWave, EditPrewiewWaveParams * mirrorWave, bool isMirror)
  44. {
  45. return soundService->Engine().EditPrewiewPlay(userId, mainWave, mirrorWave, isMirror);
  46. }
  47. //Переключить волну на зеркальную или оригинальную
  48. bool SoundEditorAccessor::EditPrewiewSwitch(const dword userId[4], bool isMirror)
  49. {
  50. return soundService->Engine().EditPrewiewSwitch(userId, isMirror);
  51. }
  52. //Играет ли волна на прослушивании (для звукового редактора), userId[4] == 0 игнорировать его
  53. bool SoundEditorAccessor::EditPrewiewIsPlay(const dword userId[4], dword * samplesCount, bool * playWithMirror)
  54. {
  55. return soundService->Engine().EditPrewiewIsPlay(userId, samplesCount, playWithMirror);
  56. }
  57. //Остановить прослушивание волны, userId[4] == 0 игнорировать его
  58. void SoundEditorAccessor::EditPrewiewStop(const dword userId[4])
  59. {
  60. soundService->Engine().EditPrewiewStop(userId);
  61. }
  62. //Установить громкость прослушиваемой волны, userId[4] == 0 игнорировать его
  63. void SoundEditorAccessor::EditPrewiewSetVolume(float volume, const dword userId[4])
  64. {
  65. soundService->Engine().EditPrewiewSetVolume(volume, userId);
  66. }
  67. #endif
  68. #endif