-
Notifications
You must be signed in to change notification settings - Fork 4
/
BassEnc_OGG.pas
101 lines (82 loc) · 2.98 KB
/
BassEnc_OGG.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
BassEnc_OGG 2.4 Delphi unit
Copyright (c) 2016-2020 Un4seen Developments Ltd.
See the BASSENC_OGG.CHM file for more detailed documentation
NOTE: Delphi users should use the BASS_UNICODE flag where possible
}
{
TDDung - Vietnam, May 2021
}
unit BassEnc_OGG;
interface
uses
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF}
SysUtils, Bass, BassEnc;
const
{$IFDEF MSWINDOWS}
BassEncOggDLL = 'bassenc_ogg.dll';
{$ENDIF}
{$IFDEF LINUX}
BassEncOggDLL = 'libbassenc_ogg.so';
{$ENDIF}
{$IFDEF MACOS}
{$IFDEF IOS} // Needed frameworks: AudioToolbox, SystemConfiguration, CFNetwork, Accelerate, CoreMIDI (if using BASSMIDI)
BassEncOggDLL = 'Bass\Add-ons\Libs\iOS\libbassenc_ogg.a'; // Full path for static linking
{$ELSE}
BassEncOggDLL = 'libbassenc_ogg.dylib';
{$ENDIF}
{$ENDIF}
{$IFDEF ANDROID}
BassEncOggDLL = 'libbassenc_ogg.so';
{$ENDIF}
{$IFDEF IOS}
function BASS_Encode_OGG_GetVersion: Cardinal; cdecl; external BassEncOggDLL;
function BASS_Encode_OGG_NewStream(handle: HENCODE; options: PChar; flags: Cardinal): BOOL; cdecl; external BassEncOggDLL;
function BASS_Encode_OGG_Start(handle:Cardinal; options:PChar; flags:Cardinal; proc:ENCODEPROC; user:Pointer): HENCODE; cdecl; external BassEncOggDLL;
function BASS_Encode_OGG_StartFile(handle:Cardinal; options:PChar; flags:Cardinal; filename:PChar): HENCODE; cdecl; external BassEncOggDLL;
{$ELSE}
var
BASS_Encode_OGG_GetVersion:function:Cardinal; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
BASS_Encode_OGG_NewStream:function(handle: HENCODE; options: PChar; flags: Cardinal): BOOL; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
BASS_Encode_OGG_Start:function(handle:Cardinal; options:PChar; flags:Cardinal; proc:ENCODEPROC; user:Pointer): HENCODE; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
BASS_Encode_OGG_StartFile:function(handle:Cardinal; options:PChar; flags:Cardinal; filename:PChar): HENCODE; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
var
FBassEncOggDLL : THandle = 0;
{$ENDIF}
function BassEncOGG_IsAvailable: Boolean;
implementation
function BassEncOGG_IsAvailable: Boolean;
begin
{$IFDEF IOS}
Result := True;
{$ELSE}
Result := FBassEncOggDLL <> 0;
{$ENDIF}
end;
{$IFNDEF IOS}
procedure LoadBassEncOggDLL;
begin
FBassEncOggDLL := LoadLibrary(PChar(BassEncOggDLL));
if FBassEncOggDLL = 0 then
Exit;
BASS_Encode_OGG_GetVersion:= GetProcAddress(FBassEncOggDLL, PChar('BASS_Encode_OGG_GetVersion'));
BASS_Encode_OGG_NewStream:= GetProcAddress(FBassEncOggDLL, PChar('BASS_Encode_OGG_NewStream'));
BASS_Encode_OGG_Start:= GetProcAddress(FBassEncOggDLL, PChar('BASS_Encode_OGG_Start'));
BASS_Encode_OGG_StartFile:= GetProcAddress(FBassEncOggDLL, PChar('BASS_Encode_OGG_StartFile'));
end;
procedure UnloadBassEncOggDLL;
begin
FreeLibrary(FBassEncOggDLL);
end;
{$ENDIF}
initialization
{$IFNDEF IOS}
LoadBassEncOggDLL;
{$ENDIF}
finalization
{$IFNDEF IOS}
UnloadBassEncOggDLL;
{$ENDIF}
end.