1
0

playbackconfig.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "main.h"
  2. #include "../winamp/wa_ipc.h"
  3. #include <api/service/waServiceFactory.h>
  4. #include "../../Agave/Config/api_config.h"
  5. // {B6CB4A7C-A8D0-4c55-8E60-9F7A7A23DA0F}
  6. static const GUID playbackConfigGroupGUID =
  7. { 0xb6cb4a7c, 0xa8d0, 0x4c55, { 0x8e, 0x60, 0x9f, 0x7a, 0x7a, 0x23, 0xda, 0xf } };
  8. static api_config *configApi=0;
  9. api_config *GetConfigAPI()
  10. {
  11. if (mikmod.service && !configApi)
  12. {
  13. waServiceFactory *sf = (waServiceFactory *)mikmod.service->service_getServiceByGuid(AgaveConfigGUID);
  14. configApi = (api_config *)sf->getInterface();
  15. }
  16. return configApi;
  17. }
  18. extern "C"
  19. int GetSampleSizeFlag()
  20. {
  21. api_config *config = GetConfigAPI();
  22. int bits=16;
  23. if (config)
  24. bits = config->GetUnsigned(playbackConfigGroupGUID, L"bits", 16);
  25. switch(bits)
  26. {
  27. case 8:
  28. return 0;
  29. case 24:
  30. return DMODE_24BITS;
  31. case 16:
  32. default:
  33. return DMODE_16BITS;
  34. }
  35. }
  36. extern "C"
  37. int GetNumChannels()
  38. {
  39. api_config *config = GetConfigAPI();
  40. bool mono=false;
  41. if (config)
  42. mono = config->GetBool(playbackConfigGroupGUID, L"mono", false);
  43. if (mono)
  44. return 1;
  45. else
  46. return 2;
  47. }
  48. extern "C"
  49. int AllowSurround()
  50. {
  51. api_config *config = GetConfigAPI();
  52. bool surround=true;
  53. if (config)
  54. surround= config->GetBool(playbackConfigGroupGUID, L"surround", true);
  55. return surround?1:0;
  56. }
  57. extern "C"
  58. int GetThreadPriorityConfig()
  59. {
  60. api_config *config = GetConfigAPI();
  61. int priority=THREAD_PRIORITY_HIGHEST;
  62. if (config)
  63. priority = config->GetInt(playbackConfigGroupGUID, L"priority", THREAD_PRIORITY_HIGHEST);
  64. return priority;
  65. }