xref: /MusicPlayer2/MusicPlayer2/BASSWmaLibrary.h (revision 877f5f92b251a01591a4960c885129aa589a8135)
1 #pragma once
2 #include "DllLib.h"
3 
4 typedef DWORD HWMENCODE;	// WMA encoding handle
5 
6 #define BASS_WMA_ENCODE_STANDARD	0x2000	// standard WMA
7 #define BASS_WMA_ENCODE_SOURCE		0x80000	// use a BASS channel as source
8 
9 // BASS_WMA_EncodeSetTag "form" values
10 #define BASS_WMA_TAG_UNICODE	1
11 
12 #define BASS_ERROR_WMA				1001	// Windows Media (9 or above) is not installed
13 
14 class CBASSWmaLibrary : public CDllLib
15 {
16 	typedef HWMENCODE (WINAPI *_BASS_WMA_EncodeOpenFile)(DWORD freq, DWORD chans, DWORD flags, DWORD bitrate, const char *file);
17 	typedef BOOL (WINAPI *_BASS_WMA_EncodeWrite)(HWMENCODE handle, const void *buffer, DWORD length);
18 	typedef BOOL (WINAPI *_BASS_WMA_EncodeClose)(HWMENCODE handle);
19 	typedef BOOL (WINAPI *_BASS_WMA_EncodeSetTag)(HWMENCODE handle, const char *tag, const char *text, DWORD form);
20 public:
21 	CBASSWmaLibrary();
22 	~CBASSWmaLibrary();
23 
24 	//BASS encoder库中的函数指针
25 	_BASS_WMA_EncodeOpenFile BASS_WMA_EncodeOpenFile;
26 	_BASS_WMA_EncodeWrite BASS_WMA_EncodeWrite;
27 	_BASS_WMA_EncodeClose BASS_WMA_EncodeClose;
28 	_BASS_WMA_EncodeSetTag BASS_WMA_EncodeSetTag;
29 
BASS_WMA_EncodeOpenFileW(DWORD freq,DWORD chans,DWORD flags,DWORD bitrate,const wchar_t * file)30 	HWMENCODE BASS_WMA_EncodeOpenFileW(DWORD freq, DWORD chans, DWORD flags, DWORD bitrate, const wchar_t *file)
31 	{
32 		return BASS_WMA_EncodeOpenFile(freq, chans, flags | BASS_UNICODE, bitrate, (const char*)file);
33 	}
34 
BASS_WMA_EncodeSetTagW(HWMENCODE handle,const wchar_t * tag,const wchar_t * text)35 	BOOL BASS_WMA_EncodeSetTagW(HWMENCODE handle, const wchar_t *tag, const wchar_t *text)
36 	{
37 		return BASS_WMA_EncodeSetTag(handle, (const char*)tag, (const char*)text, BASS_WMA_TAG_UNICODE);
38 	}
39 
40 private:
41     virtual bool GetFunction() override;
42 
43 };
44 
45