1 | {This unit is part of United Openlibraries of Sound (uos)}
|
---|
2 |
|
---|
3 | { License : modified LGPL.
|
---|
4 | Fred van Stappen fiens@hotmail.com }
|
---|
5 |
|
---|
6 | // This is the "Flat Layer" of uos => for universal methods.
|
---|
7 |
|
---|
8 | unit uos_flat;
|
---|
9 |
|
---|
10 | {$mode objfpc}{$H+}{$inline on}
|
---|
11 | {$PACKRECORDS C}
|
---|
12 |
|
---|
13 | // For custom configuration of directive to compiler ---> uos_define.inc
|
---|
14 | {$I uos_define.inc}
|
---|
15 |
|
---|
16 | interface
|
---|
17 |
|
---|
18 | uses
|
---|
19 |
|
---|
20 | {$IF DEFINED (Java)}
|
---|
21 | uos_jni,
|
---|
22 | {$endif}
|
---|
23 |
|
---|
24 | {$IF (FPC_FULLVERSION < 20701) and DEFINED (fpgui)}
|
---|
25 | fpg_base,
|
---|
26 | {$ENDIF}
|
---|
27 |
|
---|
28 | ctypes,
|
---|
29 | Classes,
|
---|
30 | Math,
|
---|
31 | SysUtils,
|
---|
32 | uos;
|
---|
33 |
|
---|
34 | {$IF DEFINED (bs2b)}
|
---|
35 | const
|
---|
36 | BS2B_HIGH_CLEVEL = (CInt32 (700)) or ( (CInt32 (30)) shl 16);
|
---|
37 | BS2B_MIDDLE_CLEVEL = (CInt32 (500)) or ( (CInt32 (45)) shl 16);
|
---|
38 | BS2B_LOW_CLEVEL = (CInt32 (360)) or ( (CInt32 (60)) shl 16);
|
---|
39 | { Easy crossfeed levels (Obsolete) }
|
---|
40 | BS2B_HIGH_ECLEVEL = (CInt32 (700)) or ( (CInt32 (60)) shl 16);
|
---|
41 | BS2B_MIDDLE_ECLEVEL = (CInt32 (500)) or ( (CInt32 (72)) shl 16);
|
---|
42 | BS2B_LOW_ECLEVEL = (CInt32 (360)) or ( (CInt32 (84)) shl 16);
|
---|
43 | BS2B_DEFAULT_CLEVEL = (CInt32 (700)) or ( (CInt32 (45)) shl 16);
|
---|
44 | BS2B_CMOY_CLEVEL = (CInt32 (700)) or ( (CInt32 (60)) shl 16);
|
---|
45 | BS2B_JMEIER_CLEVEL = (CInt32 (650)) or ( (CInt32 (95)) shl 16);
|
---|
46 | {$endif}
|
---|
47 |
|
---|
48 | {$IF DEFINED (synthesizer)}
|
---|
49 | const
|
---|
50 | // musical note ==> frequency in hertz
|
---|
51 | // Latin: Do, Ré, Mi, Fa, Sol, La, Si
|
---|
52 | // Dièse = _d example la0_d
|
---|
53 | la0 = 55.0;
|
---|
54 | la0_d = 58.3;
|
---|
55 | si0 = 61.7;
|
---|
56 | do0 = 65.4;
|
---|
57 | do0_d = 69.3;
|
---|
58 | re0 = 73.4;
|
---|
59 | re0_d =77.8;
|
---|
60 | mi0 =82.4;
|
---|
61 | fa0 = 87.3;
|
---|
62 | fa0_d = 92.5;
|
---|
63 | sol0 = 98.0;
|
---|
64 | sol0_d = 103.8;
|
---|
65 | la1 = 110.0;
|
---|
66 | la1_d = 116.5;
|
---|
67 | si1 = 123.5;
|
---|
68 | do1 = 130.8;
|
---|
69 | do1_d = 138.6;
|
---|
70 | re1 = 146.8;
|
---|
71 | re1_d =155.6;
|
---|
72 | mi1 =164.8;
|
---|
73 | fa1 = 174.6;
|
---|
74 | fa1_d = 185.0;
|
---|
75 | sol1 = 196.0;
|
---|
76 | sol1_d = 207.7;
|
---|
77 | la2 = 220.0;
|
---|
78 | la2_d = 233.1;
|
---|
79 | si2 = 2246.9;
|
---|
80 | do2 = 261.6;
|
---|
81 | do2_d = 277.2;
|
---|
82 | re2 = 293.7;
|
---|
83 | re2_d =311.1;
|
---|
84 | mi2 =329.6;
|
---|
85 | fa2 = 349.2;
|
---|
86 | fa2_d = 370.0;
|
---|
87 | sol2 = 392.0;
|
---|
88 | sol2_d = 415.3;
|
---|
89 | la3 = 440.0;
|
---|
90 | la3_d = 466.2;
|
---|
91 | si3 = 493.9;
|
---|
92 | do3 = 523.3;
|
---|
93 | do3_d = 554.4;
|
---|
94 | re3 = 587.3;
|
---|
95 | re3_d = 622.3;
|
---|
96 | mi3 = 659.3;
|
---|
97 | fa3 = 698.5;
|
---|
98 | fa3_d = 740.0;
|
---|
99 | sol3 = 784.0;
|
---|
100 | sol3_d = 830.6;
|
---|
101 | la4 = 880.0;
|
---|
102 | la4_d = 932.4;
|
---|
103 | si4 = 987.8;
|
---|
104 | do4 = 1046.6;
|
---|
105 | do4_d = 1108.8;
|
---|
106 | re4 = 1174.6;
|
---|
107 | re4_d = 1244.6;
|
---|
108 | mi4 = 1318.6;
|
---|
109 | fa4 = 1397.0;
|
---|
110 | fa4_d = 1480.0;
|
---|
111 | sol4 = 1568.0;
|
---|
112 | sol4_d = 1661.2;
|
---|
113 | la5 = 1760.0;
|
---|
114 |
|
---|
115 | // English musique note
|
---|
116 | // A, B, C, D, E, F, G
|
---|
117 | a0 = 55.0;
|
---|
118 | a0_s = 58.3;
|
---|
119 | b0 = 61.7;
|
---|
120 | c0 = 65.4;
|
---|
121 | c0_s = 69.3;
|
---|
122 | d0 = 73.4;
|
---|
123 | d0_s =77.8;
|
---|
124 | e0 =82.4;
|
---|
125 | f0 = 87.3;
|
---|
126 | f0_s = 92.5;
|
---|
127 | g0 = 98.0;
|
---|
128 | g0_s = 103.8;
|
---|
129 | a1 = 110.0;
|
---|
130 | a1_s = 116.5;
|
---|
131 | b1 = 123.5;
|
---|
132 | c1 = 130.8;
|
---|
133 | c1_s = 138.6;
|
---|
134 | d1 = 146.8;
|
---|
135 | d1_s =155.6;
|
---|
136 | e1 =164.8;
|
---|
137 | f1 = 174.6;
|
---|
138 | f1_s = 185.0;
|
---|
139 | g1 = 196.0;
|
---|
140 | g1_s = 207.7;
|
---|
141 | a2 = 220.0;
|
---|
142 | a2_s = 233.1;
|
---|
143 | b2 = 2246.9;
|
---|
144 | c2 = 261.6;
|
---|
145 | c2_s = 277.2;
|
---|
146 | d2 = 293.7;
|
---|
147 | d2_s =311.1;
|
---|
148 | e2 =329.6;
|
---|
149 | f2 = 349.2;
|
---|
150 | f2_s = 370.0;
|
---|
151 | g2 = 392.0;
|
---|
152 | g2_s = 415.3;
|
---|
153 | a3 = 440.0;
|
---|
154 | a3_s = 466.2;
|
---|
155 | b3 = 493.9;
|
---|
156 | c3 = 523.3;
|
---|
157 | c3_s = 554.4;
|
---|
158 | d3 = 587.3;
|
---|
159 | d3_s = 622.3;
|
---|
160 | e3 = 659.3;
|
---|
161 | f3 = 698.5;
|
---|
162 | f3_s = 740.0;
|
---|
163 | g3 = 784.0;
|
---|
164 | g3_s = 830.6;
|
---|
165 | a4 = 880.0;
|
---|
166 | a4_s = 932.4;
|
---|
167 | b4 = 987.8;
|
---|
168 | c4 = 1046.6;
|
---|
169 | c4_s = 1108.8;
|
---|
170 | d4 = 1174.6;
|
---|
171 | d4_s = 1244.6;
|
---|
172 | e4 = 1318.6;
|
---|
173 | f4 = 1397.0;
|
---|
174 | f4_s = 1480.0;
|
---|
175 | g4 = 1568.0;
|
---|
176 | g4_s = 1661.2;
|
---|
177 | a5 = 1760.0;
|
---|
178 | {$endif}
|
---|
179 |
|
---|
180 | type
|
---|
181 | TDArFloat = array of cfloat;
|
---|
182 |
|
---|
183 | TDArShort = array of cInt16;
|
---|
184 | TDArLong = array of cInt32;
|
---|
185 |
|
---|
186 | TDArPARFloat = array of TDArFloat;
|
---|
187 | TDArIARFloat = array of TDArPARFloat;
|
---|
188 |
|
---|
189 | PDArFloat = ^TDArFloat;
|
---|
190 | PDArShort = ^TDArShort;
|
---|
191 | PDArLong = ^TDArLong;
|
---|
192 |
|
---|
193 | type
|
---|
194 |
|
---|
195 | {$if DEFINED (java)}
|
---|
196 | TProc = JMethodID;
|
---|
197 | {$else}
|
---|
198 | TProc = procedure of object;
|
---|
199 | TPlayerProc = procedure(PlayerIndex: cint32) of object;
|
---|
200 | {$endif}
|
---|
201 |
|
---|
202 | type
|
---|
203 | {$if not defined (fs32bit)}
|
---|
204 | Tcount_t = cint64; { used for file sizes }
|
---|
205 | {$else}
|
---|
206 | Tcount_t = cint;
|
---|
207 | {$endif}
|
---|
208 | PMemoryStream = ^TmemoryStream;
|
---|
209 |
|
---|
210 | type
|
---|
211 | TuosF_Data = Tuos_Data;
|
---|
212 | TuosF_FFT = Tuos_FFT;
|
---|
213 | TuosF_BufferInfos = Tuos_BufferInfos;
|
---|
214 |
|
---|
215 | {$IF (FPC_FULLVERSION < 20701) and DEFINED (fpgui)}
|
---|
216 | const
|
---|
217 | MSG_CUSTOM1 = FPGM_USER + 1;
|
---|
218 |
|
---|
219 | {$ENDIF}
|
---|
220 |
|
---|
221 | // General public procedure/function (accessible for library uos too)
|
---|
222 |
|
---|
223 | function uos_GetInfoLibraries(): PChar;
|
---|
224 |
|
---|
225 | // convert buffer int16 into float32.
|
---|
226 | function uos_Int16ToFloat32(Inbuf: TDArFloat): TDArFloat;
|
---|
227 |
|
---|
228 | {$IF DEFINED (portaudio)}
|
---|
229 | procedure uos_GetInfoDevice ();
|
---|
230 |
|
---|
231 | procedure uos_UpdateDevice ();
|
---|
232 |
|
---|
233 | function uos_GetInfoDeviceStr () : PChar;
|
---|
234 | {$endif}
|
---|
235 |
|
---|
236 | // test a library to check if it can be loaded;
|
---|
237 | function uos_TestLoadLibrary(Filename: PChar): Boolean;
|
---|
238 |
|
---|
239 | // load libraries... if libraryfilename = nil => do not load it... You may load what and when you want...
|
---|
240 | // PortAudio => needed for dealing with audio-device input/output
|
---|
241 | // SndFile => needed for dealing with ogg, vorbis, flac and wav audio-files
|
---|
242 | // Mpg123 => needed for dealing with mp* audio-files
|
---|
243 | // Mp4ff and Faad => needed for dealing with acc, m4a audio-files
|
---|
244 | // opusfile => needed for dealing with opus audio-files
|
---|
245 | // XMPFileName => needed for dealing with mod files
|
---|
246 | // fdkaacFilename => needed for dealing with webstreamm aac files.
|
---|
247 | function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName, fdkaacFilename: PChar): cint32;
|
---|
248 |
|
---|
249 | // If you want to load libraries from system, replace it by "'system'"
|
---|
250 | // If some libraries are not needed, replace it by "nil",
|
---|
251 |
|
---|
252 | // for example : uos_loadlib ('system', SndFileFileName, 'system', nil, nil, nil, OpusFileFileName, nil, nil)
|
---|
253 |
|
---|
254 | // The same but without fdkaac. (for compatibility with previous version)
|
---|
255 | function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName: PChar): cint32;
|
---|
256 |
|
---|
257 | // The same but without fdkaac and libxmp. (for compatibility with previous version)
|
---|
258 | function uos_LoadLib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName: PChar): cint32;
|
---|
259 |
|
---|
260 | // Unload all libraries...
|
---|
261 | procedure uos_unloadlib();
|
---|
262 |
|
---|
263 | // Free uos;
|
---|
264 | // To use when program terminate. Do not forget to call it before close application...
|
---|
265 | procedure uos_free();
|
---|
266 |
|
---|
267 | // Custom Unload libraries... if true, then unload the library. You may unload what and when you want...
|
---|
268 | procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: Boolean);
|
---|
269 |
|
---|
270 | // load plugin...
|
---|
271 | function uos_loadPlugin(PluginName, PluginFilename: PChar): cint32;
|
---|
272 |
|
---|
273 | {$IF DEFINED (shout)}
|
---|
274 | // Shout => needed for dealing with IceCast server
|
---|
275 | // Opus => needed for dealing with encoding opus stream
|
---|
276 | function uos_LoadServerLib (ShoutFileName, OpusFileName : PChar) : cint32;
|
---|
277 |
|
---|
278 | // Unload server libraries... Do not forget to call it before close application...
|
---|
279 | procedure uos_unloadServerLib ();
|
---|
280 | {$endif}
|
---|
281 | procedure uos_UnloadPlugin(PluginName: PChar);
|
---|
282 |
|
---|
283 | {$IF (FPC_FULLVERSION < 20701) and DEFINED (fpgui)}
|
---|
284 | // PlayerIndex : from 0 to what your computer can do! (depends of ram, cpu, soundcard, ...)
|
---|
285 | // If PlayerIndex already exists, it will be overwriten...
|
---|
286 | function uos_CreatePlayer(PlayerIndex: cint32; AParent: TObject): Boolean;
|
---|
287 | {$else}
|
---|
288 | function uos_CreatePlayer (PlayerIndex: cint32): boolean;
|
---|
289 | {$endif}
|
---|
290 |
|
---|
291 | {$IF DEFINED (portaudio)}
|
---|
292 | // Add an Output into Device Output with default parameters
|
---|
293 | function uos_AddIntoDevOut (PlayerIndex: cint32): cint32;
|
---|
294 |
|
---|
295 | // Add an Output into Device Output with custom parameters
|
---|
296 | // Add an Output into Device Output
|
---|
297 | // Device ( -1 is default device )
|
---|
298 | // Latency ( -1 is latency suggested )
|
---|
299 | // SampleRate : default: -1 (44100)
|
---|
300 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
301 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
302 | // FramesCount : default: -1 (= 65536)
|
---|
303 | // ChunkCount : default: -1 (= 512)
|
---|
304 | // Result : Output Index in array -1 = error
|
---|
305 | // example : OutputIndex1 := AddIntoDevOut (-1,-1,-1,-1,0,-1,-1);
|
---|
306 | function uos_AddIntoDevOut (PlayerIndex: cint32; Device: cint32; Latency: CDouble;
|
---|
307 | SampleRate: CDouble; Channels: cint32; SampleFormat: cint32;
|
---|
308 | FramesCount: cint32; ChunkCount: cint32): cint32;
|
---|
309 | {$endif}
|
---|
310 | // Add an input from audio file with default parameters
|
---|
311 | function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
312 |
|
---|
313 | // Add an input from audio file with custom parameters
|
---|
314 | // PlayerIndex : Index of an existing Player
|
---|
315 | // FileName : filename of audio file
|
---|
316 | // OutputIndex : Output index of used output
|
---|
317 | // -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
318 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
319 | // FramesCount : default: -1 (65536)
|
---|
320 | // Result : Input Index in array -1 = error
|
---|
321 | // example : InputIndex1 := uos_AddFromFile (0, edit5.Text,-1,0);
|
---|
322 | function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; SampleFormat: cint32; FramesCount: cint32): cint32;
|
---|
323 |
|
---|
324 | // Add an Output into memory buffer
|
---|
325 | // outmemory : pointer of buffer to use to store memory.
|
---|
326 | // example : OutputIndex1 := uos_AddIntoMemoryBuffer (0, pointer (bufmemory));
|
---|
327 | function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat): cint32;
|
---|
328 |
|
---|
329 | // Add an Output into memory buffer with custom parameters
|
---|
330 | // outmemory : pointer of buffer to use to store memory.
|
---|
331 | // SampleRate : default: -1 (44100)
|
---|
332 | // SampleFormat : default: -1 (0:float32) ( 1:Int32, 2:Int16)
|
---|
333 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
334 | // FramesCount : default: -1 (= 1024 * 2)
|
---|
335 | function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: longint; Channels: longint; FramesCount: longint): longint;
|
---|
336 |
|
---|
337 | // Add an Output into TMemoryStream
|
---|
338 | // MemoryStream : the TMemoryStream to use to store memory.
|
---|
339 | // SampleRate : default: -1 (44100)
|
---|
340 | // SampleFormat : default: -1 (2:Int16) ( 1:Int32, 2:Int16)
|
---|
341 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
342 | // FramesCount : default: -1 (= 4096)
|
---|
343 | // AudioFormat : default: -1 (wav) (0:wav, 1:ogg);
|
---|
344 | function uos_AddIntoMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; SampleRate: CDouble; SampleFormat: longint; Channels: longint; FramesCount: longint; Audioformat: cint32): longint;
|
---|
345 |
|
---|
346 | // Add an input from memory buffer with custom parameters
|
---|
347 | // MemoryBuffer : the buffer
|
---|
348 | // Bufferinfos : infos of the buffer
|
---|
349 | // OutputIndex : Output index of used output
|
---|
350 | // -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
351 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
352 | // SampleRate : default: -1 (44100)
|
---|
353 | // FramesCount : default: -1 (4096)
|
---|
354 | // FramesCount : default: -1 (65536 div Channels)
|
---|
355 | // Result : Input Index in array -1 = error
|
---|
356 | // example : InputIndex1 := AddFromMemoryBuffer (mybuffer, buffinfos,-1,1024);
|
---|
357 | function uos_AddFromMemoryBuffer(PlayerIndex: cint32; MemoryBuffer: TDArFloat; Bufferinfos: Tuos_bufferinfos; OutputIndex: cint32; FramesCount: cint32): cint32;
|
---|
358 |
|
---|
359 | // MemoryStream : Memory stream of encoded audio.
|
---|
360 | // TypeAudio : default: -1 --> 0 (0: flac, ogg, wav; 1: mp3; 2:opus)
|
---|
361 | // OutputIndex : Output index of used output
|
---|
362 | // -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
363 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
364 | // FramesCount : default: -1 (4096)
|
---|
365 | // Result : Input Index in array -1 = error
|
---|
366 | // example : InputIndex1 := AddFromMemoryStream (0, mymemorystream,-1,-1,0,1024);
|
---|
367 | function uos_AddFromMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32; FramesCount: cint32): cint32;
|
---|
368 |
|
---|
369 | // MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream)
|
---|
370 | // Bufferinfos : infos of the Memory-stream
|
---|
371 | // OutputIndex : Output index of used output
|
---|
372 | // -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
373 | // FramesCount : default: -1 (4096)
|
---|
374 | // Result : Input Index in array -1 = error
|
---|
375 | function uos_AddFromMemoryStreamDec(PlayerIndex: cint32; var MemoryStream: TMemoryStream; var Bufferinfos: Tuos_bufferinfos; OutputIndex: cint32; FramesCount: cint32): cint32;
|
---|
376 |
|
---|
377 | // Add an input from audio file with default parameters
|
---|
378 | function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
379 |
|
---|
380 | // Add an input from audio file and store it into memory with custom parameters
|
---|
381 | // PlayerIndex : Index of an existing Player
|
---|
382 | // FileName : filename of audio file
|
---|
383 | // OutputIndex : Output index of used output
|
---|
384 | // -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
385 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
386 | // FramesCount : default: -1 (65536)
|
---|
387 | // numbuf : number of buffer to add to outmemory (default: -1 = all, otherwise number max of buffers)
|
---|
388 | // Result : Input Index in array -1 = error
|
---|
389 | // example : InputIndex1 := uos_AddFromFile (0, edit5.Text,-1,0,-1);
|
---|
390 | function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; SampleFormat: cint32; FramesCount: cint32; numbuf: cint): cint32;
|
---|
391 |
|
---|
392 | {$IF DEFINED (shout)}
|
---|
393 | // Add an Output into an IceCast server for audio-web-streaming
|
---|
394 | // SampleRate : default: -1 (48100)
|
---|
395 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
396 | // EncodeType : default: -1 (0:Music) (0: Music, 1:Voice)
|
---|
397 | // SampleFormat : -1 default: float32 : (0:float32, 1:Int16)
|
---|
398 | // Port : default: -1 (= 8000)
|
---|
399 | // Host : default: 'def' (= '127.0.0.1')
|
---|
400 | // User : default: 'def' (= 'source')
|
---|
401 | // Password : default: 'def' (= 'hackme')
|
---|
402 | // MountFile : default: 'def' (= '/example.opus')
|
---|
403 | // Result : Output Index in array -1 = error
|
---|
404 | function uos_AddIntoIceServer (PlayerIndex: cint32; SampleRate : CDouble; Channels: cint; SampleFormat: cint;
|
---|
405 | EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: pchar; MountFile :pchar): cint32;
|
---|
406 | {$endif}
|
---|
407 |
|
---|
408 | {$IF DEFINED (webstream)}
|
---|
409 | { Function to check URL status with detailed error codes }
|
---|
410 | { Returns:
|
---|
411 | 0: URL is accessible
|
---|
412 | 1: Invalid URL format
|
---|
413 | 2: Connection timeout or network error
|
---|
414 | 3: Server error (e.g., 404, 500)
|
---|
415 | 4: Redirect not followed
|
---|
416 | 5: Other network error}
|
---|
417 | function uos_CheckURLStatus(const URL: string): Integer;
|
---|
418 |
|
---|
419 | // Add an Input from Audio URL with default parameters
|
---|
420 | function uos_AddFromURL (PlayerIndex: cint32; URL: PChar): cint32;
|
---|
421 |
|
---|
422 | // Add an Input from Audio URL with custom parameters
|
---|
423 | // URL : URL of audio file
|
---|
424 | // OutputIndex : OutputIndex of existing Output
|
---|
425 | // -1: all output, -2: no output, other cint32 : existing Output
|
---|
426 | // SampleFormat : -1 default: Int16 (0: Float32, 1:Int32, 2:Int16)
|
---|
427 | // FramesCount : default: -1 (4096)
|
---|
428 | // AudioFormat : default: -1 (auto-find) (0: mp3, 1: opus, 2:aac)
|
---|
429 | // example : InputIndex := AddFromURL (0,'http://someserver/somesound.mp3',-1,-1,-1,-1);
|
---|
430 | function uos_AddFromURL (PlayerIndex: cint32; URL: PChar; OutputIndex: cint32;
|
---|
431 | SampleFormat: cint32; FramesCount: cint32; AudioFormat: cint32; ICYon : boolean): cint32;
|
---|
432 | {$ENDIF}
|
---|
433 | // Add an Output into audio wav file with custom parameters from TFileStream
|
---|
434 | // PlayerIndex : Index of an existing Player
|
---|
435 | // FileName : filename of saved audio wav file
|
---|
436 | // SampleRate : default: -1 (44100)
|
---|
437 | // Channels : default: -1 (2:stereo) (1:mono, 2:stereo, ...)
|
---|
438 | // SampleFormat : default: -1 (2:Int16) (1:Int32, 2:Int16)
|
---|
439 | // FramesCount : default: -1 (= 65536)
|
---|
440 | // FileFormat : default: -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg);
|
---|
441 | // Result :Output Index in array -1 = error
|
---|
442 | // example : OutputIndex1 := uos_AddIntoFile (0,edit5.Text,-1,-1, 0, 1);
|
---|
443 | function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; Channels: cint32; SampleFormat: cint32; FramesCount: cint32; FileFormat: cint32): cint32;
|
---|
444 |
|
---|
445 | // Add an Output into audio wav file with Default parameters from TFileStream
|
---|
446 | // PlayerIndex : Index of an existing Player
|
---|
447 | // FileName : filename of saved audio wav file
|
---|
448 | function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
449 |
|
---|
450 | // Add an Output into audio wav file with Custom parameters from TMemoryStream
|
---|
451 | // FileName : filename of saved audio wav file
|
---|
452 | // SampleRate : default: -1 (44100)
|
---|
453 | // Channels : default: -1 (2:stereo) (1:mono, 2:stereo, ...)
|
---|
454 | // SampleFormat : -1 default: Int16 : (1:Int32, 2:Int16)
|
---|
455 | // FramesCount : -1 default: 65536 div channels
|
---|
456 | // FileFormat : default: -1 (wav) (0:wav, 1:pcm, 2:custom);
|
---|
457 | // Result : Output Index in array -1 = error
|
---|
458 | // example : OutputIndex1 := AddIntoFileFromMem (0, edit5.Text,-1,-1,0, -1);
|
---|
459 | function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; Channels: longint; SampleFormat: longint; FramesCount: longint; FileFormat: cint32): longint;
|
---|
460 |
|
---|
461 | // Add an Output into audio wav file with Default parameters from TMemoryStream
|
---|
462 | // PlayerIndex : Index of an existing Player
|
---|
463 | // FileName : filename of saved audio wav file
|
---|
464 | function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
465 |
|
---|
466 | {$IF DEFINED (portaudio)}
|
---|
467 | // Add an Input from Device Input with custom parameters
|
---|
468 | // PlayerIndex : Index of an existing Player
|
---|
469 | // Device ( -1 is default Input device )
|
---|
470 | // Latency ( -1 is latency suggested )
|
---|
471 | // SampleRate : default: -1 (44100)
|
---|
472 | // OutputIndex : Output index of used output
|
---|
473 | // -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
474 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
475 | // FramesCount : default: -1 (4096)
|
---|
476 | // ChunkCount : default: -1 (= 512)
|
---|
477 | // Result : Output Index in array
|
---|
478 | // example : OutputIndex1 := uos_AddFromDevIn (0,-1,-1,-1,-1,-1,-1);
|
---|
479 | function uos_AddFromDevIn (PlayerIndex: cint32; Device: cint32; Latency: CDouble;
|
---|
480 | SampleRate: CDouble; OutputIndex: cint32;
|
---|
481 | SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): cint32;
|
---|
482 |
|
---|
483 | // Add an Input from Device Input with default parameters
|
---|
484 | // PlayerIndex : Index of an existing Player
|
---|
485 | function uos_AddFromDevIn (PlayerIndex: cint32): cint32;
|
---|
486 | {$endif}
|
---|
487 | // Add an input from Endless Muted dummy sine wav
|
---|
488 | // FramesCount = FramesCount of input-to-follow
|
---|
489 | // Channels = Channels of input-to-follow.
|
---|
490 | function uos_AddFromEndlessMuted(PlayerIndex: cint32; Channels: cint32; FramesCount: cint32): cint32;
|
---|
491 |
|
---|
492 | {$IF DEFINED (synthesizer)}
|
---|
493 | // Add an input from Synthesizer with custom parameters
|
---|
494 | // Channels: default: -1 (2) (1 = mono, 2 = stereo)
|
---|
495 | // WaveTypeL: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for mono and stereo)
|
---|
496 | // WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for stereo, ignored for mono)
|
---|
497 | // FrequencyL: default: -1 (440 htz) (Left frequency, used for mono)
|
---|
498 | // FrequencyR: default: -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
|
---|
499 | // VolumeL: default: -1 (= 1) (from 0 to 1) => volume left
|
---|
500 | // VolumeR: default: -1 (= 1) (from 0 to 1) => volume rigth (ignored for mono)
|
---|
501 | // Duration: default: -1 (= 1000) => duration in msec (0 = endless)
|
---|
502 | // NbHarmonics: default: -1 (= 0) Number of Harmonics
|
---|
503 | // EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics)
|
---|
504 | // OutputIndex: Output index of used output
|
---|
505 | // -1: all output, -2: no output, other cint32 refer to
|
---|
506 | // an existing OutputIndex
|
---|
507 | // (if multi-output then OutName = name of each output separeted by ';')
|
---|
508 | // SampleFormat: default: -1 (0: Float32) (0: Float32, 1:Int32, 2:Int16)
|
---|
509 | // SampleRate: default: -1 (44100)
|
---|
510 | // FramesCount: -1 default: 1024
|
---|
511 | // Result: Input Index in array -1 = error
|
---|
512 | function uos_AddFromSynth (PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: shortint;
|
---|
513 | FrequencyL, FrequencyR: float; VolumeL, VolumeR: float;
|
---|
514 | duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32;
|
---|
515 | OutputIndex: cint32; SampleFormat: cint32; SampleRate: CDouble; FramesCount : cint32): cint32;
|
---|
516 |
|
---|
517 | // InputIndex: one existing input index
|
---|
518 | // WaveTypeL: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for mono and stereo)
|
---|
519 | // WaveTypeR: default: -1 (0) (00 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for stereo, ignored for mono)
|
---|
520 | // FrequencyL: do not change: -1 (Left frequency, used for mono)
|
---|
521 | // FrequencyR: do not change: -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
|
---|
522 | // VolumeL: do not change: -1 (= 1) (from 0 to 1) => volume left
|
---|
523 | // VolumeR: do not change: -1 (from 0 to 1) => volume rigth (ignored for mono)
|
---|
524 | // Duration: in msec (-1 = do not change)
|
---|
525 | // NbHarmonic: Number of Harmonics (-1 not change)
|
---|
526 | // EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics)
|
---|
527 | // Enable: true or false;
|
---|
528 | procedure uos_InputSetSynth (PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: shortint;
|
---|
529 | FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration: cint32;
|
---|
530 | NbHarmonic: cint32; EvenHarmonics: cint32; Enable: boolean);
|
---|
531 | {$endif}
|
---|
532 | // Assign the procedure of object to execute at begining, before loop
|
---|
533 | // PlayerIndex : Index of an existing Player
|
---|
534 | // InIndex : Index of an existing Input
|
---|
535 | procedure uos_BeginProc(PlayerIndex: cint32; Proc: TProc);
|
---|
536 |
|
---|
537 | // Assign the procedure of object to execute at end, after loop
|
---|
538 | // PlayerIndex : Index of an existing Player
|
---|
539 | // InIndex : Index of an existing Input
|
---|
540 | procedure uos_EndProc(PlayerIndex: cint32; Proc: TPlayerProc);
|
---|
541 |
|
---|
542 | // Assign the procedure (not of object) to execute at end, after loop
|
---|
543 | // PlayerIndex : Index of an existing Player
|
---|
544 | // InIndex : Index of an existing Input
|
---|
545 | procedure uos_EndProcOnly(PlayerIndex: cint32; Proc: TProconly);
|
---|
546 |
|
---|
547 | // Assign the procedure of object to execute at begin of loop
|
---|
548 | // PlayerIndex : Index of an existing Player
|
---|
549 | // InIndex : Index of an existing Input
|
---|
550 | procedure uos_LoopBeginProc(PlayerIndex: cint32; Proc: TProc);
|
---|
551 |
|
---|
552 | // Assign the procedure of object to execute at end of loop
|
---|
553 | // PlayerIndex : Index of an existing Player
|
---|
554 | // InIndex : Index of an existing Input
|
---|
555 | procedure uos_LoopEndProc(PlayerIndex: cint32; Proc: TProc);
|
---|
556 |
|
---|
557 | // Assign the procedure of object to execute inside the loop
|
---|
558 | // PlayerIndex : Index of an existing Player
|
---|
559 | // InIndex : Index of an existing Input
|
---|
560 | procedure uos_LoopProcIn(PlayerIndex: cint32; InIndex: cint32; Proc: TProc);
|
---|
561 |
|
---|
562 | // Assign the procedure of object to execute inside the loop
|
---|
563 | // PlayerIndex : Index of an existing Player
|
---|
564 | // OutIndex : Index of an existing Output
|
---|
565 | procedure uos_LoopProcOut(PlayerIndex: cint32; OutIndex: cint32; Proc: TProc);
|
---|
566 |
|
---|
567 | {$IF DEFINED (noiseremoval)}
|
---|
568 | procedure uos_InputAddDSPNoiseRemoval (PlayerIndex: cint32; InputIndex: cint32);
|
---|
569 |
|
---|
570 | procedure uos_InputSetDSPNoiseRemoval (PlayerIndex: cint32; InputIndex: cint32; Enable: boolean);
|
---|
571 |
|
---|
572 | procedure uos_OutputAddDSPNoiseRemoval (PlayerIndex: cint32; OutputIndex: cint32);
|
---|
573 |
|
---|
574 | procedure uos_OutputSetDSPNoiseRemoval (PlayerIndex: cint32; OutputIndex: cint32; Enable: boolean);
|
---|
575 | {$endif}
|
---|
576 |
|
---|
577 | // Convert mono 1 channel input to stereo 2 channels input.
|
---|
578 | // Works only if the input is mono 1 channel othewise stereo 2 chan is keeped.
|
---|
579 | // InputIndex : InputIndex of an existing Input
|
---|
580 | // Result : index of DSPIn in array
|
---|
581 | // example DSPIndex1 := InputAddDSP1ChanTo2Chan (InputIndex1);
|
---|
582 | function uos_InputAddDSP1ChanTo2Chan(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
583 |
|
---|
584 | // DSP Volume changer
|
---|
585 | // PlayerIndex : Index of an existing Player
|
---|
586 | // InputIndex : InputIndex of an existing Input
|
---|
587 | // VolLeft : Left volume
|
---|
588 | // VolRight : Right volume
|
---|
589 | // Result : index of DSPIn in array
|
---|
590 | // example uos_InputAddDSPVolume (0,InputIndex1,1,1);
|
---|
591 | function uos_InputAddDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; VolRight: double): cint32;
|
---|
592 |
|
---|
593 | // DSP Volume changer
|
---|
594 | // PlayerIndex : Index of an existing Player
|
---|
595 | // OutputIndex : OutputIndex of an existing Output
|
---|
596 | // VolLeft : Left volume
|
---|
597 | // VolRight : Right volume
|
---|
598 | // Result : -1 nothing created, otherwise index of DSPIn in array
|
---|
599 | // example DSPIndex1 := uos_OutputAddDSPVolume (0,oututIndex1,1,1);
|
---|
600 | function uos_OutputAddDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; VolRight: double): cint32;
|
---|
601 |
|
---|
602 | // InputIndex : InputIndex of an existing Input
|
---|
603 | // PlayerIndex : Index of an existing Player
|
---|
604 | // VolLeft : Left volume
|
---|
605 | // VolRight : Right volume
|
---|
606 | // Enable : Enabled
|
---|
607 | // example uos_InputSetDSPVolume (0,InputIndex1,DSPIndex1,1,0.8,True);
|
---|
608 | procedure uos_InputSetDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; VolRight: double; Enable: Boolean);
|
---|
609 |
|
---|
610 | // OutputIndex : OutputIndex of an existing Output
|
---|
611 | // PlayerIndex : Index of an existing Player
|
---|
612 | // VolLeft : Left volume
|
---|
613 | // VolRight : Right volume
|
---|
614 | // Enable : Enabled
|
---|
615 | // example uos_OutputSetDSPVolume (0,outputIndex1,DSPIndex1,1,0.8,True);
|
---|
616 | procedure uos_OutputSetDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; VolRight: double; Enable: Boolean);
|
---|
617 |
|
---|
618 | // add a DSP procedure for input
|
---|
619 | // PlayerIndex : Index of an existing Player
|
---|
620 | // InputIndex : Input Index of an existing input
|
---|
621 | // BeforeFunc : Function to do before the buffer is filled
|
---|
622 | // AfterFunc : Function to do after the buffer is filled
|
---|
623 | // EndedFunc : Function to do at end of thread
|
---|
624 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
625 | // Result : -1 nothing created, otherwise index of DSPin in array (DSPinIndex)
|
---|
626 | // example : DSPinIndex1 := uos_InputAddDSP (0,InputIndex1,@beforereverse,@afterreverse,nil);
|
---|
627 | function uos_InputAddDSP(PlayerIndex: cint32; InputIndex: cint32; BeforeFunc: TFunc; AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32;
|
---|
628 |
|
---|
629 | // PlayerIndex : Index of an existing Player
|
---|
630 | // InputIndex : Input Index of an existing input
|
---|
631 | // DSPIndexIn : DSP Index of an existing DSP In
|
---|
632 | // Enable : DSP enabled
|
---|
633 | // example : uos_InputSetDSP (0,InputIndex1,DSPinIndex1,True);
|
---|
634 | procedure uos_InputSetDSP(PlayerIndex: cint32; InputIndex: cint32; DSPinIndex: cint32; Enable: Boolean);
|
---|
635 |
|
---|
636 | // useful if multi output
|
---|
637 | // PlayerIndex : Index of an existing Player
|
---|
638 | // OutputIndex : OutputIndex of an existing Output
|
---|
639 | // BeforeFunc : Function to do before the buffer is filled
|
---|
640 | // AfterFunc : Function to do after the buffer is filled just before to give to output
|
---|
641 | // EndedFunc : Function to do at end of thread
|
---|
642 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
643 | // Result : index of DSPout in array
|
---|
644 | // example :DSPoutIndex1 := uos_OutputAddDSP (0,OutputIndex1,nil,@volumeproc,nil,nil);
|
---|
645 | function uos_OutputAddDSP(PlayerIndex: cint32; OutputIndex: cint32; BeforeFunc: TFunc; AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32;
|
---|
646 |
|
---|
647 | // PlayerIndex : Index of an existing Player
|
---|
648 | // OutputIndex : OutputIndex of an existing Output
|
---|
649 | // DSPoutIndex : DSPoutIndex of existing DSPout
|
---|
650 | // Enable : DSP enabled
|
---|
651 | // example : uos_OutputSetDSP (0,OutputIndex1,DSPoutIndex1,True);
|
---|
652 | procedure uos_OutputSetDSP(PlayerIndex: cint32; OutputIndex: cint32; DSPoutIndex: cint32; Enable: Boolean);
|
---|
653 |
|
---|
654 | // InputIndex : InputIndex of an existing Input
|
---|
655 | // TypeFilterL: Type of filter left:
|
---|
656 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
657 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
658 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
659 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
660 | // GainL : gain left to apply to filter
|
---|
661 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
662 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
663 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
664 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
665 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
666 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
667 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
668 | // Result : index of DSPIn in array
|
---|
669 | function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc): cint32;
|
---|
670 |
|
---|
671 | // Get current buffer
|
---|
672 | function uos_InputGetBuffer(PlayerIndex: cint32; InputIndex: cint32): TDArFloat;
|
---|
673 |
|
---|
674 | // InputIndex : InputIndex of an existing Input
|
---|
675 | // DSPInIndex : DSPInIndex of existing DSPIn
|
---|
676 | // TypeFilterL: Type of filter left:
|
---|
677 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
678 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
679 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
680 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
681 | // GainL : gain left to apply to filter
|
---|
682 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
683 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
684 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
685 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
686 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
687 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
688 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
689 | // Enable : Filter enabled
|
---|
690 | procedure uos_InputSetFilter(PlayerIndex: cint32; InputIndex: cint32; FilterIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint;
|
---|
691 | LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc; Enable: Boolean);
|
---|
692 |
|
---|
693 | // Output : InputIndex of an existing Output
|
---|
694 | // TypeFilterL: Type of filter left:
|
---|
695 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
696 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
697 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
698 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
699 | // GainL : gain left to apply to filter
|
---|
700 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
701 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
702 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
703 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
704 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
705 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
706 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
707 | // Result : index of DSPIn in array
|
---|
708 | function uos_OutputAddFilter(PlayerIndex: cint32; OutputIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc): cint32;
|
---|
709 |
|
---|
710 | // OuputIndex : InputIndex of an existing Output
|
---|
711 | // DSPInIndex : DSPInIndex of existing DSPIn
|
---|
712 | // TypeFilterL: Type of filter left:
|
---|
713 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
714 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
715 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
716 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
717 | // GainL : gain left to apply to filter
|
---|
718 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
719 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
720 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
721 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
722 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
723 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
724 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
725 | // Enable : Filter enabled
|
---|
726 | procedure uos_OutputSetFilter(PlayerIndex: cint32; OutputIndex: cint32; FilterIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint;
|
---|
727 | LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc; Enable: Boolean);
|
---|
728 |
|
---|
729 | // Add a plugin , Result is PluginIndex
|
---|
730 | // PlayerIndex : Index of an existing Player
|
---|
731 | // SampleRate : default: -1 (44100)
|
---|
732 | // Channels : default: -1 (2:stereo) (1:mono, 2:stereo, ...)
|
---|
733 | // 'soundtouch' and 'bs2b' PlugName is registred.
|
---|
734 | function uos_AddPlugin(PlayerIndex: cint32; PlugName: PChar; SampleRate: CDouble; Channels: cint32): cint32;
|
---|
735 |
|
---|
736 | {$IF DEFINED (soundtouch)}
|
---|
737 | // PluginIndex : PluginIndex Index of an existing Plugin.
|
---|
738 | // PlayerIndex : Index of an existing Player
|
---|
739 | procedure uos_SetPluginSoundTouch (PlayerIndex: cint32; PluginIndex: cint32; Tempo: cfloat;
|
---|
740 | Pitch: cfloat; Enable: boolean);
|
---|
741 |
|
---|
742 | // PluginIndex : PluginIndex Index of an existing Plugin.
|
---|
743 | // numofframes: number of frames to analyse (-1 = 512 x frames)
|
---|
744 | // loop: do new detection after previous.
|
---|
745 | procedure uos_SetPluginGetBPM (PlayerIndex: cint32; PluginIndex: cint32; numofframes: integer; loop : boolean;
|
---|
746 | Enable: boolean);
|
---|
747 | {$endif}
|
---|
748 | {$IF DEFINED (bs2b)}
|
---|
749 | // PluginIndex : PluginIndex Index of an existing Plugin.
|
---|
750 | procedure uos_SetPluginBs2b (PlayerIndex: cint32; PluginIndex: cint32;
|
---|
751 | level: CInt32; fcut: CInt32; feed: CInt32; Enable: boolean);
|
---|
752 | {$endif}
|
---|
753 | // Get the status of the player : -1 => error, 0 => has stopped, 1 => is running, 2 => is paused.
|
---|
754 | function uos_GetStatus(PlayerIndex: cint32): cint32;
|
---|
755 |
|
---|
756 | // change position in sample
|
---|
757 | procedure uos_InputSeek(PlayerIndex: cint32; InputIndex: cint32; pos: Tcount_t);
|
---|
758 |
|
---|
759 | // change position in seconds
|
---|
760 | procedure uos_InputSeekSeconds(PlayerIndex: cint32; InputIndex: cint32; pos: cfloat);
|
---|
761 |
|
---|
762 | // change position in time format
|
---|
763 | procedure uos_InputSeekTime(PlayerIndex: cint32; InputIndex: cint32; pos: TTime);
|
---|
764 |
|
---|
765 | // set enable true or false (useful for multi input)
|
---|
766 | procedure uos_InputSetEnable(PlayerIndex: cint32; InputIndex: cint32; Enabled: Boolean);
|
---|
767 |
|
---|
768 | // set enable true or false (useful for multi outputput)
|
---|
769 | procedure uos_OutputSetEnable(PlayerIndex: cint32; OutputIndex: cint32; Enabled: Boolean);
|
---|
770 |
|
---|
771 | // InputIndex : InputIndex of existing input
|
---|
772 | // Result : Length of Input in samples
|
---|
773 | function uos_InputLength(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
774 |
|
---|
775 | // InputIndex : InputIndex of existing input
|
---|
776 | // Result : Length of Input in seconds
|
---|
777 | function uos_InputLengthSeconds(PlayerIndex: cint32; InputIndex: cint32): cfloat;
|
---|
778 |
|
---|
779 | // InputIndex : InputIndex of existing input
|
---|
780 | // Result : Length of Input in time format
|
---|
781 | function uos_InputLengthTime(PlayerIndex: cint32; InputIndex: cint32): TTime;
|
---|
782 |
|
---|
783 | // InputIndex : InputIndex of existing input
|
---|
784 | // Result : current postion in sample
|
---|
785 | function uos_InputPosition(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
786 |
|
---|
787 | // set number of frames to be done. (useful for recording and level precision)
|
---|
788 | procedure uos_InputSetFrameCount(PlayerIndex: cint32; InputIndex: cint32; framecount: cint32);
|
---|
789 |
|
---|
790 | // set level calculation (default is 0)
|
---|
791 | // InputIndex : InputIndex of existing input
|
---|
792 | // 0 => no calcul
|
---|
793 | // 1 => calcul before all DSP procedures.
|
---|
794 | // 2 => calcul after all DSP procedures.
|
---|
795 | // 3 => calcul before and after all DSP procedures.
|
---|
796 | procedure uos_InputSetLevelEnable(PlayerIndex: cint32; InputIndex: cint32; enable: cint32);
|
---|
797 |
|
---|
798 | // set position calculation (default is 1)
|
---|
799 | // InputIndex : InputIndex of existing input
|
---|
800 | // 0 => no calcul
|
---|
801 | // 1 => calcul position.
|
---|
802 | procedure uos_InputSetPositionEnable(PlayerIndex: cint32; InputIndex: cint32; enable: cint32);
|
---|
803 |
|
---|
804 | // set add level calculation in level-array (default is 0)
|
---|
805 | // 0 => no calcul
|
---|
806 | // 1 => calcul before all DSP procedures.
|
---|
807 | // 2 => calcul after all DSP procedures.
|
---|
808 | procedure uos_InputSetLevelArrayEnable(PlayerIndex: cint32; InputIndex: cint32; levelcalc: cint32);
|
---|
809 |
|
---|
810 | function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat;
|
---|
811 |
|
---|
812 | // InputIndex : InputIndex of existing input
|
---|
813 | // Result : left level (volume) from 0 to 1
|
---|
814 | function uos_InputGetLevelLeft(PlayerIndex: cint32; InputIndex: cint32): double;
|
---|
815 |
|
---|
816 | // InputIndex : InputIndex of existing input
|
---|
817 | // Result : right level (volume) from 0 to 1
|
---|
818 | function uos_InputGetLevelRight(PlayerIndex: cint32; InputIndex: cint32): double;
|
---|
819 |
|
---|
820 | // set level calculation (default is 0)
|
---|
821 | // OutputIndex : InputIndex of existing output
|
---|
822 | // 0 => no calcul
|
---|
823 | // 1 => calcul before all DSP procedures.
|
---|
824 | // 2 => calcul after all DSP procedures.
|
---|
825 | procedure uos_OutputSetLevelEnable(PlayerIndex: cint32; OutputIndex: cint32; enable: cint32);
|
---|
826 |
|
---|
827 | // OutputIndex : OutputIndex of existing Output
|
---|
828 | // Result : left level (volume) from 0 to 1
|
---|
829 | function uos_OutputGetLevelLeft(PlayerIndex: cint32; OutputIndex: cint32): double;
|
---|
830 |
|
---|
831 | // OutputIndex : OutputIndex of existing Output
|
---|
832 | // Result : right level (volume) from 0 to 1
|
---|
833 | function uos_OutputGetLevelRight(PlayerIndex: cint32; OutputIndex: cint32): double;
|
---|
834 |
|
---|
835 | // InputIndex : InputIndex of existing input
|
---|
836 | // Result : list of left|right levels separed by $ character
|
---|
837 | function uos_InputFiltersGetLevelString(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
838 |
|
---|
839 | // InputIndex : InputIndex of existing input
|
---|
840 | // Result : array of float of each filter.
|
---|
841 | //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,...
|
---|
842 | function uos_InputFiltersGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat;
|
---|
843 |
|
---|
844 | {$IF DEFINED (soundtouch)}
|
---|
845 | // InputIndex : InputIndex of existing input
|
---|
846 | // Result : Beats per minuts
|
---|
847 | function uos_InputGetBPM (PlayerIndex: cint32; InputIndex: cint32): CDouble;
|
---|
848 | {$endif}
|
---|
849 | // InputIndex : InputIndex of existing input
|
---|
850 | // Result : current postion of Input in seconds
|
---|
851 | function uos_InputPositionSeconds(PlayerIndex: cint32; InputIndex: cint32): float;
|
---|
852 |
|
---|
853 | // InputIndex : InputIndex of existing input
|
---|
854 | // Result : current postion of Input in time format
|
---|
855 | function uos_InputPositionTime(PlayerIndex: cint32; InputIndex: cint32): TTime;
|
---|
856 |
|
---|
857 | // for mp3 and opus files only
|
---|
858 | function uos_InputUpdateTag(PlayerIndex: cint32; InputIndex: cint32): Boolean;
|
---|
859 |
|
---|
860 | {$IF DEFINED (webstream) and DEFINED (mpg123)}
|
---|
861 | // for mp3 only
|
---|
862 | function uos_InputUpdateICY (PlayerIndex: cint32; InputIndex: cint32; var icy_data : pchar): integer;
|
---|
863 | {$endif}
|
---|
864 |
|
---|
865 | {$IF DEFINED (webstream)}
|
---|
866 | // Type of audio of url stream, 0:mp3, 1:opus, 2:acc
|
---|
867 | function uos_InputGetURLAudioType(PlayerIndex: cint32; InputIndex: cint32): integer;
|
---|
868 | function uos_InputGetURLContentType(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
869 | function uos_InputGetURLiceAudioInfo(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
870 | function uos_InputGetURLicyDescription(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
871 | function uos_InputGetURLicyGenre(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
872 | function uos_InputGetURLicyName(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
873 | function uos_InputGetURLicyUrl(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
874 | {$endif}
|
---|
875 | // Tag infos
|
---|
876 | function uos_InputGetTagTitle(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
877 | function uos_InputGetTagArtist(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
878 | function uos_InputGetTagAlbum(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
879 | function uos_InputGetTagDate(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
880 | function uos_InputGetTagComment(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
881 | function uos_InputGetTagTag(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
882 | function uos_InputGetTagTrack(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
883 | function uos_InputGetTagGenre(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
884 |
|
---|
885 | // InputIndex : InputIndex of existing input
|
---|
886 | // Result : default sample rate
|
---|
887 | function uos_InputGetSampleRate(PlayerIndex: cint32; InputIndex: cint32): CDouble;
|
---|
888 |
|
---|
889 | // InputIndex : InputIndex of existing input
|
---|
890 | // Result : default channels
|
---|
891 | function uos_InputGetChannels(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
892 |
|
---|
893 | // InputIndex : InputIndex of existing input
|
---|
894 | // Result : library used: 0: sndfile, 1:mpg123, aac:2, 3:cdrom 4:opus, 5:xmp
|
---|
895 | function uos_InputGetLibUsed(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
896 |
|
---|
897 | // Start playing with free at end as parameter and assign loop
|
---|
898 | procedure uos_PlayEx(PlayerIndex: cint32; no_free: Boolean; nloop: integer; paused: Boolean = False);
|
---|
899 |
|
---|
900 | // Start playing
|
---|
901 | procedure uos_Play(PlayerIndex: cint32; nloop: integer = 0);
|
---|
902 |
|
---|
903 | // Start play paused with loop
|
---|
904 | procedure uos_PlayPaused(PlayerIndex: cint32; nloop: integer = 0);
|
---|
905 |
|
---|
906 | // Start playing but do not free the player after stop
|
---|
907 | procedure uos_PlayNoFree(PlayerIndex: cint32; nloop: integer = 0);
|
---|
908 |
|
---|
909 | // Start play paused with loop but not free player at end
|
---|
910 | procedure uos_PlayNoFreePaused(PlayerIndex: cint32; nloop: integer = 0);
|
---|
911 |
|
---|
912 | // Works only when PlayNoFree () was used: free the player
|
---|
913 | procedure uos_FreePlayer(PlayerIndex: cint32);
|
---|
914 |
|
---|
915 | // Resume playing after pause
|
---|
916 | procedure uos_RePlay(PlayerIndex: cint32);
|
---|
917 |
|
---|
918 | // Stop playing and free thread
|
---|
919 | procedure uos_Stop(PlayerIndex: cint32);
|
---|
920 |
|
---|
921 | // Pause playing
|
---|
922 | procedure uos_Pause(PlayerIndex: cint32);
|
---|
923 |
|
---|
924 | // version of uos
|
---|
925 | function uos_GetVersion(): cint32;
|
---|
926 |
|
---|
927 | // Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event))
|
---|
928 | // Result : true if set ok.
|
---|
929 | function uos_SetGlobalEvent(PlayerIndex: cint32; isenabled: Boolean): Boolean;
|
---|
930 |
|
---|
931 | {$IF DEFINED (soundtouch)}
|
---|
932 | // From SoundTouch plugin
|
---|
933 | function uos_GetBPM (TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble;
|
---|
934 | {$endif}
|
---|
935 | // Create a memory buffer of an audio file.
|
---|
936 | // FileName : filename of audio file
|
---|
937 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
938 | // bufferinfos : the infos of the buffer.
|
---|
939 | // frompos : from position (default: -1 = from begining, otherwise position in song)
|
---|
940 | // numbuf : number of frames to add to outmemory (default: -1 = all, otherwise number max of frames)
|
---|
941 | // Result : The memory buffer
|
---|
942 | // example : buffmem := uos_File2buffer (edit5.Text,0,buffmem, buffinfos, -1, -1);
|
---|
943 | function uos_File2Buffer(Filename: PChar; SampleFormat: cint32; var bufferinfos: Tuos_BufferInfos; frompos: cint; numbuf: cint): TDArFloat;
|
---|
944 |
|
---|
945 | // Create a memory buffer of an audio file.
|
---|
946 | // FileName : filename of audio file
|
---|
947 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
948 | // Outmemory : the buffer to store data.
|
---|
949 | // bufferinfos : the infos of the buffer.
|
---|
950 | // frompos : from position (default: -1 = from begining, otherwise position in song)
|
---|
951 | // numbuf : number of frames to add to outmemory (default: -1 = all, otherwise number max frames of buffers)
|
---|
952 | // Result : The memory buffer
|
---|
953 | // example : buffmem := uos_Stream2Buffer (edit5.Text,0,buffmem, buffinfos, -1, -1);
|
---|
954 | function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32; var outmemory: TDArFloat; var bufferinfos: Tuos_BufferInfos; frompos: cint; numbuf: cint): TDArFloat;
|
---|
955 |
|
---|
956 | // Create an audio file from an audio file.
|
---|
957 | // FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...)
|
---|
958 | // FileNameOUT : filename of audio file OUT (wav, pcm, custom)
|
---|
959 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
960 | // typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom)
|
---|
961 | // example : InputIndex1 := uos_File2File (edit5.Text,0,buffmem);
|
---|
962 | procedure uos_File2File(FilenameIN: PChar; FilenameOUT: PChar; SampleFormat: cint32; typeout: cint32);
|
---|
963 |
|
---|
964 | // Create an audio wav file from a TMemoryStream.
|
---|
965 | // FileName : filename of wav saved file
|
---|
966 | // data : the memorystream
|
---|
967 | // BitsPerSample : 16 or 32 (bit)
|
---|
968 | // chan : number of channels
|
---|
969 | // samplerate : sample rate
|
---|
970 | procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan: integer; samplerate: CDouble);
|
---|
971 |
|
---|
972 | // to initialize a custom bufferinfos: needed for AddFromMemoryBuffer () if no bufferinfos was created.
|
---|
973 | // all infos refer to the buffer used ---> length = length of the buffer div channels.
|
---|
974 | procedure uos_CustBufferInfos(var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat: cint32; Channels: cint32; Length: cint32);
|
---|
975 |
|
---|
976 | var
|
---|
977 | uosDeviceInfos: array of Tuos_DeviceInfos;
|
---|
978 | uosLoadResult: Tuos_LoadResult;
|
---|
979 | uosDeviceCount: cint32;
|
---|
980 | uosDefaultDeviceIn: cint32;
|
---|
981 | uosDefaultDeviceOut: cint32;
|
---|
982 | //firstload : boolean = true;
|
---|
983 |
|
---|
984 | implementation
|
---|
985 |
|
---|
986 | function PlayersNotFree: Boolean;
|
---|
987 | var
|
---|
988 | i: integer;
|
---|
989 | begin
|
---|
990 | if uosPlayersStat <> nil then
|
---|
991 | for i := 0 to Length(uosPlayersStat) - 1 do
|
---|
992 | if uosPlayersStat[i] <> -1 then
|
---|
993 | begin
|
---|
994 | Result := True;
|
---|
995 | Exit;
|
---|
996 | end;
|
---|
997 | Result := False;
|
---|
998 | end;
|
---|
999 |
|
---|
1000 | function PlayerNotFree(indexplayer: integer): Boolean;
|
---|
1001 | begin
|
---|
1002 | if uosPlayersStat <> nil then
|
---|
1003 | if uosPlayersStat[indexplayer] <> -1 then
|
---|
1004 | begin
|
---|
1005 | Result := True;
|
---|
1006 | Exit;
|
---|
1007 | end;
|
---|
1008 | Result := False;
|
---|
1009 | end;
|
---|
1010 |
|
---|
1011 | {$IF DEFINED (noiseremoval)}
|
---|
1012 | procedure uos_InputAddDSPNoiseRemoval (PlayerIndex: cint32; InputIndex: cint32);
|
---|
1013 | begin
|
---|
1014 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1015 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1016 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1017 | uosPlayers[PlayerIndex].StreamIn[InputIndex].data.DSPNoiseIndex :=
|
---|
1018 | uosPlayers[PlayerIndex].InputAddDSPNoiseRemoval (InputIndex);
|
---|
1019 | end;
|
---|
1020 |
|
---|
1021 | procedure uos_InputSetDSPNoiseRemoval (PlayerIndex: cint32; InputIndex: cint32; Enable: boolean);
|
---|
1022 | begin
|
---|
1023 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1024 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1025 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1026 | uosPlayers[PlayerIndex].InputSetDSPNoiseRemoval (InputIndex, Enable);
|
---|
1027 | end;
|
---|
1028 |
|
---|
1029 | procedure uos_OutputAddDSPNoiseRemoval (PlayerIndex: cint32; OutputIndex: cint32);
|
---|
1030 | begin
|
---|
1031 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1032 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1033 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1034 | uosPlayers[PlayerIndex].StreamOut[OutputIndex].data.DSPNoiseIndex :=
|
---|
1035 | uosPlayers[PlayerIndex].OutputAddDSPNoiseRemoval (OutputIndex);
|
---|
1036 | end;
|
---|
1037 |
|
---|
1038 | procedure uos_OutputSetDSPNoiseRemoval (PlayerIndex: cint32; OutputIndex: cint32; Enable: boolean);
|
---|
1039 | begin
|
---|
1040 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1041 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1042 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1043 | uosPlayers[PlayerIndex].OutputSetDSPNoiseRemoval (OutputIndex, Enable);
|
---|
1044 | end;
|
---|
1045 | {$endif}
|
---|
1046 |
|
---|
1047 | function uos_SetGlobalEvent(PlayerIndex: cint32; isenabled: Boolean): Boolean;
|
---|
1048 | // Set the RTL Events Global (will pause/start/replay all the players synchro with same rtl event))
|
---|
1049 | // Result : true if set ok.
|
---|
1050 | begin
|
---|
1051 | Result := False;
|
---|
1052 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1053 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1054 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1055 | Result := uosPlayers[PlayerIndex].SetGlobalEvent(isenabled);
|
---|
1056 | end;
|
---|
1057 |
|
---|
1058 | function uos_InputAddDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; VolRight: double): cint32;
|
---|
1059 | begin
|
---|
1060 | Result := -1;
|
---|
1061 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1062 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1063 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1064 | begin
|
---|
1065 | uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex := uosPlayers[PlayerIndex].InputAddDSPVolume(InputIndex, VolLeft, VolRight);
|
---|
1066 | Result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex;
|
---|
1067 | end;
|
---|
1068 | end;
|
---|
1069 | // DSP Volume changer
|
---|
1070 | // PlayerIndex : Index of an existing Player
|
---|
1071 | // InputIndex : InputIndex of an existing Input
|
---|
1072 | // VolLeft : Left volume
|
---|
1073 | // VolRight : Right volume
|
---|
1074 | // Result : -1 nothing created, otherwise index of DSPIn in array
|
---|
1075 | // example DSPIndex1 := uos_InputAddDSPVolume (0,InputIndex1,1,1);
|
---|
1076 |
|
---|
1077 | function uos_OutputAddDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; VolRight: double): cint32;
|
---|
1078 | begin
|
---|
1079 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1080 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1081 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1082 | begin
|
---|
1083 | uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex := uosPlayers[PlayerIndex].OutputAddDSPVolume(OutputIndex, VolLeft, VolRight);
|
---|
1084 | Result := uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex;
|
---|
1085 | end;
|
---|
1086 | end;
|
---|
1087 | // DSP Volume changer
|
---|
1088 | // PlayerIndex : Index of an existing Player
|
---|
1089 | // OutputIndex : OutputIndex of an existing Output
|
---|
1090 | // VolLeft : Left volume
|
---|
1091 | // VolRight : Right volume
|
---|
1092 | // Result : -1 nothing created, otherwise index of DSPIn in array
|
---|
1093 | // example DSPIndex1 := uos_OutputAddDSPVolume (0,InputIndex1,1,1);
|
---|
1094 |
|
---|
1095 | procedure uos_InputSetDSPVolume(PlayerIndex: cint32; InputIndex: cint32; VolLeft: double; VolRight: double; Enable: Boolean);
|
---|
1096 | begin
|
---|
1097 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1098 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1099 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1100 | uosPlayers[PlayerIndex].InputSetDSPVolume(InputIndex, uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.DSPVolumeIndex, VolLeft, VolRight, Enable);
|
---|
1101 | end;
|
---|
1102 | // InputIndex : InputIndex of an existing Input
|
---|
1103 | // PlayerIndex : Index of an existing Player
|
---|
1104 | // VolLeft : Left volume
|
---|
1105 | // VolRight : Right volume
|
---|
1106 | // Enable : Enabled
|
---|
1107 | // example uos_InputSetDSPVolume (0,InputIndex1,1,0.8,True);
|
---|
1108 |
|
---|
1109 | procedure uos_OutputSetDSPVolume(PlayerIndex: cint32; OutputIndex: cint32; VolLeft: double; VolRight: double; Enable: Boolean);
|
---|
1110 | begin
|
---|
1111 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1112 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1113 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1114 | uosPlayers[PlayerIndex].OutputSetDSPVolume(OutputIndex, uosPlayers[PlayerIndex].StreamOut[OutputIndex].Data.DSPVolumeIndex, VolLeft, VolRight, Enable);
|
---|
1115 | end;
|
---|
1116 | // OutputIndex : OutputIndex of an existing Output
|
---|
1117 | // PlayerIndex : Index of an existing Player
|
---|
1118 | // VolLeft : Left volume
|
---|
1119 | // VolRight : Right volume
|
---|
1120 | // Enable : Enabled
|
---|
1121 | // example uos_OutputSetDSPVolume (0,InputIndex1,1,0.8,True);
|
---|
1122 |
|
---|
1123 | {$IF DEFINED (webstream) and DEFINED (mpg123)}
|
---|
1124 | function uos_InputUpdateICY (PlayerIndex: cint32; InputIndex: cint32; var icy_data : pchar): integer;
|
---|
1125 | // for mp3 only
|
---|
1126 | begin
|
---|
1127 | Result := -1;
|
---|
1128 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1129 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1130 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1131 | Result := uosPlayers[PlayerIndex].InputUpdateICY(InputIndex, icy_data);
|
---|
1132 | end;
|
---|
1133 | {$endif}
|
---|
1134 |
|
---|
1135 | {$IF DEFINED (webstream)}
|
---|
1136 | function uos_CheckURLStatus(const URL: string): Integer;
|
---|
1137 | begin
|
---|
1138 | Result := uos.uos_CheckURLStatus(URL);
|
---|
1139 | end;
|
---|
1140 |
|
---|
1141 | // Type of audio of url stream, 0:mp3, 1:opus, 2:acc
|
---|
1142 | function uos_InputGetURLAudioType(PlayerIndex: cint32; InputIndex: cint32): integer;
|
---|
1143 | // for mp3 only
|
---|
1144 | begin
|
---|
1145 | Result := -1;
|
---|
1146 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1147 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1148 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1149 | Result := uosPlayers[PlayerIndex].InputGetURLAudioType(InputIndex);
|
---|
1150 | end;
|
---|
1151 |
|
---|
1152 | function uos_InputGetURLContentType(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
1153 | begin
|
---|
1154 | Result := '';
|
---|
1155 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1156 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1157 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1158 | Result := uosPlayers[PlayerIndex].InputGetURLContentType(InputIndex);
|
---|
1159 | end;
|
---|
1160 |
|
---|
1161 | function uos_InputGetURLiceAudioInfo(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
1162 | begin
|
---|
1163 | Result := '';
|
---|
1164 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1165 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1166 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1167 | Result := uosPlayers[PlayerIndex].InputGetURLiceAudioInfo(InputIndex);
|
---|
1168 | end;
|
---|
1169 |
|
---|
1170 | function uos_InputGetURLicyDescription(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
1171 | begin
|
---|
1172 | Result := '';
|
---|
1173 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1174 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1175 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1176 | Result := uosPlayers[PlayerIndex].InputGetURLicyDescription(InputIndex);
|
---|
1177 | end;
|
---|
1178 |
|
---|
1179 | function uos_InputGetURLicyGenre(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
1180 | begin
|
---|
1181 | Result := '';
|
---|
1182 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1183 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1184 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1185 | Result := uosPlayers[PlayerIndex].InputGetURLicyGenre(InputIndex);
|
---|
1186 | end;
|
---|
1187 |
|
---|
1188 | function uos_InputGetURLicyName(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
1189 | begin
|
---|
1190 | Result := '';
|
---|
1191 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1192 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1193 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1194 | Result := uosPlayers[PlayerIndex].InputGetURLicyName(InputIndex);
|
---|
1195 | end;
|
---|
1196 |
|
---|
1197 | function uos_InputGetURLicyUrl(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
1198 | begin
|
---|
1199 | Result := '';
|
---|
1200 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1201 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1202 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1203 | Result := uosPlayers[PlayerIndex].InputGetURLicyUrl(InputIndex);
|
---|
1204 | end;
|
---|
1205 | {$endif}
|
---|
1206 |
|
---|
1207 | function uos_InputUpdateTag(PlayerIndex: cint32; InputIndex: cint32): Boolean;
|
---|
1208 | // for mp3 and opus files only
|
---|
1209 | begin
|
---|
1210 | Result := False;
|
---|
1211 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1212 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1213 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1214 | Result := uosPlayers[PlayerIndex].InputUpdateTag(InputIndex);
|
---|
1215 | end;
|
---|
1216 |
|
---|
1217 | function uos_InputGetTagTitle(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1218 | begin
|
---|
1219 | Result := nil;
|
---|
1220 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1221 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1222 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1223 | Result := uosPlayers[PlayerIndex].InputGetTagTitle(InputIndex);
|
---|
1224 | end;
|
---|
1225 |
|
---|
1226 | function uos_InputGetTagArtist(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1227 | begin
|
---|
1228 | Result := nil;
|
---|
1229 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1230 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1231 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1232 | Result := uosPlayers[PlayerIndex].InputGetTagArtist(InputIndex);
|
---|
1233 | end;
|
---|
1234 |
|
---|
1235 | function uos_InputGetTagAlbum(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1236 | begin
|
---|
1237 | Result := nil;
|
---|
1238 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1239 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1240 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1241 | Result := uosPlayers[PlayerIndex].InputGetTagAlbum(InputIndex);
|
---|
1242 | end;
|
---|
1243 |
|
---|
1244 | function uos_InputGetTagComment(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1245 | begin
|
---|
1246 | Result := nil;
|
---|
1247 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1248 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1249 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1250 | Result := uosPlayers[PlayerIndex].InputGetTagComment(InputIndex);
|
---|
1251 | end;
|
---|
1252 |
|
---|
1253 | function uos_InputGetTagTag(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1254 | begin
|
---|
1255 | Result := nil;
|
---|
1256 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1257 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1258 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1259 | Result := uosPlayers[PlayerIndex].InputGetTagTag(InputIndex);
|
---|
1260 | end;
|
---|
1261 |
|
---|
1262 | function uos_InputGetTagTrack(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1263 | begin
|
---|
1264 | Result := nil;
|
---|
1265 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1266 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1267 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1268 | Result := uosPlayers[PlayerIndex].InputGetTagTrack(InputIndex);
|
---|
1269 | end;
|
---|
1270 |
|
---|
1271 | function uos_InputGetTagGenre(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1272 | begin
|
---|
1273 | Result := nil;
|
---|
1274 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1275 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1276 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1277 | Result := uosPlayers[PlayerIndex].InputGetTagGenre(InputIndex);
|
---|
1278 | end;
|
---|
1279 |
|
---|
1280 | function uos_InputGetTagDate(PlayerIndex: cint32; InputIndex: cint32): PChar;
|
---|
1281 | begin
|
---|
1282 | Result := nil;
|
---|
1283 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1284 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1285 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1286 | Result := uosPlayers[PlayerIndex].InputGetTagDate(InputIndex);
|
---|
1287 | end;
|
---|
1288 |
|
---|
1289 | function uos_InputAddDSP(PlayerIndex: cint32; InputIndex: cint32; BeforeFunc: TFunc; AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32;
|
---|
1290 | // add a DSP procedure for input
|
---|
1291 | // PlayerIndex : Index of an existing Player
|
---|
1292 | // InputIndex : Input Index of an existing input
|
---|
1293 | // BeforeFunc : Function to do before the buffer is filled
|
---|
1294 | // AfterFunc : Function to do after the buffer is filled
|
---|
1295 | // EndedFunc : Function to do at end of thread
|
---|
1296 | // LoopProc : external procedure to do after the buffer is filled
|
---|
1297 | // Result : index of DSPin in array (DSPinIndex)
|
---|
1298 | // example : DSPinIndex1 := uos_InputAddDSP (0,InputIndex1,@beforereverse,@afterreverse,nil);
|
---|
1299 | begin
|
---|
1300 | Result := -1;
|
---|
1301 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1302 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1303 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1304 | Result := uosPlayers[PlayerIndex].InputAddDSP(InputIndex, BeforeFunc, AfterFunc, EndedFunc, Proc);
|
---|
1305 | end;
|
---|
1306 |
|
---|
1307 | procedure uos_InputSetDSP(PlayerIndex: cint32; InputIndex: cint32; DSPinIndex: cint32; Enable: Boolean);
|
---|
1308 | // PlayerIndex : Index of an existing Player
|
---|
1309 | // InputIndex : Input Index of an existing input
|
---|
1310 | // DSPIndexIn : DSP Index of an existing DSP In
|
---|
1311 | // Enable : DSP enabled
|
---|
1312 | // example : uos_InputSetDSP (0,InputIndex1,DSPinIndex1,True);
|
---|
1313 | begin
|
---|
1314 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1315 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1316 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1317 | uosPlayers[PlayerIndex].InputSetDSP(InputIndex, DSPinIndex, Enable);
|
---|
1318 | end;
|
---|
1319 |
|
---|
1320 | function uos_OutputAddDSP(PlayerIndex: cint32; OutputIndex: cint32; BeforeFunc: TFunc; AfterFunc: TFunc; EndedFunc: TFunc; Proc: TProc): cint32;// useful if multi output
|
---|
1321 | // PlayerIndex : Index of an existing Player
|
---|
1322 | // OutputIndex : OutputIndex of an existing Output
|
---|
1323 | // BeforeFunc : Function to do before the buffer is filled
|
---|
1324 | // AfterFunc : Function to do after the buffer is filled just before to give to output
|
---|
1325 | // EndedFunc : Function to do at end of thread
|
---|
1326 | // LoopProc : external procedure to do after the buffer is filled
|
---|
1327 | // Result :index of DSPout in array
|
---|
1328 | // example :DSPoutIndex1 := uos_OutputAddDSP (0,OutputIndex1,@volumeproc,nil,nil);
|
---|
1329 | begin
|
---|
1330 | Result := -1;
|
---|
1331 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1332 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1333 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1334 | Result := uosPlayers[PlayerIndex].OutputAddDSP(OutputIndex, BeforeFunc, AfterFunc, EndedFunc, Proc);
|
---|
1335 | end;
|
---|
1336 |
|
---|
1337 | procedure uos_OutputSetDSP(PlayerIndex: cint32; OutputIndex: cint32; DSPoutIndex: cint32; Enable: Boolean);
|
---|
1338 | // PlayerIndex : Index of an existing Player
|
---|
1339 | // OutputIndex : OutputIndex of an existing Output
|
---|
1340 | // DSPoutIndex : DSPoutIndex of existing DSPout
|
---|
1341 | // Enable : DSP enabled
|
---|
1342 | // example : uos_OutputSetDSP (0,OutputIndex1,DSPoutIndex1,True);
|
---|
1343 | begin
|
---|
1344 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1345 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1346 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1347 | uosPlayers[PlayerIndex].OutputSetDSP(OutputIndex, DSPoutIndex, Enable);
|
---|
1348 | end;
|
---|
1349 |
|
---|
1350 | function uos_InputAddFilter(PlayerIndex: cint32; InputIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc): cint32;
|
---|
1351 | // InputIndex : InputIndex of an existing Input
|
---|
1352 | // TypeFilterL: Type of filter left:
|
---|
1353 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1354 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
1355 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
1356 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
1357 | // GainL : gain left to apply to filter
|
---|
1358 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
1359 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1360 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
1361 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
1362 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
1363 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
1364 | // Result : index of DSPIn in array
|
---|
1365 | begin
|
---|
1366 | Result := -1;
|
---|
1367 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1368 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1369 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1370 | Result := uosPlayers[PlayerIndex].InputAddFilter(InputIndex,
|
---|
1371 | TypeFilterL, LowFrequencyL, HighFrequencyL, GainL,
|
---|
1372 | TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc);
|
---|
1373 | end;
|
---|
1374 |
|
---|
1375 | procedure uos_InputSetFilter(PlayerIndex: cint32; InputIndex: cint32; FilterIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint;
|
---|
1376 | LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc; Enable: Boolean);
|
---|
1377 | // InputIndex : InputIndex of an existing Input
|
---|
1378 | // DSPInIndex : DSPInIndex of existing DSPIn
|
---|
1379 | // TypeFilterL: Type of filter left:
|
---|
1380 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1381 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
1382 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
1383 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
1384 | // GainL : gain left to apply to filter
|
---|
1385 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
1386 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1387 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
1388 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
1389 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
1390 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
1391 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
1392 | // Enable : Filter enabled
|
---|
1393 | begin
|
---|
1394 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1395 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1396 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1397 | uosPlayers[PlayerIndex].InputSetFilter(InputIndex, FilterIndex,
|
---|
1398 | TypeFilterL, LowFrequencyL, HighFrequencyL, GainL,
|
---|
1399 | TypeFilterR, LowFrequencyR, HighFrequencyR, GainR,
|
---|
1400 | AlsoBuf, LoopProc, Enable);
|
---|
1401 | end;
|
---|
1402 |
|
---|
1403 | function uos_OutputAddFilter(PlayerIndex: cint32; OutputIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint; LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc): cint32;
|
---|
1404 | // Output : InputIndex of an existing Output
|
---|
1405 | // TypeFilterL: Type of filter left:
|
---|
1406 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1407 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
1408 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
1409 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
1410 | // GainL : gain left to apply to filter
|
---|
1411 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
1412 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1413 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
1414 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
1415 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
1416 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
1417 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
1418 | // Result : index of DSPIn in array
|
---|
1419 | begin
|
---|
1420 | Result := -1;
|
---|
1421 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1422 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1423 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1424 |
|
---|
1425 | Result := uosPlayers[PlayerIndex].OutputAddFilter(OutputIndex,
|
---|
1426 | TypeFilterL, LowFrequencyL, HighFrequencyL, GainL,
|
---|
1427 | TypeFilterR, LowFrequencyR, HighFrequencyR, GainR, AlsoBuf, LoopProc);
|
---|
1428 |
|
---|
1429 | end;
|
---|
1430 |
|
---|
1431 | procedure uos_OutputSetFilter(PlayerIndex: cint32; OutputIndex: cint32; FilterIndex: cint32; TypeFilterL: shortint; LowFrequencyL, HighFrequencyL, GainL: cfloat; TypeFilterR: shortint;
|
---|
1432 | LowFrequencyR, HighFrequencyR, GainR: cfloat; AlsoBuf: Boolean; LoopProc: TProc; Enable: Boolean);
|
---|
1433 | // OuputIndex : InputIndex of an existing Output
|
---|
1434 | // DSPInIndex : DSPInIndex of existing DSPIn
|
---|
1435 | // TypeFilterL: Type of filter left:
|
---|
1436 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1437 | // fBandPass = 3, fLowPass = 4, fHighPass = 5)
|
---|
1438 | // LowFrequencyL : Lowest frequency left ( -1 : current LowFrequency )
|
---|
1439 | // HighFrequencyL : Highest frequency left ( -1 : current HighFrequency )
|
---|
1440 | // GainL : gain left to apply to filter
|
---|
1441 | // TypeFilterR: Type of filter right (ignored if mono):
|
---|
1442 | // ( -1 = current filter ) (fBandAll = 0, fBandSelect = 1, fBandReject = 2
|
---|
1443 | // LowFrequencyR : Lowest frequency Right (ignored if mono) ( -1 : current LowFrequency )
|
---|
1444 | // HighFrequencyR : Highest frequency left ( -1 : current HighFrequency )
|
---|
1445 | // GainR : gain right (ignored if mono) to apply to filter ( 0 to what reasonable )
|
---|
1446 | // AlsoBuf : The filter alter buffer aswell ( otherwise, only Result is filled in fft.data )
|
---|
1447 | // LoopProc : external procedure of object to synchronize after DSP done
|
---|
1448 | // Enable : Filter enabled
|
---|
1449 | begin
|
---|
1450 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1451 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1452 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1453 | uosPlayers[PlayerIndex].OutputSetFilter(OutputIndex, FilterIndex,
|
---|
1454 | TypeFilterL, LowFrequencyL, HighFrequencyL, GainL,
|
---|
1455 | TypeFilterR, LowFrequencyR, HighFrequencyR, GainR,
|
---|
1456 | AlsoBuf, LoopProc, Enable);
|
---|
1457 | end;
|
---|
1458 |
|
---|
1459 | {$IF DEFINED (portaudio)}
|
---|
1460 | function uos_AddFromDevIn (PlayerIndex: cint32; Device: cint32; Latency: CDouble;
|
---|
1461 | SampleRate: CDouble; OutputIndex: cint32;
|
---|
1462 | SampleFormat: cint32; FramesCount : cint32; ChunkCount: cint32): cint32;
|
---|
1463 | // Add an Input from Device Input with custom parameters
|
---|
1464 | // PlayerIndex : Index of an existing Player
|
---|
1465 | // Device ( -1 is default Input device )
|
---|
1466 | // Latency ( -1 is latency suggested ) )
|
---|
1467 | // SampleRate : default: -1 (44100)
|
---|
1468 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
1469 | // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
1470 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
1471 | // FramesCount : default: -1 (65536)
|
---|
1472 | // ChunkCount : default: -1 (= 512)
|
---|
1473 | // Result : Output Index in array , -1 is error
|
---|
1474 | // example : OutputIndex1 := uos_AddFromDevIn (0,-1,-1,-1,-1,-1,-1);
|
---|
1475 | begin
|
---|
1476 | Result := -1;
|
---|
1477 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1478 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1479 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1480 | Result := uosPlayers[PlayerIndex].AddFromDevIn (Device, Latency, SampleRate, OutputIndex,
|
---|
1481 | SampleFormat, FramesCount, ChunkCount);
|
---|
1482 | end;
|
---|
1483 |
|
---|
1484 | function uos_AddFromDevIn (PlayerIndex: cint32): cint32;
|
---|
1485 | // Add an Input from Device Input with custom parameters
|
---|
1486 | // PlayerIndex : Index of an existing Player
|
---|
1487 | begin
|
---|
1488 | Result := -1;
|
---|
1489 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1490 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1491 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1492 | Result := uosPlayers[PlayerIndex].AddFromDevIn (-1, -1, -1, -1, -1, -1, -1);
|
---|
1493 | end;
|
---|
1494 | {$endif}
|
---|
1495 |
|
---|
1496 | function uos_AddFromEndlessMuted(PlayerIndex: cint32; Channels: cint32; FramesCount: cint32): cint32;
|
---|
1497 | // Add an input from Endless Muted dummy sine wav
|
---|
1498 | // FramesCount = FramesCount of input-to-follow
|
---|
1499 | // Channels = Channels of input-to-follow.
|
---|
1500 | begin
|
---|
1501 | Result := -1;
|
---|
1502 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1503 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1504 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1505 | Result := uosPlayers[PlayerIndex].AddFromEndlessMuted(Channels, FramesCount);
|
---|
1506 | end;
|
---|
1507 |
|
---|
1508 | {$IF DEFINED (synthesizer)}
|
---|
1509 | function uos_AddFromSynth (PlayerIndex: cint32; Channels: integer; WaveTypeL, WaveTypeR: shortint;
|
---|
1510 | FrequencyL, FrequencyR: float; VolumeL, VolumeR: float;
|
---|
1511 | duration : cint32; NbHarmonics: cint32; EvenHarmonics: cint32;
|
---|
1512 | OutputIndex: cint32; SampleFormat: cint32; SampleRate: CDouble; FramesCount : cint32): cint32;
|
---|
1513 | // Add an input from Synthesizer with custom parameters
|
---|
1514 | // Channels: default: -1 (2) (1 = mono, 2 = stereo)
|
---|
1515 | // WaveTypeL: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for mono and stereo)
|
---|
1516 | // WaveTypeR: default: -1 (0) (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for stereo, ignored for mono)
|
---|
1517 | // FrequencyL: default: -1 (440 htz) (Left frequency, used for mono)
|
---|
1518 | // FrequencyR: default: -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
|
---|
1519 | // VolumeL: default: -1 (= 1) (from 0 to 1) => volume left
|
---|
1520 | // VolumeR: default: -1 (= 1) (from 0 to 1) => volume rigth (ignored for mono)
|
---|
1521 | // Duration: default: -1 (= 1000) => duration in msec (0 = endless)
|
---|
1522 | // NbHarmonics: default: -1 (= 0) Number of Harmonics
|
---|
1523 | // EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics)
|
---|
1524 | // OutputIndex: Output index of used output
|
---|
1525 | // -1: all output, -2: no output, other cint32 refer to
|
---|
1526 | // an existing OutputIndex
|
---|
1527 | // (if multi-output then OutName = name of each output separeted by ';')
|
---|
1528 | // SampleFormat: default: -1 (0: Float32) (0: Float32, 1:Int32, 2:Int16)
|
---|
1529 | // SampleRate: default: -1 (44100)
|
---|
1530 | // FramesCount: -1 default: 1024
|
---|
1531 | // Result: Input Index in array -1 = error
|
---|
1532 | begin
|
---|
1533 | Result := -1;
|
---|
1534 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1535 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1536 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1537 | Result := uosPlayers[PlayerIndex].AddFromSynth (Channels,WaveTypeL, WaveTypeR, FrequencyL,
|
---|
1538 | FrequencyR, VolumeL, VolumeR, Duration, NbHarmonics, EvenHarmonics, OutputIndex,
|
---|
1539 | SampleFormat, SampleRate, FramesCount);
|
---|
1540 | end;
|
---|
1541 |
|
---|
1542 | procedure uos_InputSetSynth (PlayerIndex: cint32; InputIndex: cint32; WaveTypeL, WaveTypeR: shortint;
|
---|
1543 | FrequencyL, FrequencyR: float; VolumeL, VolumeR: float; duration: cint32;
|
---|
1544 | NbHarmonic: cint32; EvenHarmonics: cint32; Enable: boolean);
|
---|
1545 | // InputIndex: one existing input index
|
---|
1546 | // WaveTypeL: do not change: -1 (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for mono and stereo)
|
---|
1547 | // WaveTypeR: do not change: -1 (0 = sine-wave 1 = square-wave, 2= triangle, 3=sawtooth used for stereo, ignored for mono)
|
---|
1548 | // FrequencyL: do not change: -1 (Left frequency, used for mono)
|
---|
1549 | // FrequencyR: do not change: -1 (440 htz) (Right frequency, used for stereo, ignored for mono)
|
---|
1550 | // VolumeL: do not change: -1 (= 1) (from 0 to 1) => volume left
|
---|
1551 | // VolumeR: do not change: -1 (from 0 to 1) => volume rigth (ignored for mono)
|
---|
1552 | // Duration: in msec (-1 = do not change)
|
---|
1553 | // NbHarmonic: Number of Harmonics (-1 not change)
|
---|
1554 | // EvenHarmonics: default: -1 (= 0) (0 = all harmonics, 1 = Only even harmonics)
|
---|
1555 | // Enable: true or false;
|
---|
1556 |
|
---|
1557 | begin
|
---|
1558 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1559 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1560 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1561 | uosPlayers[PlayerIndex].InputSetSynth (InputIndex, WaveTypeL, WaveTypeR ,
|
---|
1562 | FrequencyL, FrequencyR, VolumeL, VolumeR, Duration, NbHarmonic, EvenHarmonics, Enable);
|
---|
1563 | end;
|
---|
1564 | {$endif}
|
---|
1565 |
|
---|
1566 | function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; Channels: cint32; SampleFormat: cint32; FramesCount: cint32; FileFormat: cint32): cint32;
|
---|
1567 | // Add an Output into audio wav file with custom parameters
|
---|
1568 | // PlayerIndex : Index of an existing Player
|
---|
1569 | // FileName : filename of saved audio wav file
|
---|
1570 | // SampleRate : default: -1 (44100)
|
---|
1571 | // Channels : default: -1 (2:stereo) (1:mono, 2:stereo, ...)
|
---|
1572 | // SampleFormat : default: -1 (2:Int16) (1:Int32, 2:Int16)
|
---|
1573 | // FramesCount : default: -1 (= 65536)
|
---|
1574 | // FileFormat : default: -1 (wav) (0:wav, 1:pcm, 2:custom, 3:ogg);
|
---|
1575 | // Result :Output Index in array -1 = error
|
---|
1576 | // example : OutputIndex1 := uos_AddIntoFile (0,edit5.Text,-1,-1, 0, 1);
|
---|
1577 | begin
|
---|
1578 | Result := -1;
|
---|
1579 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1580 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1581 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1582 | Result := uosPlayers[PlayerIndex].AddIntoFile(Filename, SampleRate, Channels, SampleFormat, FramesCount, FileFormat);
|
---|
1583 | end;
|
---|
1584 |
|
---|
1585 | function uos_AddIntoFile(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
1586 | // Add an Output into audio wav file with Default parameters
|
---|
1587 | // PlayerIndex : Index of an existing Player
|
---|
1588 | // FileName : filename of saved audio wav file
|
---|
1589 | begin
|
---|
1590 | Result := -1;
|
---|
1591 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1592 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1593 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1594 | Result := uosPlayers[PlayerIndex].AddIntoFile(Filename, -1, -1, -1, -1, -1);
|
---|
1595 | end;
|
---|
1596 |
|
---|
1597 | function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar; SampleRate: CDouble; Channels: longint; SampleFormat: longint; FramesCount: longint; FileFormat: cint32): longint;
|
---|
1598 | // Add an Output into audio wav file with Custom parameters
|
---|
1599 | // FileName : filename of saved audio wav file
|
---|
1600 | // SampleRate : default: -1 (44100)
|
---|
1601 | // Channels : default: -1 (2:stereo) (1:mono, 2:stereo, ...)
|
---|
1602 | // SampleFormat : -1 default: Int16 : (1:Int32, 2:Int16)
|
---|
1603 | // FramesCount : -1 default: 65536 div channels
|
---|
1604 | // FileFormat : default: -1 (wav) (0:wav, 1:pcm, 2:custom);
|
---|
1605 | // Result : Output Index in array -1 = error
|
---|
1606 | // example : OutputIndex1 := AddIntoFileFromMem (edit5.Text,-1,-1,0, -1,-1);
|
---|
1607 | begin
|
---|
1608 | Result := -1;
|
---|
1609 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1610 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1611 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1612 | Result := uosPlayers[PlayerIndex].AddIntoFileFromMem(Filename, SampleRate, Channels, SampleFormat, FramesCount, FileFormat);
|
---|
1613 | end;
|
---|
1614 |
|
---|
1615 | function uos_AddIntoFileFromMem(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
1616 | // Add an Output into audio wav file with Default parameters from TMemoryStream
|
---|
1617 | // PlayerIndex : Index of an existing Player
|
---|
1618 | // FileName : filename of saved audio wav file
|
---|
1619 | begin
|
---|
1620 | Result := -1;
|
---|
1621 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1622 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1623 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1624 | Result := uosPlayers[PlayerIndex].AddIntoFileFromMem(Filename, -1, -1, -1, -1, -1);
|
---|
1625 | end;
|
---|
1626 |
|
---|
1627 | {$IF DEFINED (shout)}
|
---|
1628 | function uos_AddIntoIceServer (PlayerIndex: cint32; SampleRate : CDouble; Channels: cint; SampleFormat: cint;
|
---|
1629 | EncodeType: cint; Port: cint; Host: pchar; User: pchar; Password: pchar; MountFile :pchar): cint32;
|
---|
1630 | // Add an Output into an IceCast server for audio-web-streaming// SampleRate : default: -1 (48100)
|
---|
1631 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
1632 | // EncodeType : default: -1 (0:Music) (0: Music, 1:Voice)
|
---|
1633 | // SampleFormat : -1 default: float32 : (0:float32, 1:Int16)
|
---|
1634 | // Port : default: -1 (= 8000)
|
---|
1635 | // Host : default: 'def' (= '127.0.0.1')
|
---|
1636 | // User : default: 'def' (= 'source')
|
---|
1637 | // Password : default: 'def' (= 'hackme')
|
---|
1638 | // MountFile : default: 'def' (= '/example.opus')
|
---|
1639 | // Result : Output Index in array -1 = error
|
---|
1640 | begin
|
---|
1641 | Result := -1;
|
---|
1642 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1643 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1644 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1645 | Result := uosPlayers[PlayerIndex].AddIntoIceServer (SampleRate, Channels, SampleFormat, EncodeType, Port,
|
---|
1646 | Host, User, Password, MountFile );
|
---|
1647 | end;
|
---|
1648 | {$endif}
|
---|
1649 |
|
---|
1650 | {$IF DEFINED (portaudio)}
|
---|
1651 | function uos_AddIntoDevOut (PlayerIndex: cint32; Device: cint32; Latency: CDouble;
|
---|
1652 | SampleRate: CDouble; Channels: cint32; SampleFormat: cint32;
|
---|
1653 | FramesCount: cint32; ChunkCount: cint32): cint32;
|
---|
1654 | // Add an Output into Device Output with custom parameters
|
---|
1655 | begin
|
---|
1656 | Result := -1;
|
---|
1657 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1658 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1659 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1660 | Result := uosPlayers[PlayerIndex].AddIntoDevOut (Device, Latency, SampleRate, Channels, SampleFormat , FramesCount, ChunkCount);
|
---|
1661 | end;
|
---|
1662 |
|
---|
1663 | function uos_AddIntoDevOut (PlayerIndex: cint32): cint32;
|
---|
1664 | // Add an Output into Device Output with default parameters
|
---|
1665 | begin
|
---|
1666 | Result := -1;
|
---|
1667 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1668 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1669 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1670 | Result := uosPlayers[PlayerIndex].AddIntoDevOut (-1, -1, -1, -1, -1 ,-1, -1);
|
---|
1671 | end;
|
---|
1672 | {$endif}
|
---|
1673 |
|
---|
1674 | function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; SampleFormat: cint32; FramesCount: cint32): cint32;
|
---|
1675 | // Add an input from audio file with custom parameters
|
---|
1676 | // PlayerIndex : Index of an existing Player
|
---|
1677 | // FileName : filename of audio file
|
---|
1678 | // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
1679 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
1680 | // FramesCount : default: -1 (65536)
|
---|
1681 | // Result : Input Index in array -1 = error
|
---|
1682 | // example : InputIndex1 := AddFromFile (0, edit5.Text,-1,-1);
|
---|
1683 | begin
|
---|
1684 | Result := -1;
|
---|
1685 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1686 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1687 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1688 | Result := uosPlayers[PlayerIndex].AddFromFile(Filename, OutputIndex, SampleFormat, FramesCount);
|
---|
1689 | end;
|
---|
1690 |
|
---|
1691 | function uos_AddFromFile(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
1692 | // Add an input from audio file with default parameters
|
---|
1693 | begin
|
---|
1694 | Result := -1;
|
---|
1695 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1696 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1697 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1698 | Result := uosPlayers[PlayerIndex].AddFromFile(Filename, -1, -1, -1);
|
---|
1699 | end;
|
---|
1700 |
|
---|
1701 | function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat): cint32;
|
---|
1702 | // Add an Output into memory buffer
|
---|
1703 | // outmemory : pointer of buffer to use to store memory.
|
---|
1704 | // example : OutputIndex1 := uos_AddIntoMemoryBuffer (0, pointer (bufmemory));
|
---|
1705 | begin
|
---|
1706 | Result := -1;
|
---|
1707 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1708 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1709 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1710 | Result := uosPlayers[PlayerIndex].AddIntoMemoryBuffer(outmemory);
|
---|
1711 | end;
|
---|
1712 |
|
---|
1713 | function uos_AddIntoMemoryBuffer(PlayerIndex: cint32; outmemory: PDArFloat; SampleRate: CDouble; SampleFormat: longint; Channels: longint; FramesCount: longint): longint;
|
---|
1714 | // Add an Output into memory buffer
|
---|
1715 | // outmemory : pointer of buffer to use to store memory.
|
---|
1716 | // SampleRate : default: -1 (44100)
|
---|
1717 | // SampleFormat : default: -1 (0:float32) ( 1:Int32, 2:Int16)
|
---|
1718 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
1719 | // FramesCount : default: -1 (= 1024 * 2)
|
---|
1720 | begin
|
---|
1721 | Result := -1;
|
---|
1722 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1723 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1724 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1725 | Result := uosPlayers[PlayerIndex].AddIntoMemoryBuffer(outmemory, SampleRate, SampleFormat, Channels, FramesCount);
|
---|
1726 | end;
|
---|
1727 |
|
---|
1728 | function uos_AddIntoMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; SampleRate: CDouble; SampleFormat: longint; Channels: longint; FramesCount: longint; Audioformat: cint32): longint;
|
---|
1729 | // Add an Output into TMemoryStream
|
---|
1730 | // MemoryStream : the TMemoryStream to use to store memory.
|
---|
1731 | // SampleRate : default: -1 (44100)
|
---|
1732 | // SampleFormat : default: -1 (2:Int16) ( 1:Int32, 2:Int16)
|
---|
1733 | // Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)
|
---|
1734 | // FramesCount : default: -1 (= 4096)
|
---|
1735 | // AudioFormat : default: -1 (wav) (0:wav, 1:ogg);
|
---|
1736 | begin
|
---|
1737 | Result := -1;
|
---|
1738 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1739 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1740 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1741 | Result := uosPlayers[PlayerIndex].AddIntoMemoryStream(MemoryStream,
|
---|
1742 | SampleRate, SampleFormat, Channels, FramesCount, AudioFormat);
|
---|
1743 | end;
|
---|
1744 |
|
---|
1745 | function uos_AddFromMemoryBuffer(PlayerIndex: cint32; MemoryBuffer: TDArFloat; Bufferinfos: Tuos_bufferinfos; OutputIndex: cint32; FramesCount: cint32): cint32;
|
---|
1746 | // Add an input from memory buffer with custom parameters
|
---|
1747 | // MemoryBuffer : the buffer
|
---|
1748 | // Bufferinfos : infos of the buffer
|
---|
1749 | // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')// Channels : default: -1 (2:stereo) (0: no channels, 1:mono, 2:stereo, ...)// SampleRate : default: -1 (44100)// FramesCount : default: -1 (4096)
|
---|
1750 | // FramesCount : default: -1 (65536 div Channels)
|
---|
1751 | // Result : Input Index in array -1 = error
|
---|
1752 | // example : InputIndex1 := AddFromMemoryBuffer (mybuffer, buffinfos,-1,1024);
|
---|
1753 | begin
|
---|
1754 | Result := -1;
|
---|
1755 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1756 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1757 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1758 | Result := uosPlayers[PlayerIndex].AddFromMemoryBuffer(MemoryBuffer, Bufferinfos, OutputIndex, FramesCount);
|
---|
1759 | end;
|
---|
1760 |
|
---|
1761 | function uos_AddFromMemoryStream(PlayerIndex: cint32; var MemoryStream: TMemoryStream; TypeAudio: cint32; OutputIndex: cint32; SampleFormat: cint32; FramesCount: cint32): cint32;
|
---|
1762 | // MemoryStream : Memory stream of encoded audio.
|
---|
1763 | // TypeAudio : default: -1 --> 0 (0: flac, ogg, wav; 1: mp3; 2:opus)
|
---|
1764 | // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
1765 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
1766 | // FramesCount : default: -1 (4096)
|
---|
1767 | // Result : Input Index in array -1 = error
|
---|
1768 | // example : InputIndex1 := AddFromMemoryStream (0, mymemorystream,-1,-1,0,1024);
|
---|
1769 | begin
|
---|
1770 | Result := -1;
|
---|
1771 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1772 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1773 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1774 | Result := uosPlayers[PlayerIndex].AddFromMemoryStream(MemoryStream, TypeAudio, OutputIndex, SampleFormat, FramesCount);
|
---|
1775 | end;
|
---|
1776 |
|
---|
1777 | function uos_AddFromMemoryStreamDec(PlayerIndex: cint32; var MemoryStream: TMemoryStream; var Bufferinfos: Tuos_bufferinfos; OutputIndex: cint32; FramesCount: cint32): cint32;
|
---|
1778 | // MemoryStream : Memory-stream of decoded audio (like created by AddIntoMemoryStream)
|
---|
1779 | // Bufferinfos : infos of the Memory-stream
|
---|
1780 | // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
1781 | // FramesCount : default: -1 (4096)
|
---|
1782 | // Result : Input Index in array -1 = error
|
---|
1783 | begin
|
---|
1784 | Result := -1;
|
---|
1785 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1786 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1787 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1788 | Result := uosPlayers[PlayerIndex].AddFromMemoryStreamDec(MemoryStream, Bufferinfos, OutputIndex, FramesCount);
|
---|
1789 | end;
|
---|
1790 |
|
---|
1791 | function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar; OutputIndex: cint32; SampleFormat: cint32; FramesCount: cint32; numbuf: cint): cint32;
|
---|
1792 | // Add an input from audio file and store it into memory with custom parameters
|
---|
1793 | // PlayerIndex : Index of an existing Player
|
---|
1794 | // FileName : filename of audio file
|
---|
1795 | // OutputIndex : Output index of used output// -1: all output, -2: no output, other cint32 refer to an existing OutputIndex (if multi-output then OutName = name of each output separeted by ';')
|
---|
1796 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
1797 | // FramesCount : default: -1 (65536)
|
---|
1798 | // Result : Input Index in array -1 = error
|
---|
1799 | // example : InputIndex1 := uos_AddFromFileIntoMemory (0, edit5.Text, -1, 0, -1);
|
---|
1800 | begin
|
---|
1801 | Result := -1;
|
---|
1802 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1803 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1804 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1805 | Result := uosPlayers[PlayerIndex].AddFromFileIntoMemory(Filename, OutputIndex, SampleFormat, FramesCount, numbuf);
|
---|
1806 | end;
|
---|
1807 |
|
---|
1808 | function uos_AddFromFileIntoMemory(PlayerIndex: cint32; Filename: PChar): cint32;
|
---|
1809 | // Add an input from audio file and store it into memory with default parameters
|
---|
1810 | begin
|
---|
1811 | Result := -1;
|
---|
1812 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1813 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1814 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1815 | Result := uosPlayers[PlayerIndex].AddFromFileIntoMemory(Filename, -1, -1, -1, -1);
|
---|
1816 | end;
|
---|
1817 |
|
---|
1818 | {$IF DEFINED (webstream)}
|
---|
1819 | function uos_AddFromURL (PlayerIndex: cint32; URL: PChar; OutputIndex: cint32;
|
---|
1820 | SampleFormat: cint32; FramesCount: cint32; AudioFormat: cint32; ICYon : boolean): cint32;
|
---|
1821 | // Add an Input from Audio URL
|
---|
1822 | // URL : URL of audio file
|
---|
1823 | // OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output
|
---|
1824 | // SampleFormat : -1 default: Int16 (0: Float32, 1:Int32, 2:Int16)
|
---|
1825 | // FramesCount : default: -1 (4096)
|
---|
1826 | // AudioFormat : default: -1 (auto-find) (0: mp3, 1: opus, 2: aac)
|
---|
1827 | // ICYon : ICY data on/off
|
---|
1828 | // Add an Input from Audio URL
|
---|
1829 | // URL : URL of audio file (like 'http://someserver/somesound.mp3')
|
---|
1830 | // OutputIndex : OutputIndex of existing Output// -1: all output, -2: no output, other cint32 : existing Output
|
---|
1831 | // SampleFormat : -1 default: Int16 (0: Float32, 1:Int32, 2:Int16)
|
---|
1832 | // FramesCount : default: -1 (65536)
|
---|
1833 | // AudioFormat : default: -1 (auto-find) (0: mp3, 1: opus, 2: aac)
|
---|
1834 | // example : InputIndex := uos_AddFromURL ('http://someserver/somesound.mp3',-1,-1,-1,-1, false);
|
---|
1835 | begin
|
---|
1836 | Result := -1;
|
---|
1837 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1838 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1839 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1840 | Result := uosPlayers[PlayerIndex].AddFromURL (URL, OutputIndex, SampleFormat, FramesCount, AudioFormat , ICYon);
|
---|
1841 | end;
|
---|
1842 |
|
---|
1843 | function uos_AddFromURL (PlayerIndex: cint32; URL: PChar): cint32;
|
---|
1844 | begin
|
---|
1845 | Result := -1;
|
---|
1846 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1847 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1848 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1849 | Result := uosPlayers[PlayerIndex].AddFromURL (URL, -1, -1, -1, -1, false);
|
---|
1850 | end;
|
---|
1851 | {$ENDIF}
|
---|
1852 |
|
---|
1853 | function uos_AddPlugin(PlayerIndex: cint32; PlugName: PChar; SampleRate: CDouble; Channels: cint32): cint32;
|
---|
1854 | // Add a plugin , Result is PluginIndex
|
---|
1855 | // PlayerIndex : Index of an existing Player
|
---|
1856 | // SampleRate : default: -1 (44100)
|
---|
1857 | // Channels : default: -1 (2:stereo) (1:mono, 2:stereo, ...)
|
---|
1858 | // 'soundtouch' and 'bs2b' PlugName are registred.
|
---|
1859 | begin
|
---|
1860 | Result := -1;
|
---|
1861 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1862 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1863 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1864 | Result := uosPlayers[PlayerIndex].AddPlugin(PlugName, SampleRate, Channels);
|
---|
1865 | end;
|
---|
1866 |
|
---|
1867 | {$IF DEFINED (soundtouch)}
|
---|
1868 | procedure uos_SetPluginSoundTouch (PlayerIndex: cint32; PluginIndex: cint32; Tempo: cfloat;
|
---|
1869 | Pitch: cfloat; Enable: boolean);
|
---|
1870 | // PluginIndex : PluginIndex Index of an existing Plugin.
|
---|
1871 | // PlayerIndex : Index of an existing Player
|
---|
1872 | begin
|
---|
1873 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1874 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1875 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1876 | uosPlayers[PlayerIndex].SetPluginSoundTouch (PluginIndex, Tempo, Pitch, Enable);
|
---|
1877 | end;
|
---|
1878 |
|
---|
1879 | procedure uos_SetPluginGetBPM (PlayerIndex: cint32; PluginIndex: cint32; numofframes: integer; loop : boolean;
|
---|
1880 | Enable: boolean);
|
---|
1881 | begin
|
---|
1882 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1883 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1884 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1885 | uosPlayers[PlayerIndex].SetPluginGetBPM (PluginIndex, numofframes, loop, Enable);
|
---|
1886 | end;
|
---|
1887 |
|
---|
1888 | {$endif}
|
---|
1889 |
|
---|
1890 | {$IF DEFINED (bs2b)}
|
---|
1891 | procedure uos_SetPluginBs2b (PlayerIndex: cint32; PluginIndex: cint32; level: CInt32; fcut: CInt32;
|
---|
1892 | feed: CInt32; Enable: boolean);
|
---|
1893 | // PluginIndex : PluginIndex Index of an existing Plugin.
|
---|
1894 | // PlayerIndex : Index of an existing Player
|
---|
1895 | begin
|
---|
1896 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
1897 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1898 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
1899 | uosPlayers[PlayerIndex].SetPluginBs2b (PluginIndex, level, fcut, feed, Enable);
|
---|
1900 | end;
|
---|
1901 | {$endif}
|
---|
1902 |
|
---|
1903 | procedure uos_InputSeek(PlayerIndex: cint32; InputIndex: cint32; pos: Tcount_t);
|
---|
1904 | // change position in sample
|
---|
1905 | begin
|
---|
1906 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1907 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1908 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1909 | uosPlayers[PlayerIndex].InputSeek(InputIndex, pos);
|
---|
1910 | end;
|
---|
1911 |
|
---|
1912 | function uos_GetStatus(PlayerIndex: cint32): cint32;
|
---|
1913 | // Get the status of the player : -1 => error, 0 => has stopped, 1 => is running, 2 => is paused.
|
---|
1914 | begin
|
---|
1915 | Result := -1;
|
---|
1916 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1917 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1918 | begin
|
---|
1919 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1920 | Result := uosPlayers[PlayerIndex].Status
|
---|
1921 | else
|
---|
1922 | Result := -1;
|
---|
1923 | end
|
---|
1924 | else
|
---|
1925 | Result := -1;
|
---|
1926 | end;
|
---|
1927 |
|
---|
1928 | procedure uos_InputSeekSeconds(PlayerIndex: cint32; InputIndex: cint32; pos: cfloat);
|
---|
1929 | // change position in seconds
|
---|
1930 | begin
|
---|
1931 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1932 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1933 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1934 | uosPlayers[PlayerIndex].InputSeekSeconds(InputIndex, pos);
|
---|
1935 | end;
|
---|
1936 |
|
---|
1937 | procedure uos_InputSeekTime(PlayerIndex: cint32; InputIndex: cint32; pos: TTime);
|
---|
1938 | // change position in time format
|
---|
1939 | begin
|
---|
1940 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1941 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1942 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1943 | uosPlayers[PlayerIndex].InputSeekTime(InputIndex, pos);
|
---|
1944 | end;
|
---|
1945 |
|
---|
1946 | function uos_InputGetBuffer(PlayerIndex: cint32; InputIndex: cint32): TDArFloat;
|
---|
1947 | // Get current buffer
|
---|
1948 | begin
|
---|
1949 | //{
|
---|
1950 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1951 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1952 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1953 | Result := uosPlayers[PlayerIndex].InputGetBuffer(InputIndex);
|
---|
1954 | // }
|
---|
1955 | end;
|
---|
1956 |
|
---|
1957 | function uos_InputLength(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
1958 | // InputIndex : InputIndex of existing input
|
---|
1959 | // Result : Length of Input in samples
|
---|
1960 | begin
|
---|
1961 | Result := 0;
|
---|
1962 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1963 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1964 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1965 | Result := uosPlayers[PlayerIndex].InputLength(InputIndex);
|
---|
1966 | end;
|
---|
1967 |
|
---|
1968 | function uos_InputLengthSeconds(PlayerIndex: cint32; InputIndex: cint32): cfloat;
|
---|
1969 | // InputIndex : InputIndex of existing input
|
---|
1970 | // Result : Length of Input in seconds
|
---|
1971 | begin
|
---|
1972 | Result := 0;
|
---|
1973 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1974 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1975 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1976 | Result := uosPlayers[PlayerIndex].InputLengthSeconds(InputIndex);
|
---|
1977 | end;
|
---|
1978 |
|
---|
1979 | function uos_InputLengthTime(PlayerIndex: cint32; InputIndex: cint32): TTime;
|
---|
1980 | // InputIndex : InputIndex of existing input
|
---|
1981 | // Result : Length of Input in time format
|
---|
1982 | begin
|
---|
1983 | Result := SysUtils.EncodeTime(0, 0, 0, 0);
|
---|
1984 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1985 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1986 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1987 | Result := uosPlayers[PlayerIndex].InputLengthTime(InputIndex);
|
---|
1988 | end;
|
---|
1989 |
|
---|
1990 | function uos_InputPosition(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
1991 | // InputIndex : InputIndex of existing input
|
---|
1992 | // Result : current postion in sample
|
---|
1993 | begin
|
---|
1994 | Result := 0;
|
---|
1995 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
1996 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
1997 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
1998 | Result := uosPlayers[PlayerIndex].InputPosition(InputIndex);
|
---|
1999 | end;
|
---|
2000 |
|
---|
2001 | procedure uos_InputSetFrameCount(PlayerIndex: cint32; InputIndex: cint32; framecount: cint32);
|
---|
2002 | begin
|
---|
2003 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2004 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2005 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2006 | uosPlayers[PlayerIndex].InputSetFrameCount(InputIndex, framecount);
|
---|
2007 | end;
|
---|
2008 |
|
---|
2009 | procedure uos_InputSetLevelEnable(PlayerIndex: cint32; InputIndex: cint32; enable: cint32);
|
---|
2010 | // set level calculation (default is 0)
|
---|
2011 | // 0 => no calcul
|
---|
2012 | // 1 => calcul before all DSP procedures.
|
---|
2013 | // 2 => calcul after all DSP procedures.
|
---|
2014 | // 3 => calcul before and after all DSP procedures.
|
---|
2015 | begin
|
---|
2016 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2017 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2018 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2019 | uosPlayers[PlayerIndex].InputSetLevelEnable(InputIndex, enable);
|
---|
2020 | end;
|
---|
2021 |
|
---|
2022 | procedure uos_InputSetEnable(PlayerIndex: cint32; InputIndex: cint32; Enabled: Boolean);
|
---|
2023 | // set enable true or false
|
---|
2024 | begin
|
---|
2025 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2026 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2027 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2028 | uosPlayers[PlayerIndex].InputSetEnable(InputIndex, Enabled);
|
---|
2029 | end;
|
---|
2030 |
|
---|
2031 | procedure uos_OutputSetEnable(PlayerIndex: cint32; OutputIndex: cint32; Enabled: Boolean);
|
---|
2032 | // set enable true or false (useful for multi outputput)
|
---|
2033 | begin
|
---|
2034 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2035 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2036 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2037 | uosPlayers[PlayerIndex].OutputSetEnable(OutputIndex, Enabled);
|
---|
2038 | end;
|
---|
2039 |
|
---|
2040 | procedure uos_OutputSetLevelEnable(PlayerIndex: cint32; OutputIndex: cint32; enable: cint32);
|
---|
2041 | // set level calculation (default is 0)
|
---|
2042 | // 0 => no calcul
|
---|
2043 | // 1 => calcul before all DSP procedures.
|
---|
2044 | // 2 => calcul after all DSP procedures.
|
---|
2045 | begin
|
---|
2046 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2047 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2048 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2049 | uosPlayers[PlayerIndex].OutputSetLevelEnable(OutputIndex, enable);
|
---|
2050 | end;
|
---|
2051 |
|
---|
2052 | procedure uos_InputSetPositionEnable(PlayerIndex: cint32; InputIndex: cint32; enable: cint32);
|
---|
2053 | // set position calculation (default is 0)
|
---|
2054 | // 0 => no calcul
|
---|
2055 | // 1 => calcul position.
|
---|
2056 | begin
|
---|
2057 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2058 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2059 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2060 | uosPlayers[PlayerIndex].InputSetPositionEnable(InputIndex, enable);
|
---|
2061 | end;
|
---|
2062 |
|
---|
2063 | procedure uos_InputSetLevelArrayEnable(PlayerIndex: cint32; InputIndex: cint32; levelcalc: cint32);
|
---|
2064 | // set add level calculation in level-array (default is 0)
|
---|
2065 | // 0 => no calcul
|
---|
2066 | // 1 => calcul before all DSP procedures.
|
---|
2067 | // 2 => calcul after all DSP procedures.
|
---|
2068 | begin
|
---|
2069 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2070 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2071 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2072 | uosPlayers[PlayerIndex].InputSetLevelArrayEnable(InputIndex, levelcalc);
|
---|
2073 | end;
|
---|
2074 |
|
---|
2075 | function uos_InputGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat;
|
---|
2076 | begin
|
---|
2077 | Result := uosLevelArray[PlayerIndex][InputIndex];
|
---|
2078 | end;
|
---|
2079 |
|
---|
2080 | function uos_InputGetLevelLeft(PlayerIndex: cint32; InputIndex: cint32): double;
|
---|
2081 | // InputIndex : InputIndex of existing input
|
---|
2082 | // Result : left level (volume) from 0 to 1
|
---|
2083 | begin
|
---|
2084 | Result := 0;
|
---|
2085 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2086 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2087 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2088 | Result := uosPlayers[PlayerIndex].InputGetLevelLeft(InputIndex);
|
---|
2089 | end;
|
---|
2090 |
|
---|
2091 |
|
---|
2092 | // OutputIndex : OutputIndex of existing Output
|
---|
2093 | // Result : left level (volume) from 0 to 1
|
---|
2094 | function uos_OutputGetLevelLeft(PlayerIndex: cint32; OutputIndex: cint32): double;
|
---|
2095 | begin
|
---|
2096 | Result := 0;
|
---|
2097 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2098 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2099 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2100 | Result := uosPlayers[PlayerIndex].OutputGetLevelLeft(OutputIndex);
|
---|
2101 | end;
|
---|
2102 |
|
---|
2103 | // OutputIndex : OutputIndex of existing Output
|
---|
2104 | // Result : right level (volume) from 0 to 1
|
---|
2105 | function uos_OutputGetLevelRight(PlayerIndex: cint32; OutputIndex: cint32): double;
|
---|
2106 | begin
|
---|
2107 | Result := 0;
|
---|
2108 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2109 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2110 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2111 | Result := uosPlayers[PlayerIndex].OutputGetLevelRight(OutputIndex);
|
---|
2112 | end;
|
---|
2113 |
|
---|
2114 |
|
---|
2115 | function uos_InputFiltersGetLevelString(PlayerIndex: cint32; InputIndex: cint32): string;
|
---|
2116 | // InputIndex : InputIndex of existing input
|
---|
2117 | // filterIndex : Filterindex of existing filter
|
---|
2118 | // Result : list of left|right levels separed by $ character
|
---|
2119 | begin
|
---|
2120 | Result := '';
|
---|
2121 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2122 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2123 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2124 | Result := uosPlayers[PlayerIndex].InputFiltersGetLevelString(InputIndex);
|
---|
2125 | end;
|
---|
2126 |
|
---|
2127 | function uos_InputFiltersGetLevelArray(PlayerIndex: cint32; InputIndex: cint32): TDArFloat;
|
---|
2128 | // InputIndex : InputIndex of existing input
|
---|
2129 | // Result : array of float of each filter.
|
---|
2130 | //in format levelfilter0left,levelfilter0right,levelfilter1left,levelfilter2right,..
|
---|
2131 | begin
|
---|
2132 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2133 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2134 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2135 | Result := uosPlayers[PlayerIndex].InputFiltersGetLevelArray(InputIndex);
|
---|
2136 | end;
|
---|
2137 |
|
---|
2138 | function uos_InputGetSampleRate(PlayerIndex: cint32; InputIndex: cint32): CDouble;
|
---|
2139 | // InputIndex : InputIndex of existing input
|
---|
2140 | // Result : default sample rate
|
---|
2141 | begin
|
---|
2142 | Result := 0;
|
---|
2143 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) and
|
---|
2144 | (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex + 1 <= length(uosPlayers[PlayerIndex].StreamIn)) then
|
---|
2145 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2146 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2147 | Result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.SamplerateRoot;
|
---|
2148 | end;
|
---|
2149 |
|
---|
2150 | function uos_InputGetChannels(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
2151 | // InputIndex : InputIndex of existing input
|
---|
2152 | // Result : default channels
|
---|
2153 | begin
|
---|
2154 | Result := 0;
|
---|
2155 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) and
|
---|
2156 | (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex + 1 <= length(uosPlayers[PlayerIndex].StreamIn)) then
|
---|
2157 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2158 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2159 | Result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.Channels;
|
---|
2160 | end;
|
---|
2161 |
|
---|
2162 | function uos_InputGetLibUsed(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
2163 | begin
|
---|
2164 | Result := 0;
|
---|
2165 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) and
|
---|
2166 | (length(uosPlayers[PlayerIndex].StreamIn) > 0) and (InputIndex + 1 <= length(uosPlayers[PlayerIndex].StreamIn)) then
|
---|
2167 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2168 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2169 | Result := uosPlayers[PlayerIndex].StreamIn[InputIndex].Data.libopen;
|
---|
2170 | end;
|
---|
2171 |
|
---|
2172 | function uos_InputGetLevelRight(PlayerIndex: cint32; InputIndex: cint32): double;
|
---|
2173 | // InputIndex : InputIndex of existing input
|
---|
2174 | // Result : right level (volume) from 0 to 1
|
---|
2175 | begin
|
---|
2176 | Result := 0;
|
---|
2177 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2178 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2179 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2180 | Result := uosPlayers[PlayerIndex].InputGetLevelRight(InputIndex);
|
---|
2181 | end;
|
---|
2182 |
|
---|
2183 | {$IF DEFINED (soundtouch)}
|
---|
2184 | function uos_InputGetBPM (PlayerIndex: cint32; InputIndex: cint32): CDouble;
|
---|
2185 | // InputIndex : InputIndex of existing input
|
---|
2186 | // Result : Beats per minuts
|
---|
2187 | begin
|
---|
2188 | Result := 0;
|
---|
2189 | if (length (uosPlayers) > 0) and (PlayerIndex < length (uosPlayers)) then
|
---|
2190 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2191 | if assigned (uosPlayers[PlayerIndex]) then
|
---|
2192 | Result := uosPlayers[PlayerIndex].InputGetBPM (InputIndex);
|
---|
2193 | end;
|
---|
2194 | {$endif}
|
---|
2195 |
|
---|
2196 | function uos_InputPositionSeconds(PlayerIndex: cint32; InputIndex: cint32): float;
|
---|
2197 | // InputIndex : InputIndex of existing input
|
---|
2198 | // Result : current postion of Input in seconds
|
---|
2199 | begin
|
---|
2200 | Result := 0;
|
---|
2201 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2202 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2203 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2204 | Result := uosPlayers[PlayerIndex].InputPositionSeconds(InputIndex);
|
---|
2205 | end;
|
---|
2206 |
|
---|
2207 | function uos_InputPositionTime(PlayerIndex: cint32; InputIndex: cint32): TTime;
|
---|
2208 | // InputIndex : InputIndex of existing input
|
---|
2209 | // Result : current postion of Input in time format
|
---|
2210 | begin
|
---|
2211 | Result := SysUtils.EncodeTime(0, 0, 0, 0);
|
---|
2212 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2213 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2214 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2215 | Result := uosPlayers[PlayerIndex].InputPositionTime(InputIndex);
|
---|
2216 | end;
|
---|
2217 |
|
---|
2218 | function uos_InputAddDSP1ChanTo2Chan(PlayerIndex: cint32; InputIndex: cint32): cint32;
|
---|
2219 | // Convert mono 1 channel input to stereo 2 channels input.
|
---|
2220 | // Works only if the input is mono 1 channel othewise stereo 2 chan is keeped.
|
---|
2221 | // InputIndex : InputIndex of an existing Input
|
---|
2222 | // Result : index of DSPIn in array
|
---|
2223 | // example DSPIndex1 := InputAddDSP1ChanTo2Chan (InputIndex1);
|
---|
2224 | begin
|
---|
2225 | Result := -1;
|
---|
2226 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2227 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2228 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2229 | Result := uosPlayers[PlayerIndex].InputAddDSP1ChanTo2Chan(InputIndex);
|
---|
2230 | end;
|
---|
2231 |
|
---|
2232 | procedure uos_PlayEx(PlayerIndex: cint32; no_free: Boolean; nloop: integer; paused: Boolean = False);// Start playing with free at end as parameter and assign loop
|
---|
2233 | begin
|
---|
2234 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2235 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2236 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2237 | uosPlayers[PlayerIndex].PlayEx(no_free, nloop, paused);
|
---|
2238 | end;
|
---|
2239 |
|
---|
2240 | procedure uos_Play(PlayerIndex: cint32; nloop: integer = 0);// Start playing
|
---|
2241 | begin
|
---|
2242 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2243 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2244 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2245 | uos_PlayEx(PlayerIndex, False, nloop);
|
---|
2246 | end;
|
---|
2247 |
|
---|
2248 | procedure uos_PlayPaused(PlayerIndex: cint32; nloop: integer = 0);// Start playing paused
|
---|
2249 | begin
|
---|
2250 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2251 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2252 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2253 | uos_PlayEx(PlayerIndex, False, nloop, True);
|
---|
2254 | end;
|
---|
2255 |
|
---|
2256 | procedure uos_PlayNoFree(PlayerIndex: cint32; nloop: integer = 0);// Start playing but do not free the player after stop
|
---|
2257 | begin
|
---|
2258 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2259 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2260 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2261 | uos_PlayEx(PlayerIndex, True, nloop);
|
---|
2262 | end;
|
---|
2263 |
|
---|
2264 | procedure uos_PlayNoFreePaused(PlayerIndex: cint32; nloop: integer = 0);// Start playing paused but do not free the player after stop
|
---|
2265 | begin
|
---|
2266 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2267 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2268 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2269 | uos_PlayEx(PlayerIndex, True, nloop, True);
|
---|
2270 | end;
|
---|
2271 |
|
---|
2272 | procedure uos_FreePlayer(PlayerIndex: cint32);
|
---|
2273 | begin
|
---|
2274 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2275 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2276 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2277 | uosPlayers[PlayerIndex].FreePlayer();
|
---|
2278 | end;
|
---|
2279 |
|
---|
2280 | procedure uos_RePlay(PlayerIndex: cint32);// Resume playing after pause
|
---|
2281 | begin
|
---|
2282 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2283 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2284 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2285 | uosPlayers[PlayerIndex].RePlay();
|
---|
2286 | end;
|
---|
2287 |
|
---|
2288 | procedure uos_Stop(PlayerIndex: cint32);// Stop playing and if uos_Play () was used: free the player
|
---|
2289 | begin
|
---|
2290 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2291 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2292 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2293 | uosPlayers[PlayerIndex].Stop()
|
---|
2294 | {$IF DEFINED (mse)}
|
---|
2295 | {$endif}
|
---|
2296 | ;
|
---|
2297 | end;
|
---|
2298 |
|
---|
2299 | procedure uos_Pause(PlayerIndex: cint32);// Pause playing
|
---|
2300 | begin
|
---|
2301 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2302 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2303 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2304 | uosPlayers[PlayerIndex].Pause();
|
---|
2305 | end;
|
---|
2306 |
|
---|
2307 | procedure uos_BeginProc(PlayerIndex: cint32; Proc: TProc);
|
---|
2308 | // Assign the procedure of object to execute at begin, before loop
|
---|
2309 | // PlayerIndex : Index of an existing Player
|
---|
2310 | begin
|
---|
2311 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2312 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2313 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2314 | uosPlayers[PlayerIndex].BeginProc := Proc;
|
---|
2315 | end;
|
---|
2316 |
|
---|
2317 | procedure uos_EndProc(PlayerIndex: cint32; Proc: TPlayerProc);
|
---|
2318 | // Assign the procedure of object to execute at end, after loop
|
---|
2319 | // PlayerIndex : Index of an existing Player
|
---|
2320 | // InIndex : Index of an existing Input
|
---|
2321 | begin
|
---|
2322 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2323 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2324 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2325 | uosPlayers[PlayerIndex].EndProc := Proc;
|
---|
2326 | end;
|
---|
2327 |
|
---|
2328 | procedure uos_EndProcOnly(PlayerIndex: cint32; Proc: TProconly);
|
---|
2329 | // Assign the procedure (not of object) to execute at end, after loop
|
---|
2330 | // PlayerIndex : Index of an existing Player
|
---|
2331 | // InIndex : Index of an existing Input
|
---|
2332 | begin
|
---|
2333 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2334 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2335 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2336 | uosPlayers[PlayerIndex].EndProcOnly := Proc;
|
---|
2337 | end;
|
---|
2338 |
|
---|
2339 | procedure uos_LoopBeginProc(PlayerIndex: cint32; Proc: TProc);
|
---|
2340 | // Assign the procedure of object to execute at begin, before loop
|
---|
2341 | // PlayerIndex : Index of an existing Player
|
---|
2342 | begin
|
---|
2343 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2344 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2345 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2346 | uosPlayers[PlayerIndex].LoopBeginProc := Proc;
|
---|
2347 | end;
|
---|
2348 |
|
---|
2349 | procedure uos_LoopEndProc(PlayerIndex: cint32; Proc: TProc);
|
---|
2350 | // Assign the procedure of object to execute at end, after loop
|
---|
2351 | // PlayerIndex : Index of an existing Player
|
---|
2352 | // InIndex : Index of an existing Input
|
---|
2353 | begin
|
---|
2354 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2355 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2356 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2357 | uosPlayers[PlayerIndex].LoopEndProc := Proc;
|
---|
2358 | end;
|
---|
2359 |
|
---|
2360 | procedure uos_LoopProcIn(PlayerIndex: cint32; InIndex: cint32; Proc: TProc);
|
---|
2361 | // Assign the procedure of object to execute inside the loop
|
---|
2362 | // PlayerIndex : Index of an existing Player
|
---|
2363 | // InIndex : Index of an existing Input
|
---|
2364 | begin
|
---|
2365 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2366 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2367 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2368 | uosPlayers[PlayerIndex].StreamIn[InIndex].LoopProc := Proc;
|
---|
2369 | end;
|
---|
2370 |
|
---|
2371 | procedure uos_LoopProcOut(PlayerIndex: cint32; OutIndex: cint32; Proc: TProc);
|
---|
2372 | // Assign the procedure of object to execute inside the loop
|
---|
2373 | // PlayerIndex : Index of an existing Player
|
---|
2374 | // OutIndex : Index of an existing Output
|
---|
2375 | begin
|
---|
2376 | if (length(uosPlayers) > 0) and (PlayerIndex < length(uosPlayers)) then
|
---|
2377 | if uosPlayersStat[PlayerIndex] = 1 then
|
---|
2378 | if Assigned(uosPlayers[PlayerIndex]) then
|
---|
2379 | uosPlayers[PlayerIndex].StreamOut[OutIndex].LoopProc := Proc;
|
---|
2380 | end;
|
---|
2381 |
|
---|
2382 | function uos_File2Buffer(Filename: PChar; SampleFormat: cint32; var bufferinfos: Tuos_BufferInfos; frompos: cint; numbuf: cint): TDArFloat;
|
---|
2383 | // Create a memory buffer of an audio file.
|
---|
2384 | // FileName : filename of audio file
|
---|
2385 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
2386 | // bufferinfos : the infos of the buffer.
|
---|
2387 | // frompos : from position (default: -1 = from begining, otherwise position in song)
|
---|
2388 | // numbuf : number of frames to add to outmemory (default: -1 = all, otherwise number max of frames)
|
---|
2389 | // Result : The memory buffer
|
---|
2390 | // example : buffmem := uos_File2buffer (edit5.Text,0,buffmem, buffinfos, -1, -1);
|
---|
2391 | begin
|
---|
2392 | Result := uos.uos_File2Buffer(Filename, SampleFormat, bufferinfos, frompos, numbuf);
|
---|
2393 | end;
|
---|
2394 |
|
---|
2395 | function uos_Stream2Buffer(AudioFile: TMemoryStream; SampleFormat: int32; var outmemory: TDArFloat; var bufferinfos: Tuos_BufferInfos; frompos: cint; numbuf: cint): TDArFloat;
|
---|
2396 | // Create a memory buffer of an audio file.
|
---|
2397 | // FileName : filename of audio file
|
---|
2398 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
2399 | // Outmemory : the buffer to store data.
|
---|
2400 | // bufferinfos : the infos of the buffer.
|
---|
2401 | // frompos : from position (default: -1 = from begining, otherwise position in song)
|
---|
2402 | // numbuf : number of frames to add to outmemory (default: -1 = all, otherwise number max frames of buffers)
|
---|
2403 | // Result : The memory buffer
|
---|
2404 | // example : buffmem := uos_Stream2Buffer (edit5.Text,0,buffmem, buffinfos, -1, -1);
|
---|
2405 | begin
|
---|
2406 | Result := uos.uos_Stream2Buffer(AudioFile, SampleFormat, outmemory, bufferinfos, frompos, numbuf);
|
---|
2407 | end;
|
---|
2408 |
|
---|
2409 | {$IF DEFINED (soundtouch)}
|
---|
2410 | function uos_GetBPM (TheBuffer: TDArFloat; Channels: cint32; SampleRate: CDouble) : CDouble;
|
---|
2411 | // From SoundTouch plugin
|
---|
2412 | begin
|
---|
2413 | Result := uos.uos_GetBPM (TheBuffer, Channels, SampleRate);
|
---|
2414 | end;
|
---|
2415 | {$endif}
|
---|
2416 |
|
---|
2417 | procedure uos_CustBufferInfos(var bufferinfos: Tuos_BufferInfos; SampleRate: CDouble; SampleFormat: cint32; Channels: cint32; Length: cint32);
|
---|
2418 | // to initialize a custom bufferinfos: needed for AddFromMemoryBuffer () if no bufferinfos was created.
|
---|
2419 | // all infos refer to the buffer used ---> length = length of the buffer div channels.
|
---|
2420 | begin
|
---|
2421 | uos.uos_CustBufferInfos(bufferinfos, SampleRate, SampleFormat, Channels, Length);
|
---|
2422 | end;
|
---|
2423 |
|
---|
2424 | procedure uos_File2File(FilenameIN: PChar; FilenameOUT: PChar; SampleFormat: cint32; typeout: cint32);
|
---|
2425 | // Create an audio file from an audio file.
|
---|
2426 | // FileNameIN : filename of audio file IN (ogg, flac, wav, mp3, opus, aac,...)
|
---|
2427 | // FileNameOUT : filename of audio file OUT (wav, pcm, custom)
|
---|
2428 | // SampleFormat : default: -1 (2:Int16) (0: Float32, 1:Int32, 2:Int16)
|
---|
2429 | // typeout : Type of out file (-1:default=wav, 0:wav, 1:pcm, 2:custom)// example : InputIndex1 := uos_File2File (edit5.Text,0,buffmem);
|
---|
2430 | begin
|
---|
2431 | uos.uos_File2File(FilenameIN, FilenameOUT, SampleFormat, typeout);
|
---|
2432 | end;
|
---|
2433 |
|
---|
2434 | procedure uos_MemStream2Wavfile(FileName: UTF8String; Data: TMemoryStream; BitsPerSample, chan: integer; samplerate: CDouble);
|
---|
2435 | // Create an audio wav file from a TMemoryStream.
|
---|
2436 | // FileName : filename of wav saved file
|
---|
2437 | // data : the memorystream
|
---|
2438 | // BitsPerSample : 16 or 32 (bit)
|
---|
2439 | // chan : number of channels
|
---|
2440 | // samplerate : sample rate
|
---|
2441 | begin
|
---|
2442 | uos.uos_MemStream2Wavfile(FileName, Data, BitsPerSample, chan, samplerate);
|
---|
2443 | end;
|
---|
2444 |
|
---|
2445 | function uos_TestLoadLibrary(Filename: PChar): Boolean;
|
---|
2446 | // test a library to check if it can be loaded;
|
---|
2447 | begin
|
---|
2448 | Result := uos.uos_TestLoadLibrary(FileName);
|
---|
2449 | end;
|
---|
2450 |
|
---|
2451 | function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName, fdkaacFilename: PChar): cint32;
|
---|
2452 | begin
|
---|
2453 | Result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName,
|
---|
2454 | FaadFileName, opusfileFileName, XMPFileName, fdkaacFilename);
|
---|
2455 | end;
|
---|
2456 |
|
---|
2457 | function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName: PChar): cint32;
|
---|
2458 | begin
|
---|
2459 | Result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, nil, nil);
|
---|
2460 | end;
|
---|
2461 |
|
---|
2462 | function uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName: PChar): cint32;
|
---|
2463 | begin
|
---|
2464 | Result := uos.uos_loadlib(PortAudioFileName, SndFileFileName, Mpg123FileName, Mp4ffFileName, FaadFileName, opusfileFileName, XMPFileName, nil);
|
---|
2465 | end;
|
---|
2466 |
|
---|
2467 |
|
---|
2468 | function uos_loadPlugin(PluginName, PluginFilename: PChar): cint32;
|
---|
2469 | // load plugin...
|
---|
2470 | begin
|
---|
2471 | Result := uos.uos_loadPlugin(PluginName, PluginFilename);
|
---|
2472 | end;
|
---|
2473 |
|
---|
2474 | function uos_Int16ToFloat32(Inbuf: TDArFloat): TDArFloat;
|
---|
2475 | // convert buffer int16 into float32.
|
---|
2476 | begin
|
---|
2477 | Result := uos.CvInt16ToFloat32(Inbuf);
|
---|
2478 | end;
|
---|
2479 |
|
---|
2480 | {$IF DEFINED (shout)}
|
---|
2481 | function uos_LoadServerLib (ShoutFileName, OpusFileName : PChar) : cint32;
|
---|
2482 | // Shout => needed for dealing with IceCast server
|
---|
2483 | // Opus => needed for dealing with encoding opus stream
|
---|
2484 | begin
|
---|
2485 | Result := uos.uos_LoadServerLib (ShoutFileName, OpusFileName) ;
|
---|
2486 | end;
|
---|
2487 |
|
---|
2488 | procedure uos_unloadServerLib ();
|
---|
2489 | // Unload server libraries... Do not forget to call it before close application...
|
---|
2490 | begin
|
---|
2491 | uos.uos_unloadServerLib () ;
|
---|
2492 | end;
|
---|
2493 | {$endif}
|
---|
2494 |
|
---|
2495 | function uos_GetVersion(): cint32;
|
---|
2496 | begin
|
---|
2497 | Result := uos.uos_GetVersion();
|
---|
2498 | end;
|
---|
2499 |
|
---|
2500 | procedure uos_unloadlib();
|
---|
2501 | var
|
---|
2502 | x: cint32;
|
---|
2503 | nt: integer = 300;
|
---|
2504 | begin
|
---|
2505 | if Assigned(uosPlayers) then
|
---|
2506 | begin
|
---|
2507 | if (length(uosPlayers) > 0) then
|
---|
2508 | for x := 0 to high(uosPlayers) do
|
---|
2509 | if uosPlayersStat[x] = 1 then
|
---|
2510 | if uosPlayers[x].Status > 0 then
|
---|
2511 | begin
|
---|
2512 | uosPlayers[x].nofree := False;
|
---|
2513 | uosPlayers[x].Stop();
|
---|
2514 | end;
|
---|
2515 |
|
---|
2516 | while (PlayersNotFree = True) and (nt > 0) do
|
---|
2517 | begin
|
---|
2518 | Sleep(10);
|
---|
2519 | Dec(nt);
|
---|
2520 | end;
|
---|
2521 |
|
---|
2522 | setlength(uosPlayers, 0);
|
---|
2523 | setlength(uosPlayersStat, 0);
|
---|
2524 | end;
|
---|
2525 |
|
---|
2526 | uos.uos_unloadlib();
|
---|
2527 | end;
|
---|
2528 |
|
---|
2529 | procedure uos_unloadlibCust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac: Boolean);
|
---|
2530 | // Custom Unload libraries... if true, then delete the library. You may unload what and when you want...
|
---|
2531 | begin
|
---|
2532 | uos.uos_unloadlibcust(PortAudio, SndFile, Mpg123, AAC, opus, xmp, fdkaac);
|
---|
2533 | uosLoadResult := uos.uosLoadResult;
|
---|
2534 | end;
|
---|
2535 |
|
---|
2536 | procedure uos_UnloadPlugin(PluginName: PChar);
|
---|
2537 | begin
|
---|
2538 | uos.uos_UnloadPlugin(PluginName);
|
---|
2539 | uosLoadResult := uos.uosLoadResult;
|
---|
2540 | end;
|
---|
2541 |
|
---|
2542 | function uos_GetInfoLibraries(): PChar;
|
---|
2543 | begin
|
---|
2544 | Result := uos.uos_GetInfoLibraries();
|
---|
2545 | end;
|
---|
2546 |
|
---|
2547 | {$IF DEFINED (portaudio)}
|
---|
2548 | procedure uos_GetInfoDevice ();
|
---|
2549 | begin
|
---|
2550 | uos.uos_GetInfoDevice ();
|
---|
2551 | setlength (uosDeviceInfos,length (uos.uosDeviceInfos));
|
---|
2552 |
|
---|
2553 | uosDeviceInfos := uos.uosDeviceInfos;
|
---|
2554 |
|
---|
2555 | uosDeviceCount:= uos.uosDeviceCount;
|
---|
2556 | uosDefaultDeviceIn:= uos.uosDefaultDeviceIn;
|
---|
2557 | uosDefaultDeviceOut:= uos.uosDefaultDeviceOut;
|
---|
2558 | end;
|
---|
2559 |
|
---|
2560 | procedure uos_UpdateDevice ();
|
---|
2561 | begin
|
---|
2562 | uos.uos_UpdateDevice ();
|
---|
2563 | uosDeviceCount:= uos.uosDeviceCount;
|
---|
2564 | uosDefaultDeviceIn:= uos.uosDefaultDeviceIn;
|
---|
2565 | uosDefaultDeviceOut:= uos.uosDefaultDeviceOut;
|
---|
2566 | end;
|
---|
2567 |
|
---|
2568 | function uos_GetInfoDeviceStr () : PChar;
|
---|
2569 | begin
|
---|
2570 | Result := uos.uos_GetInfoDeviceStr ();
|
---|
2571 | uosDeviceCount:= uos.uosDeviceCount;
|
---|
2572 | uosDefaultDeviceIn:= uos.uosDefaultDeviceIn;
|
---|
2573 | uosDefaultDeviceOut:= uos.uosDefaultDeviceOut;
|
---|
2574 | end;
|
---|
2575 | {$endif}
|
---|
2576 |
|
---|
2577 | function uos_CreatePlayer(PlayerIndex: cint32): Boolean;
|
---|
2578 | // Create the player , PlayerIndex1 : from 0 to what your computer can do!
|
---|
2579 | // If PlayerIndex exists already, it will be overwriten...
|
---|
2580 | var
|
---|
2581 | x: cint32;
|
---|
2582 | nt: integer = 200;
|
---|
2583 | begin
|
---|
2584 | Result := False;
|
---|
2585 |
|
---|
2586 | uos_stop(PlayerIndex); // cannot hurt!
|
---|
2587 |
|
---|
2588 | if PlayerIndex >= 0 then
|
---|
2589 | begin
|
---|
2590 | if PlayerIndex + 1 > length(uosPlayers) then
|
---|
2591 | begin
|
---|
2592 | setlength(uosPlayers, PlayerIndex + 1);
|
---|
2593 | uosPlayers[PlayerIndex] := nil;
|
---|
2594 | setlength(uosPlayersStat, PlayerIndex + 1);
|
---|
2595 | setlength(uosLevelArray, PlayerIndex + 1);
|
---|
2596 | end;
|
---|
2597 |
|
---|
2598 | {$IF DEFINED (uos_debug) and DEFINED (unix)}
|
---|
2599 | writeln('before uosPlayers[PlayerIndex] <> nil ');
|
---|
2600 | {$endif}
|
---|
2601 |
|
---|
2602 | if (uosPlayers[PlayerIndex] <> nil) then
|
---|
2603 | begin
|
---|
2604 | uosPlayers[PlayerIndex].FreePlayer;
|
---|
2605 | Sleep(20);
|
---|
2606 | while (PlayerNotFree(PlayerIndex) = True) and (nt > 0) do
|
---|
2607 | begin
|
---|
2608 | Sleep(10);
|
---|
2609 | Dec(nt);
|
---|
2610 | end;
|
---|
2611 | end;
|
---|
2612 |
|
---|
2613 | {$IF DEFINED (uos_debug) and DEFINED (unix)}
|
---|
2614 | writeln('after uosPlayers[PlayerIndex] <> nil ');
|
---|
2615 | {$endif}
|
---|
2616 |
|
---|
2617 | uosPlayers[PlayerIndex] := Tuos_Player.Create();
|
---|
2618 |
|
---|
2619 | Result := True;
|
---|
2620 |
|
---|
2621 | uosPlayers[PlayerIndex].Index := PlayerIndex;
|
---|
2622 | //notice player is created
|
---|
2623 | uosPlayersStat[PlayerIndex] := 1;
|
---|
2624 |
|
---|
2625 | for x := 0 to length(uosPlayersStat) - 1 do
|
---|
2626 | if uosPlayersStat[x] <> 1 then
|
---|
2627 | begin
|
---|
2628 | uosPlayersStat[x] := -1;
|
---|
2629 | uosPlayers[x] := nil;
|
---|
2630 | end;
|
---|
2631 | end;
|
---|
2632 | end;
|
---|
2633 |
|
---|
2634 | procedure uos_Free();
|
---|
2635 | var
|
---|
2636 | x: integer;
|
---|
2637 | nt: shortint = 100;
|
---|
2638 | begin
|
---|
2639 | // needed for MSE and if some players are still playing
|
---|
2640 | if length(uosPlayers) > 0 then
|
---|
2641 | for x := 0 to length(uosPlayers) - 1 do
|
---|
2642 | if Assigned(uosPlayers[x]) then
|
---|
2643 | begin
|
---|
2644 | uosPlayers[x].nofree := False;
|
---|
2645 | uos_playpaused(x);
|
---|
2646 | uos_stop(x);
|
---|
2647 | end;
|
---|
2648 |
|
---|
2649 | while (PlayersNotFree = True) and (nt > 0) do
|
---|
2650 | begin
|
---|
2651 | Sleep(10);
|
---|
2652 | Dec(nt);
|
---|
2653 | end;
|
---|
2654 | sleep(100);
|
---|
2655 | uos.uos_free();
|
---|
2656 | end;
|
---|
2657 |
|
---|
2658 | end.
|
---|