VeritasPlay.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef NULLSOFT_VERITASPLAYH
  2. #define NULLSOFT_VERITASPLAYH
  3. #include "CDPlay.h"
  4. #include <windows.h>
  5. #include "SpeedLimiter.h"
  6. #include "main.h"
  7. using namespace Nullsoft::Utility;
  8. class VeritasBuffer
  9. {
  10. public:
  11. VeritasBuffer() : buffer(0), readSize(0), sector(0), offset(0)
  12. {
  13. }
  14. ~VeritasBuffer()
  15. {
  16. Destroy();
  17. }
  18. void Create(int numBuffers)
  19. {
  20. buffer = new BYTE[numBuffers * 2352];
  21. Clear();
  22. }
  23. void Destroy()
  24. {
  25. if (buffer)
  26. delete buffer;
  27. buffer = 0;
  28. Clear();
  29. }
  30. void Clear()
  31. {
  32. readSize = 0;
  33. sector = 0;
  34. }
  35. BYTE *buffer;
  36. BYTE *internal;
  37. DWORD readSize;
  38. DWORD sector;
  39. int offset;
  40. };
  41. class VeritasPlay : public C_CDPlay
  42. {
  43. public:
  44. VeritasPlay(bool _ripping = false);
  45. ~VeritasPlay();
  46. //void Delete() {if (primo) delete primo; primo = 0; }
  47. void CreateBuffers();
  48. void DestroyBuffers();
  49. int open(char drive, int track); //called by winampGetExtendedRead
  50. int play(char drive, int track); //called by winamp2
  51. int openVeritasTrack(DWORD start, DWORD length);
  52. static DWORD WINAPI threadProc(LPVOID lpParameter)
  53. {
  54. VeritasPlay *wp = (VeritasPlay *)lpParameter;
  55. return wp->threadProc2();
  56. }
  57. void OutputBuffer(VeritasBuffer &buffer);
  58. int read(char *dest, int len, int *killswitch);
  59. void Abort();
  60. void Seek();
  61. void SeekAndFlush();
  62. void Output(char *buffer, int len);
  63. void OutputOverflow();
  64. int CopyOverflow(char *sample_buffer, int len);
  65. size_t CopyBuffer(VeritasBuffer &buffer, char *&sample_buffer, int &bytes);
  66. int threadProc2();
  67. void stop();
  68. void pause()
  69. {
  70. line.outMod->Pause(1);
  71. }
  72. void unpause()
  73. {
  74. line.outMod->Pause(0);
  75. }
  76. int getlength()
  77. {
  78. return g_playlength;
  79. }
  80. int getoutputtime()
  81. {
  82. return line.outMod->GetOutputTime();
  83. }
  84. void setoutputtime(int time_in_ms);
  85. void setvolume(int a_v, int a_p);
  86. void *submitHandle;
  87. private:
  88. void Close();
  89. void AbortAsync();
  90. void WaitForAbort(int time);
  91. int killswitch;
  92. HANDLE hThread;
  93. int decode_pos_ms;
  94. int need_seek;
  95. DWORD unit, start_sector, end_sector, lastseek, sec_length;
  96. int end;
  97. int total_extract_len;
  98. DWORD extract_start_time;
  99. BYTE *overflowBuffer;
  100. long overflow;
  101. VeritasBuffer *buffers;
  102. int buf_size, currentBuffer, nb_veritas_buf;
  103. int g_nch;
  104. bool ripping, opened;
  105. SpeedLimiter speedLimiter;
  106. bool padStart, padEnd;
  107. #ifndef IGNORE_PRIMO
  108. obj_primo *primo;
  109. #endif
  110. };
  111. #endif