xref: /MusicPlayer2/MusicPlayer2/BASSEncodeLibrary.h (revision 877f5f92b251a01591a4960c885129aa589a8135)
1 #pragma once
2 #include "DllLib.h"
3 typedef DWORD HENCODE;		// encoder handle
4 
5 typedef void (CALLBACK ENCODEPROC)(HENCODE handle, DWORD channel, const void *buffer, DWORD length, void *user);
6 /* Encoding callback function.
7 handle : The encoder
8 channel: The channel handle
9 buffer : Buffer containing the encoded data
10 length : Number of bytes
11 user   : The 'user' parameter value given when calling BASS_Encode_Start */
12 
13 // BASS_Encode_Start flags
14 #define BASS_ENCODE_PCM			64		// write PCM sample data (no encoder)
15 #define BASS_ENCODE_AUTOFREE	0x40000 // free the encoder when the channel is freed
16 
17 
18 class CBASSEncodeLibrary : public CDllLib
19 {
20 	typedef HENCODE (WINAPI *_BASS_Encode_Start)(DWORD handle, const char *cmdline, DWORD flags, ENCODEPROC *proc, void *user);
21 	typedef BOOL (WINAPI *_BASS_Encode_Stop)(DWORD handle);
22 	typedef DWORD (WINAPI *_BASS_Encode_IsActive)(DWORD handle);
23 public:
24 	CBASSEncodeLibrary();
25 	~CBASSEncodeLibrary();
26 
27 	//BASS encoder库中的函数指针
28 	_BASS_Encode_Start BASS_Encode_Start;
29 	_BASS_Encode_Stop BASS_Encode_Stop;
30 	_BASS_Encode_IsActive BASS_Encode_IsActive;
31 
BASS_Encode_StartW(DWORD handle,const wchar_t * cmdline,DWORD flags,ENCODEPROC * proc,void * user)32 	HENCODE BASS_Encode_StartW(DWORD handle, const wchar_t *cmdline, DWORD flags, ENCODEPROC *proc, void *user)
33 	{
34 		return BASS_Encode_Start(handle, (const char*)cmdline, flags | BASS_UNICODE, proc, user);
35 	}
36 
37 private:
38     virtual bool GetFunction() override;
39 };
40 
41