UiSoundSetting.cpp
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:1k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*****************************************************************************************
  2. // 界面声音
  3. // Copyright : Kingsoft 2003
  4. // Author :   Wooy(Wu yue)
  5. // CreateTime: 2003-5-15
  6. *****************************************************************************************/
  7. #include "KWin32.h"
  8. #include "KIniFile.h"
  9. #include "UiSoundSetting.h"
  10. #include "../../core/src/coreshell.h"
  11. extern iCoreShell* g_pCoreShell;
  12. #define SETTING_FILE "\Settings\SoundList.txt"
  13. static char s_SoundFileName[UI_SOUND_COUNT][80] = 
  14. {
  15. "",
  16. "",
  17. "",
  18. "",
  19. "",
  20. "",
  21. };
  22. //载入设定
  23. bool UiSoundLoadSetting()
  24. {
  25. KIniFile Setting;
  26. if (!Setting.Load(SETTING_FILE))
  27. return false;
  28. char szSection[8];
  29. for (int i = 0; i < (int)UI_SOUND_COUNT; i++)
  30. {
  31. itoa(i, szSection, 10);
  32. Setting.GetString("Ui", szSection, "", s_SoundFileName[i], sizeof(s_SoundFileName[i]));
  33. }
  34. return true;
  35. }
  36. //播放指定的声音
  37. void UiSoundPlay(UI_SOUND_INDEX eIndex)
  38. {
  39. if (g_pCoreShell)
  40. g_pCoreShell->OperationRequest(GOI_PLAY_SOUND, (unsigned int)(&s_SoundFileName[eIndex]), 0);
  41. }
  42. //播放指定的声音
  43. void UiSoundPlay(char* SoundFileName)
  44. {
  45. if (g_pCoreShell)
  46. g_pCoreShell->OperationRequest(GOI_PLAY_SOUND, (unsigned int)(SoundFileName), 0);
  47. }