├── DevIL ├── DevIL.dll ├── DevIL.lib ├── README.md └── DevIL.pb ├── FMOD ├── README.md └── FMOD.pbi ├── Libsndfile ├── README.md ├── Libsndfile.pbi └── Libsndfile.pb ├── Lua ├── README.md ├── Lua53.pbi └── Lua53.pb ├── OpenAL Soft ├── README.md ├── OpenALsoft.pbi └── OpenALsoft.pb ├── FastPoke ├── README.md ├── FastPoke.pb └── FastPokeBenchmark.pb ├── README.md ├── LICENSE ├── Queue ├── README.md └── Queue.pb └── StringConverter ├── README.md └── StringConverter.pb /DevIL/DevIL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Henry00IS/PureBasic/HEAD/DevIL/DevIL.dll -------------------------------------------------------------------------------- /DevIL/DevIL.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Henry00IS/PureBasic/HEAD/DevIL/DevIL.lib -------------------------------------------------------------------------------- /FMOD/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic FMOD Headers 2 | This header has been tested with: 3 | - FMOD 1.05.15 4 | 5 | Supports both 32-bit and 64-bit. -------------------------------------------------------------------------------- /Libsndfile/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic Libsndfile Headers 2 | This header has been tested with: 3 | - Libsndfile 1.0.25 4 | 5 | Supports both 32-bit and 64-bit. -------------------------------------------------------------------------------- /Lua/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic Lua Headers 2 | You can set #LUA_VERSION_PUREBASIC to: 3 | - 523 for Lua 5.2.3 4 | - 530 for Lua 5.3.0 5 | 6 | Supports both 32-bit and 64-bit. -------------------------------------------------------------------------------- /OpenAL Soft/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic OpenAL Soft Headers 2 | This header has been tested with: 3 | - OpenAL Soft 1.15.1 4 | - OpenAL Soft 1.16.0 5 | 6 | Supports both 32-bit and 64-bit. -------------------------------------------------------------------------------- /DevIL/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic DevIL Headers 2 | This header has been tested with: 3 | - DevIL 1.7.8 4 | 5 | An old header that uses the `Import` statement with a .lib file (included here with the 32-bit .dll file for convenience). -------------------------------------------------------------------------------- /FMOD/FMOD.pbi: -------------------------------------------------------------------------------- 1 | ;- PBHGEN V5.42 [http://00laboratories.com/] 2 | ;- 'FMOD.pb' header, generated at 11:55:33 27.09.2019. 3 | 4 | CompilerIf #PB_Compiler_Module = "" 5 | Declare FMOD_Initialize() 6 | Declare FMOD_Dispose() 7 | CompilerEndIf -------------------------------------------------------------------------------- /Libsndfile/Libsndfile.pbi: -------------------------------------------------------------------------------- 1 | ;- PBHGEN V5.42 [http://00laboratories.com/] 2 | ;- 'Libsndfile.pb' header, generated at 11:50:23 27.09.2019. 3 | 4 | CompilerIf #PB_Compiler_Module = "" 5 | Declare LSF_Initialize() 6 | Declare LSF_Dispose() 7 | CompilerEndIf -------------------------------------------------------------------------------- /OpenAL Soft/OpenALsoft.pbi: -------------------------------------------------------------------------------- 1 | ;- PBHGEN V5.42 [http://00laboratories.com/] 2 | ;- 'OpenALsoft.pb' header, generated at 11:42:24 27.09.2019. 3 | 4 | CompilerIf #PB_Compiler_Module = "" 5 | Declare AL_Initialize() 6 | Declare AL_Dispose() 7 | Declare AL_GetFormatFromChannelCount(ChannelCount.i) 8 | CompilerEndIf -------------------------------------------------------------------------------- /FastPoke/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic Fast Poke 2 | This module optimizes most PokeX() commands in PureBasic. 3 | 4 | Through clever macros, simply including this file and compiling your program is enough to gain a performance improvement. 5 | 6 | ## Implementation Details 7 | Every PokeX() command in PureBasic is a procedure call and will have some overhead because of it. These macros will replace those procedure calls with a simple structure assignment, which will compile down to simple MOV instructions in assembly. Every PokeX() procedure will have its own variable. 8 | 9 | Simply including this file and compiling your program is enough to gain a performance improvement if you use these procedures a lot. 10 | 11 | See FastPokeBenchmark.pb for more details and timing information. -------------------------------------------------------------------------------- /Lua/Lua53.pbi: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** Lua53.pb header file by PBHGEN. 3 | ;------------------------------------------------------------------------------ 4 | ; WARNING: This file is automatically generated each time you save! 5 | ; Any manual changes to this file may be permanently lost upon regeneration. 6 | ; If you came here because of a syntax error, double-check your own code. 7 | ; For more information, visit https://github.com/00laboratories/PBHGEN 8 | ;============================================================================== 9 | 10 | CompilerIf #PB_Compiler_Module = "" 11 | Declare Lua_Initialize() 12 | Declare Lua_Dispose() 13 | Declare.s lua_tostring(Lua_State, idx) 14 | Declare.d lua_tonumber(L, i) 15 | Declare lua_getglobal_fixed(L, String$) 16 | CompilerEndIf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PureBasic Headers and Libraries 2 | This repository is a collection of PureBasic Headers and Libraries I made over the years. 3 | 4 | I recommend that you use [PBHGEN](https://github.com/00laboratories/PBHGEN) when you use any of my code. It automatically generates headers with declare statements for your files so that you can call procedures anywhere - regardless of their position. 5 | 6 | # PureBasic Headers 7 | - [DevIL 1.7.8](/DevIL) - x86 (.lib) 8 | - [FMOD 1.05.15](/FMOD) - x86 / x64 9 | - [Libsndfile 1.0.25](/Libsndfile) - x86 / x64 10 | - [Lua 5.2.3](/Lua) - x86 / x64 11 | - [Lua 5.3.0](/Lua) - x86 / x64 12 | - [OpenAL Soft 1.15.1](/OpenAL%20Soft) - x86 / x64 13 | - [OpenAL Soft 1.16.0](/OpenAL%20Soft) - x86 / x64 14 | 15 | # PureBasic Libraries 16 | - [FastPoke](/FastPoke) - Immediately optimizes most PokeX() commands in PureBasic. 17 | - [StringConverter](/StringConverter) - Adds methods to easily convert between different string formats. 18 | - [Queue](/Queue) - Adds a Queue to PureBasic using List macros. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Henry de Jongh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Queue/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic Queue 2 | This module adds a Queue to PureBasic using List macros. 3 | 4 | - Uses PureBasic's List for all operations. 5 | - Accepts any data type (Value, String, Structured, ...) list. 6 | - No additional procedure call overhead due to inlining. 7 | 8 | ``` 9 | Queue::Create(TestQueue.s()) 10 | Queue::Enqueue(TestQueue(), "First Value") 11 | Queue::Enqueue(TestQueue(), "Second Value") 12 | Queue::Enqueue(TestQueue(), "Third Value") 13 | 14 | While Not Queue::IsEmpty(TestQueue()) 15 | Queue::Dequeue(TestQueue()) 16 | Debug TestQueue() 17 | Wend 18 | 19 | Queue::Free(TestQueue()) 20 | ``` 21 | 22 | ## Procedures 23 | 24 | ```PureBasic 25 | Queue::Clear(Queue) ; Removes all values from the queue. 26 | Queue::Create(Queue) ; Declares a new dynamic queue list. 27 | Queue::Dequeue(Queue) ; Removes the value at the beginning of the queue. Queue() = Dequeued Value. 28 | Queue::Enqueue(Queue, Value) ; Adds a value to the end of the queue. Queue() = Enqueued Value. 29 | Queue::Free(Queue) ; Frees the specified queue and releases all its associated memory. 30 | Queue::IsEmpty(Queue) ; Returns true if the queue is empty; else false. 31 | Queue::Peek(Queue) ; Selects the value at the beginning of the queue without removing it. 32 | Queue::Size(Queue) ; Returns the number of elements in the queue. 33 | ``` 34 | 35 | ## Implementation Details 36 | Internally uses an additional element at the end of the list so that a dequeued value can still be read. 37 | 38 | Please only use the macros provided to create, manipulate and free the list as they take this element into account. 39 | -------------------------------------------------------------------------------- /StringConverter/README.md: -------------------------------------------------------------------------------- 1 | # PureBasic String Converter 2 | This module adds methods to easily convert between different string formats. 3 | 4 | Through clever string usage PureBasic handles all of the string memory management and cleanup. 5 | 6 | ## Procedures 7 | 8 | ```PureBasic 9 | Procedure.s StringConverter::ToAscii(String.s) ; converts unicode to ascii. 10 | Procedure.s StringConverter::ToUtf8(String.s) ; converts unicode to utf8. 11 | Procedure.s StringConverter::FromAsciiPtr(*String) ; converts ascii string at pointer to unicode. 12 | Procedure.s StringConverter::FromUtf8Ptr(*String) ; converts utf8 string at pointer to unicode. 13 | Procedure.s StringConverter::FromAscii(String.s) ; converts ascii string to unicode. 14 | Procedure.s StringConverter::FromUtf8(String.s) ; converts utf8 string to unicode. 15 | ``` 16 | 17 | ## Implementation Details 18 | PureBasic moved on to having Unicode executables. MessageBoxW instead of MessageBoxA. This means every string is now by default: Unicode. If you pass "Hello World" to a program it's actually "H.e.l.l.o. .W.o.r.l.d." where dots are zero. If you wish to pass in an Ascii string you can use PokeS to write an ascii string into a memory buffer. You can use Ascii(Str) that returns a memory buffer with the Ascii string inside. You have to clean this up yourself. 19 | 20 | Instead of dealing with memory manually I decided to (in case of Unicode to Ascii) create a regular Unicode string. I count the amount of real characters so "Hello" would be 5. I know that a Unicode space character " " is 2 bytes long. I divide the amount of characters 5 by 2 to get 2 (rounded down) and add one for the null terminator. So it creates a unicode string with 3 spaces which is 6 bytes. Now I write the Ascii representation of 5 bytes + null terminator directly into the memory of the 6 byte string using PokeS that converts unicode to ascii. Now you have a string "Hello." that you can pass to an API expecting an Ascii string. And because to PureBasic it's a regular 3 length string it will automatically handle garbage collection and memory management. 21 | 22 | Here is an example with Unicode to Ascii: 23 | 24 | ``` 25 | every unicode space is always 2 bytes. we also need a null terminator. 26 | "" is Len() of 0 /2 is 0 + 1 is 2 bytes "." 27 | "H" is Len() of 1 /2 is 0 + 1 is 2 bytes "H." 28 | "He" is Len() of 2 /2 is 1 + 1 is 4 bytes "He." 29 | "Hel" is Len() of 3 /2 is 1 + 1 is 4 bytes "Hel." 30 | "Hell" is Len() of 4 /2 is 2 + 1 is 6 bytes "Hell." 31 | "Hello" is Len() of 5 /2 is 2 + 1 is 6 bytes "Hello." 32 | ``` 33 | -------------------------------------------------------------------------------- /StringConverter/StringConverter.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** StringConverter.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module adds methods to easily convert between different string formats. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | 8 | DeclareModule StringConverter 9 | Declare.s ToAscii(String.s) ; converts unicode to ascii. 10 | Declare.s ToUtf8(String.s) ; converts unicode to utf8. 11 | Declare.s FromAsciiPtr(*String) ; converts ascii string at pointer to unicode. 12 | Declare.s FromUtf8Ptr(*String) ; converts utf8 string at pointer to unicode. 13 | Declare.s FromAscii(String.s) ; converts ascii string to unicode. 14 | Declare.s FromUtf8(String.s) ; converts utf8 string to unicode. 15 | EndDeclareModule 16 | 17 | Module StringConverter 18 | EnableExplicit 19 | 20 | ; converts unicode to ascii. 21 | Procedure.s ToAscii(String.s) 22 | ; every unicode space is always 2 bytes. we also need a null terminator. 23 | ; "" is Len() of 0 /2 is 0 + 1 is 2 bytes "." 24 | ; "H" is Len() of 1 /2 is 0 + 1 is 2 bytes "H." 25 | ; "He" is Len() of 2 /2 is 1 + 1 is 4 bytes "He." 26 | ; "Hel" is Len() of 3 /2 is 1 + 1 is 4 bytes "Hel." 27 | ; "Hell" is Len() of 4 /2 is 2 + 1 is 6 bytes "Hell." 28 | ; "Hello" is Len() of 5 /2 is 2 + 1 is 6 bytes "Hello." 29 | Protected Result.s = Space((Len(String) / 2) + 1) 30 | PokeS(@Result, String, #PB_Any, #PB_Ascii) 31 | ProcedureReturn Result 32 | EndProcedure 33 | 34 | ; converts unicode to utf8. 35 | Procedure.s ToUtf8(String.s) 36 | ; every unicode space is always 2 bytes. we also need a null terminator. 37 | ; we create a unicode string long enough to hold every utf8 byte. 38 | Protected *Utf8 = UTF8(String) ; convert the unicode string to utf8. 39 | Protected Result.s = Space((MemorySize(*Utf8) / 2) + 1) 40 | CopyMemory(*Utf8, @Result, MemorySize(*Utf8)) 41 | FreeMemory(*Utf8) 42 | ProcedureReturn Result 43 | EndProcedure 44 | 45 | ; converts ascii string at pointer to unicode. 46 | Procedure.s FromAsciiPtr(*String) 47 | ProcedureReturn PeekS(*String, #PB_Any, #PB_Ascii) 48 | EndProcedure 49 | 50 | ; converts utf8 string at pointer to unicode. 51 | Procedure.s FromUtf8Ptr(*String) 52 | ProcedureReturn PeekS(*String, #PB_Any, #PB_UTF8) 53 | EndProcedure 54 | 55 | ; converts ascii string to unicode. 56 | Procedure.s FromAscii(String.s) 57 | ProcedureReturn PeekS(@String, #PB_Any, #PB_Ascii) 58 | EndProcedure 59 | 60 | ; converts utf8 string to unicode. 61 | Procedure.s FromUtf8(String.s) 62 | ProcedureReturn PeekS(@String, #PB_Any, #PB_UTF8) 63 | EndProcedure 64 | EndModule 65 | ; IDE Options = PureBasic 5.71 LTS (Windows - x86) 66 | ; CursorPosition = 63 67 | ; FirstLine = 22 68 | ; Folding = -- 69 | ; EnableXP -------------------------------------------------------------------------------- /Queue/Queue.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** Queue.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module represents a Queue for PureBasic. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | 8 | ; The queue has been implemented using only one-line list macros. 9 | ; • Uses PureBasic's List for all operations. 10 | ; • Accepts any data type (Value, String, Structured, ...) list. 11 | ; • No additional procedure call overhead due to inlining. 12 | ; 13 | ; Internally uses an additional element at the end of the list so that a 14 | ; dequeued value can still be read. Please only use the macros provided to 15 | ; create, manipulate and free the list as they take this element into account. 16 | 17 | DeclareModule Queue 18 | ; --------------------------------------------------------------------------- 19 | ; * Removes all values from the queue. 20 | ; --------------------------------------------------------------------------- 21 | Macro Clear(Queue) :ClearList(Queue):AddElement(Queue): EndMacro 22 | ; --------------------------------------------------------------------------- 23 | ; * Declares a new dynamic queue list. 24 | ; --------------------------------------------------------------------------- 25 | Macro Create(Queue) :NewList Queue:AddElement(Queue): EndMacro 26 | ; --------------------------------------------------------------------------- 27 | ; * Removes the value at the beginning of the queue. Queue() = Dequeued Value 28 | ; --------------------------------------------------------------------------- 29 | Macro Dequeue(Queue) :If Bool(ListSize(Queue) <> 1):SwapElements(Queue, LastElement(Queue), FirstElement(Queue)):DeleteElement(Queue):LastElement(Queue):EndIf: EndMacro 30 | ; --------------------------------------------------------------------------- 31 | ; * Adds a value to the end of the queue. Queue() = Enqueued Value 32 | ; --------------------------------------------------------------------------- 33 | Macro Enqueue(Queue, Value) :LastElement(Queue):InsertElement(Queue):Queue = Value: EndMacro 34 | ; --------------------------------------------------------------------------- 35 | ; * Frees the specified queue and releases all its associated memory. 36 | ; --------------------------------------------------------------------------- 37 | Macro Free(Queue) :FreeList(Queue): EndMacro 38 | ; --------------------------------------------------------------------------- 39 | ; * Returns true if the queue is empty; else false. 40 | ; --------------------------------------------------------------------------- 41 | Macro IsEmpty(Queue) :Bool(ListSize(Queue) = 1): EndMacro 42 | ; --------------------------------------------------------------------------- 43 | ; * Selects the value at the beginning of the queue without removing it. 44 | ; --------------------------------------------------------------------------- 45 | Macro Peek(Queue) :FirstElement(Queue): EndMacro 46 | ; --------------------------------------------------------------------------- 47 | ; * Returns the number of elements in the queue. 48 | ; --------------------------------------------------------------------------- 49 | Macro Size(Queue) :ListSize(Queue) - 1: EndMacro 50 | EndDeclareModule 51 | 52 | Module Queue 53 | 54 | EndModule 55 | ; IDE Options = PureBasic 5.71 LTS (Windows - x64) 56 | ; CursorPosition = 8 57 | ; Folding = -- 58 | ; EnableXP -------------------------------------------------------------------------------- /FastPoke/FastPoke.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** FastPoke.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module optimizes most PokeX() commands in PureBasic. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | 8 | ; Every PokeX() command in PureBasic is a procedure call and will have some 9 | ; overhead because of it. These macros will replace those procedure calls 10 | ; with a simple structure assignment, which will compile down to simple MOV 11 | ; instructions in assembly. Every PokeX() procedure will have its own variable. 12 | ; 13 | ; Simply including this file and compiling your program is enough to gain a 14 | ; performance improvement if you use these procedures a lot. 15 | ; 16 | ; See FastPokeBenchmark.pb for more details and timing information. 17 | 18 | CompilerIf #PB_Compiler_Debugger = 0 ; the debugger must be off to be faster. 19 | 20 | ; unique structure and module name to prevent potential naming conflicts 21 | ; during builds. not accessed inside the module to reduce the build size. 22 | ; externally only the name "OOLaboratories_FastPoke" can be seen. 23 | 24 | Structure OOLaboratories_FastPoke 25 | StructureUnion 26 | B.b 27 | A.a 28 | C.c 29 | W.w 30 | U.u 31 | L.l 32 | I.i 33 | F.f 34 | Q.q 35 | D.d 36 | EndStructureUnion 37 | EndStructure 38 | 39 | DeclareModule OOLaboratories_FastPoke 40 | 41 | Macro Macr0ExpandedCount 42 | MacroExpandedCount 43 | EndMacro 44 | 45 | Macro FastPoke(UniqueID, Type, MemoryBuffer, Number) 46 | CompilerIf #PB_Compiler_Procedure = "" 47 | Define *OOLaboratories_FastPoke_#UniqueID.OOLaboratories_FastPoke = MemoryBuffer 48 | CompilerElse 49 | Protected *OOLaboratories_FastPoke_#UniqueID.OOLaboratories_FastPoke = MemoryBuffer 50 | CompilerEndIf 51 | *OOLaboratories_FastPoke_#UniqueID\Type = Number 52 | EndMacro 53 | 54 | EndDeclareModule : Module OOLaboratories_FastPoke : EndModule 55 | 56 | Macro PokeB(MemoryBuffer, Number) 57 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, B, MemoryBuffer, Number) 58 | EndMacro 59 | 60 | Macro PokeA(MemoryBuffer, Number) 61 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, A, MemoryBuffer, Number) 62 | EndMacro 63 | 64 | Macro PokeC(MemoryBuffer, Number) 65 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, C, MemoryBuffer, Number) 66 | EndMacro 67 | 68 | Macro PokeW(MemoryBuffer, Number) 69 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, W, MemoryBuffer, Number) 70 | EndMacro 71 | 72 | Macro PokeU(MemoryBuffer, Number) 73 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, U, MemoryBuffer, Number) 74 | EndMacro 75 | 76 | Macro PokeL(MemoryBuffer, Number) 77 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, L, MemoryBuffer, Number) 78 | EndMacro 79 | 80 | Macro PokeI(MemoryBuffer, Number) 81 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, I, MemoryBuffer, Number) 82 | EndMacro 83 | 84 | Macro PokeF(MemoryBuffer, Number) 85 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, F, MemoryBuffer, Number) 86 | EndMacro 87 | 88 | Macro PokeQ(MemoryBuffer, Number) 89 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, Q, MemoryBuffer, Number) 90 | EndMacro 91 | 92 | ; this is often slightly slower in the benchmarks (PureBasic 5.73 LTS x64). 93 | ; Macro FPokeD(MemoryBuffer, Number) 94 | ; OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, D, MemoryBuffer, Number) 95 | ; EndMacro 96 | 97 | CompilerEndIf 98 | ; IDE Options = PureBasic 5.73 LTS (Windows - x64) 99 | ; CursorPosition = 87 100 | ; FirstLine = 45 101 | ; Folding = --- 102 | ; EnableXP -------------------------------------------------------------------------------- /FastPoke/FastPokeBenchmark.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** FastPokeBenchmark.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This benchmark will prove the performance increase. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | DisableDebugger 8 | 9 | ; PureBasic 5.73 LTS (x64): 10 | ; PokeB: 1.681286931ms 11 | ; FPokeB: 1.408649087ms 12 | ; PokeA: 1.6890699863ms 13 | ; FPokeA: 1.4598430395ms 14 | ; PokeC: 1.6728429794ms 15 | ; FPokeC: 1.4465870857ms 16 | ; PokeW: 1.713842988ms 17 | ; FPokeW: 1.438740015ms 18 | ; PokeU: 1.7266880274ms 19 | ; FPokeU: 1.4443279505ms 20 | ; PokeI: 1.7178840637ms 21 | ; FPokeI: 1.4886960983ms 22 | ; PokeF: 1.6498479843ms 23 | ; FPokeF: 1.4606429338ms 24 | ; PokeQ: 1.6921709776ms 25 | ; FPokeQ: 1.4533859491ms 26 | ; PokeD: 1.6613630056ms 27 | ; FPokeD: 1.6624130011ms (often slower!) 28 | 29 | Procedure.q ElapsedMicroseconds() 30 | Static Supported.a = #True 31 | Static Frequency.q = 0 32 | Static BeginTime.q = 0 33 | 34 | ; Initialize HPC, get frequency information. 35 | If Frequency = 0 And Supported = #True 36 | ; This function fails on hardware without HPC support. 37 | If Not QueryPerformanceFrequency_(@Frequency) 38 | Supported = #False 39 | BeginTime = ElapsedMilliseconds() 40 | Else 41 | QueryPerformanceCounter_(@BeginTime) 42 | EndIf 43 | EndIf 44 | 45 | Protected Counter.q 46 | If Supported 47 | QueryPerformanceCounter_(@Counter) 48 | Counter - BeginTime 49 | Counter * 1000000 50 | Counter / Frequency 51 | ProcedureReturn Counter 52 | Else 53 | Counter = ElapsedMilliseconds() 54 | Counter - BeginTime 55 | Counter * 1000 56 | ProcedureReturn Counter 57 | EndIf 58 | EndProcedure 59 | 60 | ;------------------------------------------------------------------------------ 61 | 62 | ; unique structure and module name to prevent potential naming conflicts 63 | ; during builds. not accessed inside the module to reduce the build size. 64 | ; externally only the name "OOLaboratories_FastPoke" can be seen. 65 | 66 | Structure OOLaboratories_FastPoke 67 | StructureUnion 68 | B.b 69 | A.a 70 | C.c 71 | W.w 72 | U.u 73 | L.l 74 | I.i 75 | F.f 76 | Q.q 77 | D.d 78 | EndStructureUnion 79 | EndStructure 80 | 81 | DeclareModule OOLaboratories_FastPoke 82 | 83 | Macro Macr0ExpandedCount 84 | MacroExpandedCount 85 | EndMacro 86 | 87 | Macro FastPoke(UniqueID, Type, MemoryBuffer, Number) 88 | CompilerIf #PB_Compiler_Procedure = "" 89 | Define *OOLaboratories_FastPoke_#UniqueID.OOLaboratories_FastPoke = MemoryBuffer 90 | CompilerElse 91 | Protected *OOLaboratories_FastPoke_#UniqueID.OOLaboratories_FastPoke = MemoryBuffer 92 | CompilerEndIf 93 | *OOLaboratories_FastPoke_#UniqueID\Type = Number 94 | EndMacro 95 | 96 | EndDeclareModule : Module OOLaboratories_FastPoke : EndModule 97 | 98 | Macro FPokeB(MemoryBuffer, Number) 99 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, B, MemoryBuffer, Number) 100 | EndMacro 101 | 102 | Macro FPokeA(MemoryBuffer, Number) 103 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, A, MemoryBuffer, Number) 104 | EndMacro 105 | 106 | Macro FPokeC(MemoryBuffer, Number) 107 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, C, MemoryBuffer, Number) 108 | EndMacro 109 | 110 | Macro FPokeW(MemoryBuffer, Number) 111 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, W, MemoryBuffer, Number) 112 | EndMacro 113 | 114 | Macro FPokeU(MemoryBuffer, Number) 115 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, U, MemoryBuffer, Number) 116 | EndMacro 117 | 118 | Macro FPokeL(MemoryBuffer, Number) 119 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, L, MemoryBuffer, Number) 120 | EndMacro 121 | 122 | Macro FPokeI(MemoryBuffer, Number) 123 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, I, MemoryBuffer, Number) 124 | EndMacro 125 | 126 | Macro FPokeF(MemoryBuffer, Number) 127 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, F, MemoryBuffer, Number) 128 | EndMacro 129 | 130 | Macro FPokeQ(MemoryBuffer, Number) 131 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, Q, MemoryBuffer, Number) 132 | EndMacro 133 | 134 | Macro FPokeD(MemoryBuffer, Number) 135 | OOLaboratories_FastPoke::FastPoke(OOLaboratories_FastPoke::Macr0ExpandedCount, D, MemoryBuffer, Number) 136 | EndMacro 137 | ;------------------------------------------------------------------------------ 138 | 139 | Procedure Test() 140 | Protected TestB.b 141 | Protected TestA.a 142 | Protected TestC.c 143 | Protected TestW.w 144 | Protected TestU.u 145 | Protected TestL.l 146 | Protected TestI.i 147 | Protected TestF.f 148 | Protected TestQ.q 149 | Protected TestD.d 150 | 151 | FPokeB(@TestB, 123) : If TestB = 123 : PrintN("FPokeB OK") : Else : PrintN("FpokeB ERROR") : EndIf 152 | FPokeA(@TestA, 123) : If TestA = 123 : PrintN("FPokeA OK") : Else : PrintN("FpokeA ERROR") : EndIf 153 | FPokeC(@TestC, 123) : If TestC = 123 : PrintN("FPokeC OK") : Else : PrintN("FpokeC ERROR") : EndIf 154 | FPokeW(@TestW, 123) : If TestW = 123 : PrintN("FPokeW OK") : Else : PrintN("FpokeW ERROR") : EndIf 155 | FPokeU(@TestU, 123) : If TestU = 123 : PrintN("FPokeU OK") : Else : PrintN("FpokeU ERROR") : EndIf 156 | FPokeL(@TestL, 123) : If TestL = 123 : PrintN("FPokeL OK") : Else : PrintN("FpokeL ERROR") : EndIf 157 | FPokeI(@TestI, 123) : If TestI = 123 : PrintN("FPokeI OK") : Else : PrintN("FpokeI ERROR") : EndIf 158 | FPokeF(@TestF, 123) : If TestF = 123 : PrintN("FPokeF OK") : Else : PrintN("FpokeF ERROR") : EndIf 159 | FPokeQ(@TestQ, 123) : If TestQ = 123 : PrintN("FPokeQ OK") : Else : PrintN("FpokeQ ERROR") : EndIf 160 | FPokeD(@TestD, 123) : If TestD = 123 : PrintN("FPokeD OK") : Else : PrintN("FpokeD ERROR") : EndIf 161 | PrintN("-------------------------------------------") 162 | FPokeB(@TestB, 125) : If TestB = 125 : PrintN("FPokeB OK") : Else : PrintN("FpokeB ERROR") : EndIf 163 | FPokeA(@TestA, 175) : If TestA = 175 : PrintN("FPokeA OK") : Else : PrintN("FpokeA ERROR") : EndIf 164 | FPokeC(@TestC, 175) : If TestC = 175 : PrintN("FPokeC OK") : Else : PrintN("FpokeC ERROR") : EndIf 165 | FPokeW(@TestW, 175) : If TestW = 175 : PrintN("FPokeW OK") : Else : PrintN("FpokeW ERROR") : EndIf 166 | FPokeU(@TestU, 175) : If TestU = 175 : PrintN("FPokeU OK") : Else : PrintN("FpokeU ERROR") : EndIf 167 | FPokeL(@TestL, 175) : If TestL = 175 : PrintN("FPokeL OK") : Else : PrintN("FpokeL ERROR") : EndIf 168 | FPokeI(@TestI, 175) : If TestI = 175 : PrintN("FPokeI OK") : Else : PrintN("FpokeI ERROR") : EndIf 169 | FPokeF(@TestF, 175) : If TestF = 175 : PrintN("FPokeF OK") : Else : PrintN("FpokeF ERROR") : EndIf 170 | FPokeQ(@TestQ, 175) : If TestQ = 175 : PrintN("FPokeQ OK") : Else : PrintN("FpokeQ ERROR") : EndIf 171 | FPokeD(@TestD, 175) : If TestD = 175 : PrintN("FPokeD OK") : Else : PrintN("FpokeD ERROR") : EndIf 172 | PrintN("-------------------------------------------") 173 | FPokeB(@TestB, 112) : If TestB = 112 : PrintN("FPokeB OK") : Else : PrintN("FpokeB ERROR") : EndIf 174 | FPokeA(@TestA, 112) : If TestA = 112 : PrintN("FPokeA OK") : Else : PrintN("FpokeA ERROR") : EndIf 175 | FPokeC(@TestC, 112) : If TestC = 112 : PrintN("FPokeC OK") : Else : PrintN("FpokeC ERROR") : EndIf 176 | FPokeW(@TestW, 112) : If TestW = 112 : PrintN("FPokeW OK") : Else : PrintN("FpokeW ERROR") : EndIf 177 | FPokeU(@TestU, 112) : If TestU = 112 : PrintN("FPokeU OK") : Else : PrintN("FpokeU ERROR") : EndIf 178 | FPokeL(@TestL, 112) : If TestL = 112 : PrintN("FPokeL OK") : Else : PrintN("FpokeL ERROR") : EndIf 179 | FPokeI(@TestI, 112) : If TestI = 112 : PrintN("FPokeI OK") : Else : PrintN("FpokeI ERROR") : EndIf 180 | FPokeF(@TestF, 112) : If TestF = 112 : PrintN("FPokeF OK") : Else : PrintN("FpokeF ERROR") : EndIf 181 | FPokeQ(@TestQ, 112) : If TestQ = 112 : PrintN("FPokeQ OK") : Else : PrintN("FpokeQ ERROR") : EndIf 182 | FPokeD(@TestD, 112) : If TestD = 112 : PrintN("FPokeD OK") : Else : PrintN("FpokeD ERROR") : EndIf 183 | PrintN("-------------------------------------------") 184 | EndProcedure 185 | 186 | Procedure Benchmark() 187 | Protected TestB.b 188 | Protected TestA.a 189 | Protected TestC.c 190 | Protected TestW.w 191 | Protected TestU.u 192 | Protected TestL.l 193 | Protected TestI.i 194 | Protected TestF.f 195 | Protected TestQ.q 196 | Protected TestD.d 197 | 198 | Protected I.l, J.l 199 | Protected B1.l, B2.l, AVG1.f 200 | Protected E1.l, E2.l, AVG2.f 201 | 202 | For J = 1 To 100 203 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeB(@TestB, 123) : Next : E1 = ElapsedMicroseconds() 204 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeB(@TestB, 123) : Next : E2 = ElapsedMicroseconds() 205 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 206 | Next 207 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeB: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeB: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 208 | 209 | For J = 1 To 100 210 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeA(@TestA, 123) : Next : E1 = ElapsedMicroseconds() 211 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeA(@TestA, 123) : Next : E2 = ElapsedMicroseconds() 212 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 213 | Next 214 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeA: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeA: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 215 | 216 | For J = 1 To 100 217 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeC(@TestC, 123) : Next : E1 = ElapsedMicroseconds() 218 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeC(@TestC, 123) : Next : E2 = ElapsedMicroseconds() 219 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 220 | Next 221 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeC: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeC: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 222 | 223 | For J = 1 To 100 224 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeW(@TestW, 123) : Next : E1 = ElapsedMicroseconds() 225 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeW(@TestW, 123) : Next : E2 = ElapsedMicroseconds() 226 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 227 | Next 228 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeW: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeW: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 229 | 230 | For J = 1 To 100 231 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeU(@TestU, 123) : Next : E1 = ElapsedMicroseconds() 232 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeU(@TestU, 123) : Next : E2 = ElapsedMicroseconds() 233 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 234 | Next 235 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeU: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeU: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 236 | 237 | For J = 1 To 100 238 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeI(@TestI, 123) : Next : E1 = ElapsedMicroseconds() 239 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeI(@TestI, 123) : Next : E2 = ElapsedMicroseconds() 240 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 241 | Next 242 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeI: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeI: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 243 | 244 | For J = 1 To 100 245 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeF(@TestF, 123) : Next : E1 = ElapsedMicroseconds() 246 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeF(@TestF, 123) : Next : E2 = ElapsedMicroseconds() 247 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 248 | Next 249 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeF: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeF: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 250 | 251 | For J = 1 To 100 252 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeQ(@TestQ, 123) : Next : E1 = ElapsedMicroseconds() 253 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeQ(@TestQ, 123) : Next : E2 = ElapsedMicroseconds() 254 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 255 | Next 256 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeQ: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeQ: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 257 | 258 | For J = 1 To 100 259 | B1 = ElapsedMicroseconds() : For I = 0 To 10000000 : PokeD(@TestD, 123) : Next : E1 = ElapsedMicroseconds() 260 | B2 = ElapsedMicroseconds() : For I = 0 To 10000000 : FPokeD(@TestD, 123) : Next : E2 = ElapsedMicroseconds() 261 | AVG1 + (E1 - B1) : AVG2 + (E2 - B2) 262 | Next 263 | AVG1 / 1000.0 : AVG2 / 1000.0 : PrintN("PokeD: " + StrF(AVG1 / 1000) + "ms") : PrintN("FPokeD: " + StrF(AVG2 / 1000) + "ms") : AVG1 = 0 : AVG2 = 0 264 | 265 | While Inkey() = "" 266 | Delay(100) 267 | Wend 268 | CloseConsole() 269 | EndProcedure 270 | 271 | OpenConsole("FastPoke Benchmark") 272 | Test() 273 | Benchmark() 274 | ; IDE Options = PureBasic 5.73 LTS (Windows - x64) 275 | ; CursorPosition = 26 276 | ; FirstLine = 3 277 | ; Folding = --- 278 | ; EnableXP 279 | ; Executable = XX.exe 280 | ; DisableDebugger -------------------------------------------------------------------------------- /DevIL/DevIL.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** DevIL.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module represents a DevIL header to import Development Image Library. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | 8 | ;-------------------------------------------------------------------------- 9 | ; * DevIL Constants 10 | ;-------------------------------------------------------------------------- 11 | #IL_FALSE = 0 12 | #IL_TRUE = 1 13 | ;-------------------------------------------------------------------------- 14 | ; * Data Formats 15 | ;-------------------------------------------------------------------------- 16 | #IL_COLOUR_INDEX = $1900 17 | #IL_COLOR_INDEX = $1900 18 | #IL_ALPHA = $1906 19 | #IL_RGB = $1907 20 | #IL_RGBA = $1908 21 | #IL_BGR = $80E0 22 | #IL_BGRA = $80E1 23 | #IL_LUMINANCE = $1909 24 | #IL_LUMINANCE_ALPHA = $190A 25 | ;-------------------------------------------------------------------------- 26 | ; * Data Types 27 | ;-------------------------------------------------------------------------- 28 | #IL_BYTE = $1400 29 | #IL_UNSIGNED_BYTE = $1401 30 | #IL_SHORT = $1402 31 | #IL_UNSIGNED_SHORT = $1403 32 | #IL_INT = $1404 33 | #IL_UNSIGNED_INT = $1405 34 | #IL_FLOAT = $1406 35 | #IL_DOUBLE = $140A 36 | #IL_HALF = $140B 37 | ;-------------------------------------------------------------------------- 38 | ; * Miscellaneous 39 | ;-------------------------------------------------------------------------- 40 | #IL_VENDOR = $1F00 41 | #IL_LOAD_EXT = $1F01 42 | #IL_SAVE_EXT = $1F02 43 | ;-------------------------------------------------------------------------- 44 | ; * Library Specific 45 | ;-------------------------------------------------------------------------- 46 | #IL_VERSION_1_7_8 = 1 47 | #IL_VERSION = 178 48 | ;-------------------------------------------------------------------------- 49 | ; * Attribute Bits 50 | ;-------------------------------------------------------------------------- 51 | #IL_ORIGIN_BIT = $00000001 52 | #IL_FILE_BIT = $00000002 53 | #IL_PAL_BIT = $00000004 54 | #IL_FORMAT_BIT = $00000008 55 | #IL_TYPE_BIT = $00000010 56 | #IL_COMPRESS_BIT = $00000020 57 | #IL_LOADFAIL_BIT = $00000040 58 | #IL_FORMAT_SPECIFIC_BIT = $00000080 59 | #IL_ALL_ATTRIB_BITS = $000FFFFF 60 | ;-------------------------------------------------------------------------- 61 | ; * Palette Types 62 | ;-------------------------------------------------------------------------- 63 | #IL_PAL_NONE = $0400 64 | #IL_PAL_RGB24 = $0401 65 | #IL_PAL_RGB32 = $0402 66 | #IL_PAL_RGBA32 = $0403 67 | #IL_PAL_BGR24 = $0404 68 | #IL_PAL_BGR32 = $0405 69 | #IL_PAL_BGRA32 = $0406 70 | ;-------------------------------------------------------------------------- 71 | ; * Image Types 72 | ;-------------------------------------------------------------------------- 73 | #IL_TYPE_UNKNOWN = $0000 ; Unknown Type 74 | #IL_BMP = $0420 ; Microsoft Windows Bitmap - .bmp extension 75 | #IL_CUT = $0421 ; Dr. Halo - .cut extension 76 | #IL_DOOM = $0422 ; DooM walls - no specific extension 77 | #IL_DOOM_FLAT = $0423 ; DooM flats - no specific extension 78 | #IL_ICO = $0424 ; Microsoft Windows Icons And Cursors - .ico And .cur extensions 79 | #IL_JPG = $0425 ; JPEG - .jpg, .jpe And .jpeg extensions 80 | #IL_JFIF = $0425 ; 81 | #IL_ILBM = $0426 ; Amiga IFF (FORM ILBM) - .iff, .ilbm, .lbm extensions 82 | #IL_PCD = $0427 ; Kodak PhotoCD - .pcd extension 83 | #IL_PCX = $0428 ; ZSoft PCX - .pcx extension 84 | #IL_PIC = $0429 ; PIC - .pic extension 85 | #IL_PNG = $042A ; Portable Network Graphics - .png extension 86 | #IL_PNM = $042B ; Portable Any Map - .pbm, .pgm, .ppm And .pnm extensions 87 | #IL_SGI = $042C ; Silicon Graphics - .sgi, .bw, .rgb And .rgba extensions 88 | #IL_TGA = $042D ; TrueVision Targa File - .tga, .vda, .icb And .vst extensions 89 | #IL_TIF = $042E ; Tagged Image File Format - .tif And .tiff extensions 90 | #IL_CHEAD = $042F ; C-Style Header - .h extension 91 | #IL_RAW = $0430 ; Raw Image Data - any extension 92 | #IL_MDL = $0431 ; Half-Life Model Texture - .mdl extension 93 | #IL_WAL = $0432 ; Quake 2 Texture - .wal extension 94 | #IL_LIF = $0434 ; Homeworld Texture - .lif extension 95 | #IL_MNG = $0435 ; Multiple-image Network Graphics - .mng extension 96 | #IL_JNG = $0435 ; 97 | #IL_GIF = $0436 ; Graphics Interchange Format - .gif extension 98 | #IL_DDS = $0437 ; DirectDraw Surface - .dds extension 99 | #IL_DCX = $0438 ; ZSoft Multi-PCX - .dcx extension 100 | #IL_PSD = $0439 ; Adobe PhotoShop - .psd extension 101 | #IL_EXIF = $043A ; 102 | #IL_PSP = $043B ; PaintShop Pro - .psp extension 103 | #IL_PIX = $043C ; PIX - .pix extension 104 | #IL_PXR = $043D ; Pixar - .pxr extension 105 | #IL_XPM = $043E ; X Pixel Map - .xpm extension 106 | #IL_HDR = $043F ; Radiance High Dynamic Range - .hdr extension 107 | #IL_ICNS = $0440 ; Macintosh Icon - .icns extension 108 | #IL_JP2 = $0441 ; Jpeg 2000 - .jp2 extension 109 | #IL_EXR = $0442 ; OpenEXR - .exr extension 110 | #IL_WDP = $0443 ; Microsoft HD Photo - .wdp And .hdp extension 111 | #IL_VTF = $0444 ; Valve Texture Format - .vtf extension 112 | #IL_WBMP = $0445 ; Wireless Bitmap - .wbmp extension 113 | #IL_SUN = $0446 ; Sun Raster - .sun, .ras, .rs, .im1, .im8, .im24 And .im32 extensions 114 | #IL_IFF = $0447 ; Interchange File Format - .iff extension 115 | #IL_TPL = $0448 ; Gamecube Texture - .tpl extension 116 | #IL_FITS = $0449 ; Flexible Image Transport System - .fit And .fits extensions 117 | #IL_DICOM = $044A ; Digital Imaging And Communications in Medicine (DICOM) - .dcm And .dicom extensions 118 | #IL_IWI = $044B ; Call of Duty Infinity Ward Image - .iwi extension 119 | #IL_BLP = $044C ; Blizzard Texture Format - .blp extension 120 | #IL_FTX = $044D ; Heavy Metal: FAKK2 Texture - .ftx extension 121 | #IL_ROT = $044E ; Homeworld 2 - Relic Texture - .rot extension 122 | #IL_TEXTURE = $044F ; Medieval II: Total War Texture - .texture extension 123 | #IL_DPX = $0450 ; Digital Picture Exchange - .dpx extension 124 | #IL_UTX = $0451 ; Unreal (And Unreal Tournament) Texture - .utx extension 125 | #IL_MP3 = $0452 ; MPEG-1 Audio Layer 3 - .mp3 extension 126 | #IL_JASC_PAL = $0475 ; PaintShop Pro Palette 127 | ;-------------------------------------------------------------------------- 128 | ; * Error Types 129 | ;-------------------------------------------------------------------------- 130 | #IL_NO_ERROR = $0000 131 | #IL_INVALID_ENUM = $0501 132 | #IL_OUT_OF_MEMORY = $0502 133 | #IL_FORMAT_NOT_SUPPORTED = $0503 134 | #IL_INTERNAL_ERROR = $0504 135 | #IL_INVALID_VALUE = $0505 136 | #IL_ILLEGAL_OPERATION = $0506 137 | #IL_ILLEGAL_FILE_VALUE = $0507 138 | #IL_INVALID_FILE_HEADER = $0508 139 | #IL_INVALID_PARAM = $0509 140 | #IL_COULD_NOT_OPEN_FILE = $050A 141 | #IL_INVALID_EXTENSION = $050B 142 | #IL_FILE_ALREADY_EXISTS = $050C 143 | #IL_OUT_FORMAT_SAME = $050D 144 | #IL_STACK_OVERFLOW = $050E 145 | #IL_STACK_UNDERFLOW = $050F 146 | #IL_INVALID_CONVERSION = $0510 147 | #IL_BAD_DIMENSIONS = $0511 148 | #IL_FILE_READ_ERROR = $0512 149 | #IL_FILE_WRITE_ERROR = $0512 150 | ;-------------------------------------------------------------------------- 151 | #IL_LIB_GIF_ERROR = $05E1 152 | #IL_LIB_JPEG_ERROR = $05E2 153 | #IL_LIB_PNG_ERROR = $05E3 154 | #IL_LIB_TIFF_ERROR = $05E4 155 | #IL_LIB_MNG_ERROR = $05E5 156 | #IL_LIB_JP2_ERROR = $05E6 157 | #IL_LIB_EXR_ERROR = $05E7 158 | #IL_UNKNOWN_ERROR = $05FF 159 | ;-------------------------------------------------------------------------- 160 | ; * Origin Definitions 161 | ;-------------------------------------------------------------------------- 162 | #IL_ORIGIN_SET = $0600 163 | #IL_ORIGIN_LOWER_LEFT = $0601 164 | #IL_ORIGIN_UPPER_LEFT = $0602 165 | #IL_ORIGIN_MODE = $0603 166 | ;-------------------------------------------------------------------------- 167 | ; * Format and Type Mode Definitions 168 | ;-------------------------------------------------------------------------- 169 | #IL_FORMAT_SET = $0610 170 | #IL_FORMAT_MODE = $0611 171 | #IL_TYPE_SET = $0612 172 | #IL_TYPE_MODE = $0613 173 | ;-------------------------------------------------------------------------- 174 | ; * File Definitions 175 | ;-------------------------------------------------------------------------- 176 | #IL_FILE_OVERWRITE = $0620 177 | #IL_FILE_MODE = $0621 178 | ;-------------------------------------------------------------------------- 179 | ; * Palette Definitions 180 | ;-------------------------------------------------------------------------- 181 | #IL_CONV_PAL = $0630 182 | ;-------------------------------------------------------------------------- 183 | ; * Load Fail Definitons 184 | ;-------------------------------------------------------------------------- 185 | #IL_DEFAULT_ON_FAIL = $0632 186 | ;-------------------------------------------------------------------------- 187 | ; * Key Colour and Alpha Definitons 188 | ;-------------------------------------------------------------------------- 189 | #IL_USE_KEY_COLOUR = $0635 190 | #IL_USE_KEY_COLOR = $0635 191 | #IL_BLIT_BLEND = $0636 192 | ;-------------------------------------------------------------------------- 193 | ; * Interlace Definitions 194 | ;-------------------------------------------------------------------------- 195 | #IL_SAVE_INTERLACED = $0639 196 | #IL_INTERLACE_MODE = $063A 197 | ;-------------------------------------------------------------------------- 198 | ; * Quantization Definitoons 199 | ;-------------------------------------------------------------------------- 200 | #IL_QUANTIZATION_MODE = $0640 201 | #IL_WU_QUANT = $0641 202 | #IL_NEU_QUANT = $0642 203 | #IL_NEU_QUANT_SAMPLE = $0643 204 | #IL_MAX_QUANT_INDEXS = $0644 205 | #IL_MAX_QUANT_INDICES = $0644 206 | ;-------------------------------------------------------------------------- 207 | ; * Hints 208 | ;-------------------------------------------------------------------------- 209 | #IL_FASTEST = $0660 210 | #IL_LESS_MEM = $0661 211 | #IL_DONT_CARE = $0662 212 | #IL_MEM_SPEED_HINT = $0665 213 | #IL_USE_COMPRESSION = $0666 214 | #IL_NO_COMPRESSION = $0667 215 | #IL_COMPRESSION_HINT = $0668 216 | ;-------------------------------------------------------------------------- 217 | ; * Compression 218 | ;-------------------------------------------------------------------------- 219 | #IL_NVIDIA_COMPRESS = $0670 220 | #IL_SQUISH_COMPRESS = $0671 221 | ;-------------------------------------------------------------------------- 222 | ; * Subimage Types 223 | ;-------------------------------------------------------------------------- 224 | #IL_SUB_NEXT = $0680 225 | #IL_SUB_MIPMAP = $0681 226 | #IL_SUB_LAYER = $0682 227 | ;-------------------------------------------------------------------------- 228 | ; * Compression Definitions 229 | ;-------------------------------------------------------------------------- 230 | #IL_COMPRESS_MODE = $0700 231 | #IL_COMPRESS_NONE = $0701 232 | #IL_COMPRESS_RLE = $0702 233 | #IL_COMPRESS_LZO = $0703 234 | #IL_COMPRESS_ZLIB = $0704 235 | ;-------------------------------------------------------------------------- 236 | ; * File Format Specific Values 237 | ;-------------------------------------------------------------------------- 238 | #IL_TGA_CREATE_STAMP = $0710 239 | #IL_JPG_QUALITY = $0711 240 | #IL_PNG_INTERLACE = $0712 241 | #IL_TGA_RLE = $0713 242 | #IL_BMP_RLE = $0714 243 | #IL_SGI_RLE = $0715 244 | #IL_TGA_ID_STRING = $0717 245 | #IL_TGA_AUTHNAME_STRING = $0718 246 | #IL_TGA_AUTHCOMMENT_STRING = $0719 247 | #IL_PNG_AUTHNAME_STRING = $071A 248 | #IL_PNG_TITLE_STRING = $071B 249 | #IL_PNG_DESCRIPTION_STRING = $071C 250 | #IL_TIF_DESCRIPTION_STRING = $071D 251 | #IL_TIF_HOSTCOMPUTER_STRING = $071E 252 | #IL_TIF_DOCUMENTNAME_STRING = $071F 253 | #IL_TIF_AUTHNAME_STRING = $0720 254 | #IL_JPG_SAVE_FORMAT = $0721 255 | #IL_CHEAD_HEADER_STRING = $0722 256 | #IL_PCD_PICNUM = $0723 257 | #IL_PNG_ALPHA_INDEX = $0724 258 | #IL_JPG_PROGRESSIVE = $0725 259 | #IL_VTF_COMP = $0726 260 | ;-------------------------------------------------------------------------- 261 | ; * DXTC Definitions 262 | ;-------------------------------------------------------------------------- 263 | #IL_DXTC_FORMAT = $0705 264 | #IL_DXT1 = $0706 265 | #IL_DXT2 = $0707 266 | #IL_DXT3 = $0708 267 | #IL_DXT4 = $0709 268 | #IL_DXT5 = $070A 269 | #IL_DXT_NO_COMP = $070B 270 | #IL_KEEP_DXTC_DATA = $070C 271 | #IL_DXTC_DATA_FORMAT = $070D 272 | #IL_3DC = $070E 273 | #IL_RXGB = $070F 274 | #IL_ATI1N = $0710 275 | #IL_DXT1A = $0711 276 | ;-------------------------------------------------------------------------- 277 | ; * Environment Map Definitions 278 | ;-------------------------------------------------------------------------- 279 | #IL_CUBEMAP_POSITIVEX = $00000400 280 | #IL_CUBEMAP_NEGATIVEX = $00000800 281 | #IL_CUBEMAP_POSITIVEY = $00001000 282 | #IL_CUBEMAP_NEGATIVEY = $00002000 283 | #IL_CUBEMAP_POSITIVEZ = $00004000 284 | #IL_CUBEMAP_NEGATIVEZ = $00008000 285 | #IL_SPHEREMAP = $00010000 286 | ;-------------------------------------------------------------------------- 287 | ; * Miscellaneous Values 288 | ;-------------------------------------------------------------------------- 289 | #IL_VERSION_NUM = $0DE2 290 | #IL_IMAGE_WIDTH = $0DE4 291 | #IL_IMAGE_HEIGHT = $0DE5 292 | #IL_IMAGE_DEPTH = $0DE6 293 | #IL_IMAGE_SIZE_OF_DATA = $0DE7 294 | #IL_IMAGE_BPP = $0DE8 295 | #IL_IMAGE_BYTES_PER_PIXEL = $0DE8 296 | #IL_IMAGE_BPP = $0DE8 297 | #IL_IMAGE_BITS_PER_PIXEL = $0DE9 298 | #IL_IMAGE_FORMAT = $0DEA 299 | #IL_IMAGE_TYPE = $0DEB 300 | #IL_PALETTE_TYPE = $0DEC 301 | #IL_PALETTE_SIZE = $0DED 302 | #IL_PALETTE_BPP = $0DEE 303 | #IL_PALETTE_NUM_COLS = $0DEF 304 | #IL_PALETTE_BASE_TYPE = $0DF0 305 | #IL_NUM_FACES = $0DE1 306 | #IL_NUM_IMAGES = $0DF1 307 | #IL_NUM_MIPMAPS = $0DF2 308 | #IL_NUM_LAYERS = $0DF3 309 | #IL_ACTIVE_IMAGE = $0DF4 310 | #IL_ACTIVE_MIPMAP = $0DF5 311 | #IL_ACTIVE_LAYER = $0DF6 312 | #IL_ACTIVE_FACE = $0E00 313 | #IL_CUR_IMAGE = $0DF7 314 | #IL_IMAGE_DURATION = $0DF8 315 | #IL_IMAGE_PLANESIZE = $0DF9 316 | #IL_IMAGE_BPC = $0DFA 317 | #IL_IMAGE_OFFX = $0DFB 318 | #IL_IMAGE_OFFY = $0DFC 319 | #IL_IMAGE_CUBEFLAGS = $0DFD 320 | #IL_IMAGE_ORIGIN = $0DFE 321 | #IL_IMAGE_CHANNELS = $0DFF 322 | ;-------------------------------------------------------------------------- 323 | ; * DevIL Methods 324 | ;-------------------------------------------------------------------------- 325 | Import "DevIL.lib" 326 | ilActiveFace.a(Number.i) 327 | ilActiveImage.a(Number.i) 328 | ilActiveLayer.a(Number.i) 329 | ilActiveMipmap.a(Number.i) 330 | ilApplyPal.a(FileName$) 331 | ilApplyProfile.a(*InProfile, *OutProfile) 332 | ilBindImage(Image.i) 333 | ilBlit.a(Source.i, DestX.i, DestY.i, DestZ.i, SrcX.i, SrcY.i, SrcZ.i, Width.i, Height.i, Depth.i) 334 | ilClampNTSC.a() 335 | ilClearColour.a(Red.f, Green.f, Blue.f, Alpha.f) 336 | ilClearImage() 337 | ilCloneCurImage.i() 338 | ilCompressDXT.l(*pData, Width.i, Height.i, Depth.i, DXTCFormat.i, *DXTCSize) 339 | ilCompressFunc.a(Mode.i) 340 | ilConvertImage.a(DestFormat.i, DestType.i) 341 | ilConvertPal.a(DestFormat.i) 342 | ilCopyImage.a(Src.i) 343 | ilCopyPixels.i(XOff.i, YOff.i, ZOff.i, Width.i, Height.i, Depth.i, Format.i, Type.i, *pData) 344 | ilCreateSubImage.i(Type.i, Num.i) 345 | ilDefaultImage.a() 346 | ilDeleteImage(Num.i) 347 | ilDeleteImages(Num.i, *Images) 348 | ilDetermineType.i(FileName$) 349 | ilDetermineTypeF.i(File.l) 350 | ilDetermineTypeL.i(*Lump, Size.i) 351 | ilDisable.a(Mode.i) 352 | ilDxtcDataToImage.a() 353 | ilDxtcDataToSurface.a() 354 | ilEnable.a(Mode.i) 355 | ilFlipSurfaceDxtcData() 356 | ilFormatFunc.a(Mode.i) 357 | ilGenImages(Num.i, *Images) 358 | ilGenImage.i() 359 | ilGetAlpha.l(Type.i) 360 | ilGetBoolean.a(Mode.i) 361 | ilGetBooleanv(Mode.i, *Param) 362 | ilGetData.a() 363 | ilGetDXTCData.i( *Buffer, BufferSize.i, DXTCFormat.i) 364 | ilGetError.i() 365 | ilGetInteger.i(Mode.i) 366 | ilGetIntegerv(Mode.i, *Param) 367 | ilGetLumpPos.i() 368 | ilGetPalette.l() 369 | ilGetString.l(StringName.i) 370 | ilHint(Target.i, Mode.i) 371 | ilInvertSurfaceDxtcDataAlpha.a() 372 | ilInit() 373 | ilImageToDxtcData.a(Format.i) 374 | ilIsDisabled.a(Mode.i) 375 | ilIsEnabled.a(Mode.i) 376 | ilIsImage.a(Image.i) 377 | ilIsValid.a(Type.i, FileName$) 378 | ilIsValidF.a(Type.i, File.l) 379 | ilIsValidL.a(Type.i, *Lump, Size.i) 380 | ilKeyColour(Red.f, Green.f, Blue.f, Alpha.f) 381 | ilLoad.a(Type.i, FileName$) 382 | ilLoadF.a(Type.i, File.l) 383 | ilLoadImage.a(FileName$) 384 | ilLoadL.a(Type.i, *Lump, Size.i) 385 | ilLoadPal.a(FileName$) 386 | ilModAlpha(AlphaValue.d) 387 | ilOriginFunc.a(Mode.i) 388 | ilOverlayImage.a(Source.i, XCoord.i, YCoord.i, ZCoord.i) 389 | ilPopAttrib() 390 | ilPushAttrib(Bits.i) 391 | ilRegisterFormat(Format.i) 392 | ilRegisterLoad.a(Ext$, *LoadProcedure) 393 | ilRegisterMipNum.a(Num.i) 394 | ilRegisterNumFaces.a(Num.i) 395 | ilRegisterNumImages.a(Num.i) 396 | ilRegisterOrigin(Origin.i) 397 | ilRegisterPal(*Pal, Size.i, Type.i) 398 | ilRegisterSave.a(Ext$, *SaveProcedure) 399 | ilRegisterType(Type.i) 400 | ilRemoveLoad.a(Ext$) 401 | ilRemoveSave.a(Ext$) 402 | ilResetRead() 403 | ilResetWrite() 404 | ilSave.a(Type.i, FileName$) 405 | ilSaveF.i(Type.i, File.l) 406 | ilSaveImage.a(FileName$) 407 | ilSaveL.i(Type.i, *Lump, Size.i) 408 | ilSavePal.a(FileName$) 409 | ilSetAlpha.a(AlphaValue.d) 410 | ilSetData.a(*pData) 411 | ilSetDuration.a(Duration.i) 412 | ilSetInteger(Mode.i, Param.i) 413 | ilSetMemory(*mAlloc, *mFree) 414 | ilSetPixels(XOff.i, YOff.i, ZOff.i, Width.i, Height.i, Depth.i, Format.i, Type.i, *pData) 415 | ilSetRead(*fOpenRProc, *fCloseRProc, *fEofProc, *fGetcProc, *fReadProc, *fSeekRProc, *fTellRProc) 416 | ilSetString(Mode.i, *String) 417 | ilSetWrite(*fOpenWProc, *fCloseWProc, *fPutcProc, *fSeekWProc, *fTellWProc, *fWriteProc) 418 | ilShutDown() 419 | ilSurfaceToDxtcData.a(Format.i) 420 | ilTexImage.a(Width.i, Height.i, Depth.i, NumChannels.a, Format.i, Type.i, *pData) 421 | ilTexImageDxtc.a(w.i, h.i, d.i, DxtFormat.i, *pData) 422 | ilTypeFromExt.i(FileName$) 423 | ilTypeFunc.a(Mode.i) 424 | ilLoadData.a(FileName$, Width.i, Height.i, Depth.i, Bpp.a) 425 | ilLoadDataF.a(File.l, Width.i, Height.i, Depth.i, Bpp.a) 426 | ilLoadDataL.a(*Lump, Size.i, Width.i, Height.i, Depth.i, Bpp.a) 427 | ilSaveData.a(FileName$) 428 | EndImport 429 | ; IDE Options = PureBasic 5.71 LTS (Windows - x86) 430 | ; CursorPosition = 3 431 | ; EnableXP -------------------------------------------------------------------------------- /Libsndfile/Libsndfile.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** Libsndfile.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module represents a libsndfile header to im/export sound file formats. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | IncludeFile #PB_Compiler_File + "i" ;- PBHGEN 8 | 9 | ;-------------------------------------------------------------------------- 10 | Global DLL_LSF.i ; DLL Handle 11 | ;-------------------------------------------------------------------------- 12 | ; * Major formats 13 | ;-------------------------------------------------------------------------- 14 | #SF_FORMAT_WAV = $010000 ; Microsoft WAV format (little endian default). 15 | #SF_FORMAT_AIFF = $020000 ; Apple/SGI AIFF format (big endian). 16 | #SF_FORMAT_AU = $030000 ; Sun/NeXT AU format (big endian). 17 | #SF_FORMAT_RAW = $040000 ; RAW PCM data. 18 | #SF_FORMAT_PAF = $050000 ; Ensoniq PARIS file format. 19 | #SF_FORMAT_SVX = $060000 ; Amiga IFF / SVX8 / SV16 format. 20 | #SF_FORMAT_NIST = $070000 ; Sphere NIST format. 21 | #SF_FORMAT_VOC = $080000 ; VOC files. 22 | #SF_FORMAT_IRCAM = $0A0000 ; Berkeley/IRCAM/CARL 23 | #SF_FORMAT_W64 = $0B0000 ; Sonic Foundry's 64 bit RIFF/WAV 24 | #SF_FORMAT_MAT4 = $0C0000 ; Matlab (tm) V4.2 / GNU Octave 2.0 25 | #SF_FORMAT_MAT5 = $0D0000 ; Matlab (tm) V5.0 / GNU Octave 2.1 26 | #SF_FORMAT_PVF = $0E0000 ; Portable Voice Format 27 | #SF_FORMAT_XI = $0F0000 ; Fasttracker 2 Extended Instrument 28 | #SF_FORMAT_HTK = $100000 ; HMM Tool Kit format 29 | #SF_FORMAT_SDS = $110000 ; Midi Sample Dump Standard 30 | #SF_FORMAT_AVR = $120000 ; Audio Visual Research 31 | #SF_FORMAT_WAVEX = $130000 ; MS WAVE with WAVEFORMATEX 32 | #SF_FORMAT_SD2 = $160000 ; Sound Designer 2 33 | #SF_FORMAT_FLAC = $170000 ; FLAC lossless file format 34 | #SF_FORMAT_CAF = $180000 ; Core Audio File format 35 | #SF_FORMAT_WVE = $190000 ; Psion WVE format 36 | #SF_FORMAT_OGG = $200000 ; Xiph OGG container 37 | #SF_FORMAT_MPC2K = $210000 ; Akai MPC 2000 sampler 38 | #SF_FORMAT_RF64 = $220000 ; RF64 WAV file 39 | ;-------------------------------------------------------------------------- 40 | ; * Subtypes from here on 41 | ;-------------------------------------------------------------------------- 42 | #SF_FORMAT_PCM_S8 = $0001 ; Signed 8 bit data 43 | #SF_FORMAT_PCM_16 = $0002 ; Signed 16 bit data 44 | #SF_FORMAT_PCM_24 = $0003 ; Signed 24 bit data 45 | #SF_FORMAT_PCM_32 = $0004 ; Signed 32 bit data 46 | #SF_FORMAT_PCM_U8 = $0005 ; Unsigned 8 bit data (WAV and RAW only) 47 | ;-------------------------------------------------------------------------- 48 | #SF_FORMAT_FLOAT = $0006 ; 32 bit float data 49 | #SF_FORMAT_DOUBLE = $0007 ; 64 bit float data 50 | ;-------------------------------------------------------------------------- 51 | #SF_FORMAT_ULAW = $0010 ; U-Law encoded. 52 | #SF_FORMAT_ALAW = $0011 ; A-Law encoded. 53 | #SF_FORMAT_IMA_ADPCM= $0012 ; IMA ADPCM. 54 | #SF_FORMAT_MS_ADPCM = $0013 ; Microsoft ADPCM. 55 | ;-------------------------------------------------------------------------- 56 | #SF_FORMAT_GSM610 = $0020 ; GSM 6.10 encoding. 57 | #SF_FORMAT_VOX_ADPCM= $0021 ; OKI / Dialogix ADPCM 58 | ;-------------------------------------------------------------------------- 59 | #SF_FORMAT_G721_32 = $0030 ; 32kbs G721 ADPCM encoding. 60 | #SF_FORMAT_G723_24 = $0031 ; 24kbs G723 ADPCM encoding. 61 | #SF_FORMAT_G723_40 = $0032 ; 40kbs G723 ADPCM encoding. 62 | ;-------------------------------------------------------------------------- 63 | #SF_FORMAT_DWVW_12 = $0040 ; 12 bit Delta Width Variable Word encoding. 64 | #SF_FORMAT_DWVW_16 = $0041 ; 16 bit Delta Width Variable Word encoding. 65 | #SF_FORMAT_DWVW_24 = $0042 ; 24 bit Delta Width Variable Word encoding. 66 | #SF_FORMAT_DWVW_N = $0043 ; N bit Delta Width Variable Word encoding. 67 | ;-------------------------------------------------------------------------- 68 | #SF_FORMAT_DPCM_8 = $0050 ; 8 bit differential PCM (XI only) 69 | #SF_FORMAT_DPCM_16 = $0051 ; 16 bit differential PCM (XI only) 70 | ;-------------------------------------------------------------------------- 71 | #SF_FORMAT_VORBIS = $0060 ; Xiph Vorbis encoding. 72 | ;-------------------------------------------------------------------------- 73 | ; * Endian-ness options 74 | ;-------------------------------------------------------------------------- 75 | #SF_ENDIAN_FILE = $00000000 ; Default file endian-ness. 76 | #SF_ENDIAN_LITTLE = $10000000 ; Force little endian-ness. 77 | #SF_ENDIAN_BIG = $20000000 ; Force big endian-ness. 78 | #SF_ENDIAN_CPU = $30000000 ; Force CPU endian-ness. 79 | ;-------------------------------------------------------------------------- 80 | #SF_FORMAT_SUBMASK = $0000FFFF 81 | #SF_FORMAT_TYPEMASK = $0FFF0000 82 | #SF_FORMAT_ENDMASK = $30000000 83 | ;-------------------------------------------------------------------------- 84 | #SFC_GET_LIB_VERSION = $1000 85 | #SFC_GET_LOG_INFO = $1001 86 | #SFC_GET_CURRENT_SF_INFO = $1002 87 | ;-------------------------------------------------------------------------- 88 | #SFC_GET_NORM_DOUBLE = $1010 89 | #SFC_GET_NORM_FLOAT = $1011 90 | #SFC_SET_NORM_DOUBLE = $1012 91 | #SFC_SET_NORM_FLOAT = $1013 92 | #SFC_SET_SCALE_FLOAT_INT_READ = $1014 93 | #SFC_SET_SCALE_INT_FLOAT_WRITE = $1015 94 | ;-------------------------------------------------------------------------- 95 | #SFC_GET_SIMPLE_FORMAT_COUNT = $1020 96 | #SFC_GET_SIMPLE_FORMAT = $1021 97 | ;-------------------------------------------------------------------------- 98 | #SFC_GET_FORMAT_INFO = $1028 99 | ;-------------------------------------------------------------------------- 100 | #SFC_GET_FORMAT_MAJOR_COUNT = $1030 101 | #SFC_GET_FORMAT_MAJOR = $1031 102 | #SFC_GET_FORMAT_SUBTYPE_COUNT = $1032 103 | #SFC_GET_FORMAT_SUBTYPE = $1033 104 | ;-------------------------------------------------------------------------- 105 | #SFC_CALC_SIGNAL_MAX = $1040 106 | #SFC_CALC_NORM_SIGNAL_MAX = $1041 107 | #SFC_CALC_MAX_ALL_CHANNELS = $1042 108 | #SFC_CALC_NORM_MAX_ALL_CHANNELS = $1043 109 | #SFC_GET_SIGNAL_MAX = $1044 110 | #SFC_GET_MAX_ALL_CHANNELS = $1045 111 | ;-------------------------------------------------------------------------- 112 | #SFC_SET_ADD_PEAK_CHUNK = $1050 113 | #SFC_SET_ADD_HEADER_PAD_CHUNK = $1051 114 | ;-------------------------------------------------------------------------- 115 | #SFC_UPDATE_HEADER_NOW = $1060 116 | #SFC_SET_UPDATE_HEADER_AUTO = $1061 117 | ;-------------------------------------------------------------------------- 118 | #SFC_FILE_TRUNCATE = $1080 119 | ;-------------------------------------------------------------------------- 120 | #SFC_SET_RAW_START_OFFSET = $1090 121 | ;-------------------------------------------------------------------------- 122 | #SFC_SET_DITHER_ON_WRITE = $10A0 123 | #SFC_SET_DITHER_ON_READ = $10A1 124 | ;-------------------------------------------------------------------------- 125 | #SFC_GET_DITHER_INFO_COUNT = $10A2 126 | #SFC_GET_DITHER_INFO = $10A3 127 | ;-------------------------------------------------------------------------- 128 | #SFC_GET_EMBED_FILE_INFO = $10B0 129 | ;-------------------------------------------------------------------------- 130 | #SFC_SET_CLIPPING = $10C0 131 | #SFC_GET_CLIPPING = $10C1 132 | ;-------------------------------------------------------------------------- 133 | #SFC_GET_INSTRUMENT = $10D0 134 | #SFC_SET_INSTRUMENT = $10D1 135 | ;-------------------------------------------------------------------------- 136 | #SFC_GET_LOOP_INFO = $10E0 137 | ;-------------------------------------------------------------------------- 138 | #SFC_GET_BROADCAST_INFO = $10F0 139 | #SFC_SET_BROADCAST_INFO = $10F1 140 | ;-------------------------------------------------------------------------- 141 | #SFC_GET_CHANNEL_MAP_INFO = $1100 142 | #SFC_SET_CHANNEL_MAP_INFO = $1101 143 | ;-------------------------------------------------------------------------- 144 | #SFC_RAW_DATA_NEEDS_ENDSWAP = $1110 145 | ;-------------------------------------------------------------------------- 146 | ; * Support for Wavex Ambisonics Format 147 | ;-------------------------------------------------------------------------- 148 | #SFC_WAVEX_SET_AMBISONIC = $1200 149 | #SFC_WAVEX_GET_AMBISONIC = $1201 150 | ;-------------------------------------------------------------------------- 151 | #SFC_SET_VBR_ENCODING_QUALITY = $1300 152 | ;-------------------------------------------------------------------------- 153 | ; * Following commands for testing only 154 | ;-------------------------------------------------------------------------- 155 | #SFC_TEST_IEEE_FLOAT_REPLACE = $6001 156 | ;-------------------------------------------------------------------------- 157 | #SF_STR_TITLE = $01 158 | #SF_STR_COPYRIGHT = $02 159 | #SF_STR_SOFTWARE = $03 160 | #SF_STR_ARTIST = $04 161 | #SF_STR_COMMENT = $05 162 | #SF_STR_DATE = $06 163 | #SF_STR_ALBUM = $07 164 | #SF_STR_LICENSE = $08 165 | #SF_STR_TRACKNUMBER = $09 166 | #SF_STR_GENRE = $10 167 | ;-------------------------------------------------------------------------- 168 | #SF_STR_FIRST = #SF_STR_TITLE 169 | #SF_STR_LAST = #SF_STR_GENRE 170 | ;-------------------------------------------------------------------------- 171 | ; * True and false 172 | ;-------------------------------------------------------------------------- 173 | #SF_FALSE = 0 174 | #SF_TRUE = 1 175 | ;-------------------------------------------------------------------------- 176 | ; * Modes for opening files 177 | ;-------------------------------------------------------------------------- 178 | #SFM_READ = $10 179 | #SFM_WRITE = $20 180 | #SFM_RDWR = $30 181 | ;-------------------------------------------------------------------------- 182 | #SF_AMBISONIC_NONE = $40 183 | #SF_AMBISONIC_B_FORMAT = $41 184 | ;-------------------------------------------------------------------------- 185 | #SF_ERR_NO_ERROR = 0 186 | #SF_ERR_UNRECOGNISED_FORMAT = 1 187 | #SF_ERR_SYSTEM = 2 188 | #SF_ERR_MALFORMED_FILE = 3 189 | #SF_ERR_UNSUPPORTED_ENCODING = 4 190 | ;-------------------------------------------------------------------------- 191 | Enumeration 192 | #SF_CHANNEL_MAP_INVALID 193 | #SF_CHANNEL_MAP_MONO 194 | #SF_CHANNEL_MAP_LEFT ; Apple calls this 'Left' 195 | #SF_CHANNEL_MAP_RIGHT ; Apple calls this 'Right' 196 | #SF_CHANNEL_MAP_CENTER ; Apple calls this 'Center' 197 | #SF_CHANNEL_MAP_FRONT_LEFT 198 | #SF_CHANNEL_MAP_FRONT_RIGHT 199 | #SF_CHANNEL_MAP_FRONT_CENTER 200 | #SF_CHANNEL_MAP_REAR_CENTER ; Apple calls this 'Center Surround' Msft calls this 'Back Center' 201 | #SF_CHANNEL_MAP_REAR_LEFT ; Apple calls this 'Left Surround' Msft calls this 'Back Left' 202 | #SF_CHANNEL_MAP_REAR_RIGHT ; Apple calls this 'Right Surround' Msft calls this 'Back Right' 203 | #SF_CHANNEL_MAP_LFE ; Apple calls this 'LFEScreen' Msft calls this 'Low Frequency' 204 | #SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER ; Apple calls this 'Left Center' 205 | #SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER ; Apple calls this 'Right Center 206 | #SF_CHANNEL_MAP_SIDE_LEFT ; Apple calls this 'Left Surround Direct' 207 | #SF_CHANNEL_MAP_SIDE_RIGHT ; Apple calls this 'Right Surround Direct' 208 | #SF_CHANNEL_MAP_TOP_CENTER ; Apple calls this 'Top Center Surround' 209 | #SF_CHANNEL_MAP_TOP_FRONT_LEFT ; Apple calls this 'Vertical Height Left' 210 | #SF_CHANNEL_MAP_TOP_FRONT_RIGHT ; Apple calls this 'Vertical Height Right' 211 | #SF_CHANNEL_MAP_TOP_FRONT_CENTER ; Apple calls this 'Vertical Height Center' 212 | #SF_CHANNEL_MAP_TOP_REAR_LEFT ; Apple and MS call this 'Top Back Left' 213 | #SF_CHANNEL_MAP_TOP_REAR_RIGHT ; Apple and MS call this 'Top Back Right' 214 | #SF_CHANNEL_MAP_TOP_REAR_CENTER ; Apple and MS call this 'Top Back Center' 215 | 216 | #SF_CHANNEL_MAP_AMBISONIC_B_W 217 | #SF_CHANNEL_MAP_AMBISONIC_B_X 218 | #SF_CHANNEL_MAP_AMBISONIC_B_Y 219 | #SF_CHANNEL_MAP_AMBISONIC_B_Z 220 | 221 | #SF_CHANNEL_MAP_MAX 222 | EndEnumeration 223 | ;-------------------------------------------------------------------------- 224 | Structure SF_INFO 225 | frames.q 226 | samplerate.l 227 | channels.l 228 | format.l 229 | sections.l 230 | seekable.l 231 | 232 | ; it writes 4 bytes too many, no idea what it holds. header says nothing. 233 | garbage1.a 234 | garbage2.a 235 | garbage3.a 236 | garbage4.a 237 | EndStructure 238 | ;-------------------------------------------------------------------------- 239 | Structure SF_FORMAT_INFO 240 | format.l 241 | name$ 242 | extension$ 243 | EndStructure 244 | ;-------------------------------------------------------------------------- 245 | #SFD_DEFAULT_LEVEL = 0 246 | #SFD_CUSTOM_LEVEL = $40000000 247 | 248 | #SFD_NO_DITHER = 500 249 | #SFD_WHITE = 501 250 | #SFD_TRIANGULAR_PDF = 502 251 | ;-------------------------------------------------------------------------- 252 | Structure SF_DITHER_INFO 253 | type.l 254 | level.d 255 | name$ 256 | EndStructure 257 | ;-------------------------------------------------------------------------- 258 | Structure SF_EMBED_FILE_INFO 259 | offset.i 260 | length.i 261 | EndStructure 262 | ;-------------------------------------------------------------------------- 263 | Enumeration 264 | #SF_LOOP_NONE = 800 265 | #SF_LOOP_FORWARD 266 | #SF_LOOP_BACKWARD 267 | #SF_LOOP_ALTERNATING 268 | EndEnumeration 269 | ;-------------------------------------------------------------------------- 270 | ; typedef struct 271 | ; { int gain ; I HAVE NO IDEA HOW TO IMPLEMENT THIS 272 | ; char basenote, detune ; 273 | ; char velocity_lo, velocity_hi ; 274 | ; char key_lo, key_hi ; 275 | ; int loop_count ; 276 | ; 277 | ; struct 278 | ; { int mode ; 279 | ; unsigned int start ; 280 | ; unsigned int end ; 281 | ; unsigned int count ; 282 | ; } loops [16] ; /* make variable in a sensible way */ 283 | ; } SF_INSTRUMENT ; 284 | ;-------------------------------------------------------------------------- 285 | Structure SF_LOOP_INFO 286 | time_sig_num.u 287 | time_sig_den.u 288 | loop_mode.l 289 | num_beats.l 290 | bpm.f 291 | root_key.l 292 | 293 | future01.l 294 | future02.l 295 | future03.l 296 | future04.l 297 | future05.l 298 | future06.l 299 | EndStructure 300 | ;-------------------------------------------------------------------------- 301 | PrototypeC.i __proto_sf_vio_get_filelen(*user_data) 302 | PrototypeC.i __proto_sf_vio_seek(offset.i, whence.i, *user_data) 303 | PrototypeC.i __proto_sf_vio_read(*ptr, count.i, *user_data) 304 | PrototypeC.i __proto_sf_vio_write(*ptr, count.i, *user_data) 305 | PrototypeC.i __proto_sf_vio_tell(*user_data) 306 | Structure SF_VIRTUAL_IO 307 | proc_get_filelen.__proto_sf_vio_get_filelen 308 | proc_seek.__proto_sf_vio_seek 309 | proc_read.__proto_sf_vio_read 310 | proc_write.__proto_sf_vio_write 311 | proc_tell.__proto_sf_vio_tell 312 | EndStructure 313 | ;-------------------------------------------------------------------------- 314 | 315 | ;-------------------------------------------------------------------------- 316 | ; * LSF Prototypes 317 | ;-------------------------------------------------------------------------- 318 | PrototypeC.i __proto_sf_open (path.p-ascii, mode.i, *sfinfo.SF_INFO) 319 | PrototypeC.i __proto_sf_open_fd (fd.i, mode.i, *sfinfo.SF_INFO, close_desc.i) 320 | PrototypeC.i __proto_sf_open_virtual (*sfvirtual.SF_VIRTUAL_IO, mode.i, *sfinfo.SF_INFO, *user_data) 321 | PrototypeC.l __proto_sf_error (*sndfile) 322 | PrototypeC.i __proto_sf_strerror (*sndfile) 323 | PrototypeC.i __proto_sf_error_number (errnum.i) 324 | PrototypeC.l __proto_sf_perror (*sndfile) 325 | PrototypeC.l __proto_sf_error_str (*sndfile, *str.p-ascii, len.l) 326 | PrototypeC.l __proto_sf_command (*sndfile, command.i, *data_, datasize.i) 327 | PrototypeC.l __proto_sf_format_check (*info.SF_INFO) 328 | PrototypeC.i __proto_sf_seek (*sndfile, frames.i, whence.i) 329 | PrototypeC.l __proto_sf_set_string (*sndfile, str_type.i, str.p-ascii) 330 | PrototypeC.i __proto_sf_get_string (*sndfile, str_type.i) 331 | PrototypeC.i __proto_sf_version_string () 332 | PrototypeC.i __proto_sf_read_raw (*sndfile, *ptr, bytes.i) 333 | PrototypeC.i __proto_sf_write_raw (*sndfile, *ptr, bytes.i) 334 | PrototypeC.i __proto_sf_readf_short (*sndfile, *ptr, frames.i) 335 | PrototypeC.i __proto_sf_writef_short (*sndfile, *ptr, frames.i) 336 | PrototypeC.i __proto_sf_readf_int (*sndfile, *ptr, frames.i) 337 | PrototypeC.i __proto_sf_writef_int (*sndfile, *ptr, frames.i) 338 | PrototypeC.i __proto_sf_readf_float (*sndfile, *ptr, frames.i) 339 | PrototypeC.i __proto_sf_writef_float (*sndfile, *ptr, frames.i) 340 | PrototypeC.i __proto_sf_readf_double (*sndfile, *ptr, frames.i) 341 | PrototypeC.i __proto_sf_writef_double (*sndfile, *ptr, frames.i) 342 | PrototypeC.i __proto_sf_read_short (*sndfile, *ptr, items.i) 343 | PrototypeC.i __proto_sf_write_short (*sndfile, *ptr, items.i) 344 | PrototypeC.i __proto_sf_read_int (*sndfile, *ptr, items.i) 345 | PrototypeC.i __proto_sf_write_int (*sndfile, *ptr, items.i) 346 | PrototypeC.i __proto_sf_read_float (*sndfile, *ptr, items.i) 347 | PrototypeC.i __proto_sf_write_float (*sndfile, *ptr, items.i) 348 | PrototypeC.i __proto_sf_read_double (*sndfile, *ptr, items.i) 349 | PrototypeC.i __proto_sf_write_double (*sndfile, *ptr, items.i) 350 | PrototypeC.i __proto_sf_close (*sndfile) 351 | PrototypeC __proto_sf_write_sync (*sndfile) 352 | PrototypeC.i __proto_sf_wchar_open (wpath.p-unicode, mode.i, *sfinfo.SF_INFO) 353 | ;-------------------------------------------------------------------------- 354 | ; * Initialize and Import libsndfile Library 355 | ;-------------------------------------------------------------------------- 356 | Procedure LSF_Initialize() 357 | Debug "libsndfile initializing" 358 | CompilerIf #PB_Compiler_Processor = #PB_Processor_x64 359 | DLL_LSF = OpenLibrary(#PB_Any, "x64/libsndfile.dll") 360 | CompilerElse 361 | DLL_LSF = OpenLibrary(#PB_Any, "x86/libsndfile.dll") 362 | CompilerEndIf 363 | ;-------------------------------------------------------------------------- 364 | Global sf_open.__proto_sf_open = GetFunction(DLL_LSF, "sf_open") 365 | Global sf_open_fd.__proto_sf_open_fd = GetFunction(DLL_LSF, "sf_open_fd") 366 | Global sf_open_virtual.__proto_sf_open_virtual = GetFunction(DLL_LSF, "sf_open_virtual") 367 | Global sf_error.__proto_sf_error = GetFunction(DLL_LSF, "sf_error") 368 | Global sf_strerror.__proto_sf_strerror = GetFunction(DLL_LSF, "sf_strerror") 369 | Global sf_error_number.__proto_sf_error_number = GetFunction(DLL_LSF, "sf_error_number") 370 | Global sf_perror.__proto_sf_perror = GetFunction(DLL_LSF, "sf_perror") 371 | Global sf_error_str.__proto_sf_error_str = GetFunction(DLL_LSF, "sf_error_str") 372 | Global sf_command.__proto_sf_command = GetFunction(DLL_LSF, "sf_command") 373 | Global sf_format_check.__proto_sf_format_check = GetFunction(DLL_LSF, "sf_format_check") 374 | Global sf_seek.__proto_sf_seek = GetFunction(DLL_LSF, "sf_seek") 375 | Global sf_set_string.__proto_sf_set_string = GetFunction(DLL_LSF, "sf_set_string") 376 | Global sf_get_string.__proto_sf_get_string = GetFunction(DLL_LSF, "sf_get_string") 377 | Global sf_version_string.__proto_sf_version_string = GetFunction(DLL_LSF, "sf_version_string") 378 | Global sf_read_raw.__proto_sf_read_raw = GetFunction(DLL_LSF, "sf_read_raw") 379 | Global sf_write_raw.__proto_sf_write_raw = GetFunction(DLL_LSF, "sf_write_raw") 380 | Global sf_readf_short.__proto_sf_readf_short = GetFunction(DLL_LSF, "sf_readf_short") 381 | Global sf_writef_short.__proto_sf_writef_short = GetFunction(DLL_LSF, "sf_writef_short") 382 | Global sf_readf_int.__proto_sf_readf_int = GetFunction(DLL_LSF, "sf_readf_int") 383 | Global sf_writef_int.__proto_sf_writef_int = GetFunction(DLL_LSF, "sf_writef_int") 384 | Global sf_readf_float.__proto_sf_readf_float = GetFunction(DLL_LSF, "sf_readf_float") 385 | Global sf_writef_float.__proto_sf_writef_float = GetFunction(DLL_LSF, "sf_writef_float") 386 | Global sf_readf_double.__proto_sf_readf_double = GetFunction(DLL_LSF, "sf_readf_double") 387 | Global sf_writef_double.__proto_sf_writef_double = GetFunction(DLL_LSF, "sf_writef_double") 388 | Global sf_read_short.__proto_sf_read_short = GetFunction(DLL_LSF, "sf_read_short") 389 | Global sf_write_short.__proto_sf_write_short = GetFunction(DLL_LSF, "sf_write_short") 390 | Global sf_read_int.__proto_sf_read_int = GetFunction(DLL_LSF, "sf_read_int") 391 | Global sf_write_int.__proto_sf_write_int = GetFunction(DLL_LSF, "sf_write_int") 392 | Global sf_read_float.__proto_sf_read_float = GetFunction(DLL_LSF, "sf_read_float") 393 | Global sf_write_float.__proto_sf_write_float = GetFunction(DLL_LSF, "sf_write_float") 394 | Global sf_read_double.__proto_sf_read_double = GetFunction(DLL_LSF, "sf_read_double") 395 | Global sf_write_double.__proto_sf_write_double = GetFunction(DLL_LSF, "sf_write_double") 396 | Global sf_close.__proto_sf_close = GetFunction(DLL_LSF, "sf_close") 397 | Global sf_write_sync.__proto_sf_write_sync = GetFunction(DLL_LSF, "sf_write_sync") 398 | EndProcedure 399 | ;-------------------------------------------------------------------------- 400 | ; * Dispose libsndfile Library 401 | ;-------------------------------------------------------------------------- 402 | Procedure LSF_Dispose() 403 | Debug "libsndfile closing" 404 | CloseLibrary(DLL_LSF) 405 | EndProcedure 406 | ; IDE Options = PureBasic 5.71 LTS (Windows - x86) 407 | ; CursorPosition = 6 408 | ; Folding = - 409 | ; EnableXP -------------------------------------------------------------------------------- /OpenAL Soft/OpenALsoft.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** OpenALsoft.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module represents an OpenAL Soft header to import the sound library. 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | IncludeFile #PB_Compiler_File + "i" ;- PBHGEN 8 | 9 | ;-------------------------------------------------------------------------- 10 | Global DLL_OPENAL.i ; DLL Handle 11 | ;-------------------------------------------------------------------------- 12 | #AL_NONE = 0 13 | #AL_FALSE = 0 14 | #AL_TRUE = 1 15 | ;-------------------------------------------------------------------------- 16 | #AL_SOURCE_RELATIVE = $202 17 | #AL_CONE_INNER_ANGLE = $1001 18 | #AL_CONE_OUTER_ANGLE = $1002 19 | #AL_PITCH = $1003 20 | #AL_POSITION = $1004 21 | #AL_DIRECTION = $1005 22 | #AL_VELOCITY = $1006 23 | #AL_LOOPING = $1007 24 | #AL_BUFFER = $1009 25 | #AL_GAIN = $100A 26 | #AL_MIN_GAIN = $100D 27 | #AL_MAX_GAIN = $100E 28 | #AL_ORIENTATION = $100F 29 | #AL_SOURCE_STATE = $1010 30 | #AL_INITIAL = $1011 31 | #AL_PLAYING = $1012 32 | #AL_PAUSED = $1013 33 | #AL_STOPPED = $1014 34 | #AL_BUFFERS_QUEUED = $1015 35 | #AL_BUFFERS_PROCESSED = $1016 36 | #AL_REFERENCE_DISTANCE = $1020 37 | #AL_ROLLOFF_FACTOR = $1021 38 | #AL_CONE_OUTER_GAIN = $1022 39 | #AL_MAX_DISTANCE = $1023 40 | #AL_SEC_OFFSET = $1024 41 | #AL_SAMPLE_OFFSET = $1025 42 | #AL_BYTE_OFFSET = $1026 43 | #AL_SOURCE_TYPE = $1027 44 | #AL_STATIC = $1028 45 | #AL_STREAMING = $1029 46 | #AL_UNDETERMINED = $1030 47 | #AL_FORMAT_MONO8 = $1100 48 | #AL_FORMAT_MONO16 = $1101 49 | #AL_FORMAT_STEREO8 = $1102 50 | #AL_FORMAT_STEREO16 = $1103 51 | #AL_FREQUENCY = $2001 52 | #AL_BITS = $2002 53 | #AL_CHANNELS = $2003 54 | #AL_SIZE = $2004 55 | #AL_UNUSED = $2010 56 | #AL_PENDING = $2011 57 | #AL_PROCESSED = $2012 58 | #AL_NO_ERROR = $0000 59 | #AL_INVALID_NAME = $A001 60 | #AL_INVALID_ENUM = $A002 61 | #AL_INVALID_VALUE = $A003 62 | #AL_INVALID_OPERATION = $A004 63 | #AL_OUT_OF_MEMORY = $A005 64 | #AL_VENDOR = $B001 65 | #AL_VERSION = $B002 66 | #AL_RENDERER = $B003 67 | #AL_EXTENSIONS = $B004 68 | #AL_DOPPLER_FACTOR = $C000 69 | #AL_DOPPLER_VELOCITY = $C001 70 | #AL_SPEED_OF_SOUND = $C003 71 | #AL_DISTANCE_MODEL = $D000 72 | #AL_INVERSE_DISTANCE = $D001 73 | #AL_INVERSE_DISTANCE_CLAMPED = $D002 74 | #AL_LINEAR_DISTANCE = $D003 75 | #AL_LINEAR_DISTANCE_CLAMPED = $D004 76 | #AL_EXPONENT_DISTANCE = $D005 77 | #AL_EXPONENT_DISTANCE_CLAMPED = $D006 78 | ;-------------------------------------------------------------------------- 79 | #ALC_FALSE = $0000 80 | #ALC_TRUE = $0001 81 | #ALC_FREQUENCY = $1007 82 | #ALC_REFRESH = $1008 83 | #ALC_SYNC = $1009 84 | #ALC_MONO_SOURCES = $1010 85 | #ALC_STEREO_SOURCES = $1011 86 | #ALC_NO_ERROR = $0000 87 | #ALC_INVALID_DEVICE = $A001 88 | #ALC_INVALID_CONTEXT = $A002 89 | #ALC_INVALID_ENUM = $A003 90 | #ALC_INVALID_VALUE = $A004 91 | #ALC_OUT_OF_MEMORY = $A005 92 | #ALC_MAJOR_VERSION = $1000 93 | #ALC_MINOR_VERSION = $1001 94 | #ALC_ATTRIBUTES_SIZE = $1002 95 | #ALC_ALL_ATTRIBUTES = $1003 96 | #ALC_DEFAULT_DEVICE_SPECIFIER = $1004 97 | #ALC_DEVICE_SPECIFIER = $1005 98 | #ALC_EXTENSIONS = $1006 99 | #ALC_EXT_CAPTURE = $0001 100 | #ALC_CAPTURE_DEVICE_SPECIFIER = $0310 101 | #ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = $0311 102 | #ALC_CAPTURE_SAMPLES = $0312 103 | #ALC_ENUMERATE_ALL_EXT = $0001 104 | #ALC_DEFAULT_ALL_DEVICES_SPECIFIER = $1012 105 | ;-------------------------------------------------------------------------- 106 | PrototypeC.l __proto_alDopplerFactor (value.f) 107 | PrototypeC.l __proto_alDopplerVelocity (value.f) 108 | PrototypeC.l __proto_alSpeedOfSound (value.f) 109 | PrototypeC.l __proto_alDistanceModel (distanceModel.i) 110 | ;-------------------------------------------------------------------------- 111 | ; * Renderer State management 112 | ;-------------------------------------------------------------------------- 113 | PrototypeC.l __proto_alEnable (capability.i) 114 | PrototypeC.l __proto_alDisable (capability.i) 115 | PrototypeC.l __proto_alIsEnabled (capability.i) 116 | ;-------------------------------------------------------------------------- 117 | ; * State retrieval 118 | ;-------------------------------------------------------------------------- 119 | PrototypeC.s __proto_alGetString (param.i) 120 | PrototypeC.l __proto_alGetBooleanv (param.i, *values) 121 | PrototypeC.l __proto_alGetIntegerv (param.i, *values) 122 | PrototypeC.l __proto_alGetFloatv (param.i, *values) 123 | PrototypeC.l __proto_alGetDoublev (param.i, *values) 124 | PrototypeC.a __proto_alGetBoolean (param.i) 125 | PrototypeC.i __proto_alGetInteger (param.i) 126 | PrototypeC.f __proto_alGetFloat (param.i) 127 | PrototypeC.d __proto_alGetDouble (param.i) 128 | ;-------------------------------------------------------------------------- 129 | ; * Error retrieval 130 | ;-------------------------------------------------------------------------- 131 | PrototypeC.i __proto_alGetError() 132 | ;-------------------------------------------------------------------------- 133 | ; * Extension support 134 | ;-------------------------------------------------------------------------- 135 | PrototypeC.a __proto_alIsExtensionPresent (*extname) 136 | PrototypeC.i __proto_alGetProcAddress (*fname) 137 | PrototypeC.i __proto_alGetEnumValue (ename$) 138 | ;-------------------------------------------------------------------------- 139 | ; * Set Listener parameters 140 | ;-------------------------------------------------------------------------- 141 | PrototypeC.l __proto_alListenerf (param.i, value.f) 142 | PrototypeC.l __proto_alListener3f (param.i, value1.f, value2.f, value3.f) 143 | PrototypeC.l __proto_alListenerfv (param.i, *values) 144 | PrototypeC.l __proto_alListeneri (param.i, value.i) 145 | PrototypeC.l __proto_alListener3i (param.i, value1.i, value2.i, value3.i) 146 | PrototypeC.l __proto_alListeneriv (param.i, *values) 147 | ;-------------------------------------------------------------------------- 148 | ; * Get Listener parameters 149 | ;-------------------------------------------------------------------------- 150 | PrototypeC.l __proto_alGetListenerf (param, *value) 151 | PrototypeC.l __proto_alGetListener3f (param, *value1, *value2, *value3) 152 | PrototypeC.l __proto_alGetListenerfv (param, *values) 153 | PrototypeC.l __proto_alGetListeneri (param, *value) 154 | PrototypeC.l __proto_alGetListener3i (param, *value1, *value2, *value3) 155 | PrototypeC.l __proto_alGetListeneriv (param, *values) 156 | ;-------------------------------------------------------------------------- 157 | ; * Create Source objects 158 | ;-------------------------------------------------------------------------- 159 | PrototypeC.l __proto_alGenSources (n.i, *sources) 160 | ;-------------------------------------------------------------------------- 161 | ; * Delete Source objects 162 | ;-------------------------------------------------------------------------- 163 | PrototypeC.l __proto_alDeleteSources (n.i, *sources) 164 | ;-------------------------------------------------------------------------- 165 | ; * Verify a handle is a valid Source 166 | ;-------------------------------------------------------------------------- 167 | PrototypeC.a __proto_alIsSource (source.i) 168 | ;-------------------------------------------------------------------------- 169 | ; * Set Source parameters 170 | ;-------------------------------------------------------------------------- 171 | PrototypeC.l __proto_alSourcef (source.i, param.i, value.f) 172 | PrototypeC.l __proto_alSource3f (source.i, param.i, value1.f, value2.f, value3.f) 173 | PrototypeC.l __proto_alSourcefv (source.i, param.i, *values) 174 | PrototypeC.l __proto_alSourcei (source.i, param.i, value.i) 175 | PrototypeC.l __proto_alSource3i (source.i, param.i, value1.i, value2.i, value3.i) 176 | PrototypeC.l __proto_alSourceiv (source.i, param.i, *values) 177 | ;-------------------------------------------------------------------------- 178 | ; * Get Source parameters 179 | ;-------------------------------------------------------------------------- 180 | PrototypeC.l __proto_alGetSourcef (source.i, param.i, *value) 181 | PrototypeC.l __proto_alGetSource3f (source.i, param.i, *value1, *value2, *value3) 182 | PrototypeC.l __proto_alGetSourcefv (source.i, param.i, *values) 183 | PrototypeC.l __proto_alGetSourcei (source.i, param.i, *value) 184 | PrototypeC.l __proto_alGetSource3i (source.i, param.i, *value1, *value2, *value3) 185 | PrototypeC.l __proto_alGetSourceiv (source.i, param.i, *values) 186 | ;-------------------------------------------------------------------------- 187 | ; * Play, replay, or resume (if paused) a list of Sources 188 | ;-------------------------------------------------------------------------- 189 | PrototypeC.l __proto_alSourcePlayv (n.i, *sources) 190 | ;-------------------------------------------------------------------------- 191 | ; * Stop a list of Sources 192 | ;-------------------------------------------------------------------------- 193 | PrototypeC.l __proto_alSourceStopv (n.i, *sources) 194 | ;-------------------------------------------------------------------------- 195 | ; * Rewind a list of Sources 196 | ;-------------------------------------------------------------------------- 197 | PrototypeC.l __proto_alSourceRewindv (n.i, *sources) 198 | ;-------------------------------------------------------------------------- 199 | ; * Pause a list of Sources 200 | ;-------------------------------------------------------------------------- 201 | PrototypeC.l __proto_alSourcePausev (n.i, *sources) 202 | ;-------------------------------------------------------------------------- 203 | ; * Play, replay, or resume a Source 204 | ;-------------------------------------------------------------------------- 205 | PrototypeC.l __proto_alSourcePlay (source.i) 206 | ;-------------------------------------------------------------------------- 207 | ; * Stop a Source 208 | ;-------------------------------------------------------------------------- 209 | PrototypeC.l __proto_alSourceStop (source.i) 210 | ;-------------------------------------------------------------------------- 211 | ; * Rewind a Source (set playback postiton to beginning) 212 | ;-------------------------------------------------------------------------- 213 | PrototypeC.l __proto_alSourceRewind (source.i) 214 | ;-------------------------------------------------------------------------- 215 | ; * Pause a Source 216 | ;-------------------------------------------------------------------------- 217 | PrototypeC.l __proto_alSourcePause (source.i) 218 | ;-------------------------------------------------------------------------- 219 | ; * Queue buffers onto a source 220 | ;-------------------------------------------------------------------------- 221 | PrototypeC.l __proto_alSourceQueueBuffers (source.i, nb.i, *buffers) 222 | ;-------------------------------------------------------------------------- 223 | ; * Unqueue processed buffers from a source 224 | ;-------------------------------------------------------------------------- 225 | PrototypeC.l __proto_alSourceUnqueueBuffers (source.i, nb.i, *buffers) 226 | ;-------------------------------------------------------------------------- 227 | ; * Create Buffer objects 228 | ;-------------------------------------------------------------------------- 229 | PrototypeC.l __proto_alGenBuffers (n.i, *buffers) 230 | ;-------------------------------------------------------------------------- 231 | ; * Delete Buffer objects 232 | ;-------------------------------------------------------------------------- 233 | PrototypeC.l __proto_alDeleteBuffers (n.i, *buffers) 234 | ;-------------------------------------------------------------------------- 235 | ; * Verify a handle is a valid Buffer 236 | ;-------------------------------------------------------------------------- 237 | PrototypeC.a __proto_alIsBuffer (buffer.i) 238 | ;-------------------------------------------------------------------------- 239 | ; * Specifies the data to be copied into a buffer 240 | ;-------------------------------------------------------------------------- 241 | PrototypeC.l __proto_alBufferData (buffer.i, format.i, *data_, size.i, freq.i) 242 | ;-------------------------------------------------------------------------- 243 | ; * Set Buffer parameters 244 | ;-------------------------------------------------------------------------- 245 | PrototypeC.l __proto_alBufferf (buffer.i, param.i, value.f) 246 | PrototypeC.l __proto_alBuffer3f (buffer.i, param.i, value1.f, value2.f, value3.f) 247 | PrototypeC.l __proto_alBufferfv (buffer.i, param.i, *values) 248 | PrototypeC.l __proto_alBufferi (buffer.i, param.i, value.i) 249 | PrototypeC.l __proto_alBuffer3i (buffer.i, param.i, value1.i, value2.i, value3.i) 250 | PrototypeC.l __proto_alBufferiv (buffer.i, param.i, *values) 251 | ;-------------------------------------------------------------------------- 252 | ; * Get Buffer parameters 253 | ;-------------------------------------------------------------------------- 254 | PrototypeC.l __proto_alGetBufferf (buffer.i, param.i, *value) 255 | PrototypeC.l __proto_alGetBuffer3f (buffer.i, param.i, *value1, *value2, *value3) 256 | PrototypeC.l __proto_alGetBufferfv (buffer.i, param.i, *values) 257 | PrototypeC.l __proto_alGetBufferi (buffer.i, param.i, *value) 258 | PrototypeC.l __proto_alGetBuffer3i (buffer.i, param.i, *value1, *value2, *value3) 259 | PrototypeC.l __proto_alGetBufferiv (buffer.i, param.i, *values) 260 | ;-------------------------------------------------------------------------- 261 | ; * Context management 262 | ;-------------------------------------------------------------------------- 263 | PrototypeC.i __proto_alcCreateContext(*device, *attrlist) 264 | PrototypeC.a __proto_alcMakeContextCurrent(*context) 265 | PrototypeC.i __proto_alcProcessContext(*context) 266 | PrototypeC.i __proto_alcSuspendContext(*context) 267 | PrototypeC.i __proto_alcDestroyContext(*context) 268 | PrototypeC.i __proto_alcGetCurrentContext() 269 | PrototypeC.i __proto_alcGetContextsDevice(*context) 270 | ;-------------------------------------------------------------------------- 271 | ; * Device management 272 | ;-------------------------------------------------------------------------- 273 | PrototypeC.i __proto_alcOpenDevice(*devicename) 274 | PrototypeC.a __proto_alcCloseDevice(*device) 275 | ;-------------------------------------------------------------------------- 276 | ; * Error support 277 | ;-------------------------------------------------------------------------- 278 | PrototypeC.i __proto_alcGetError(*device) 279 | ;-------------------------------------------------------------------------- 280 | ; * Extension support 281 | ;-------------------------------------------------------------------------- 282 | PrototypeC.a __proto_alcIsExtensionPresent(*device, extname$) 283 | PrototypeC.i __proto_alcGetProcAddress(*device, funcname$) 284 | PrototypeC.i __proto_alcGetEnumValue(*device, enumname$) 285 | ;-------------------------------------------------------------------------- 286 | ; * Query function 287 | ;-------------------------------------------------------------------------- 288 | PrototypeC.s __proto_alcGetString(*device, param.i) 289 | PrototypeC.i __proto_alcGetIntegerv(*device, param.i, size.i, *values) 290 | ;-------------------------------------------------------------------------- 291 | ; * Capture function 292 | ;-------------------------------------------------------------------------- 293 | PrototypeC.i __proto_alcCaptureOpenDevice(devicename$, frequency.i, format.i, buffersize.i) 294 | PrototypeC.a __proto_alcCaptureCloseDevice(*device) 295 | PrototypeC.i __proto_alcCaptureStart(*device) 296 | PrototypeC.i __proto_alcCaptureStop(*device) 297 | PrototypeC.i __proto_alcCaptureSamples(*device, *buffer, samples.i) 298 | ;-------------------------------------------------------------------------- 299 | Procedure AL_Initialize() 300 | Debug "OpenAL Soft Initializing" 301 | CompilerIf #PB_Compiler_Processor = #PB_Processor_x64 302 | DLL_OPENAL = OpenLibrary(#PB_Any, "x64/soft_oal.dll") 303 | CompilerElse 304 | DLL_OPENAL = OpenLibrary(#PB_Any, "x86/soft_oal.dll") 305 | CompilerEndIf 306 | 307 | Global alDopplerFactor.__proto_alDopplerFactor = GetFunction(DLL_OPENAL, "alDopplerFactor") 308 | Global alDopplerVelocity.__proto_alDopplerVelocity = GetFunction(DLL_OPENAL, "alDopplerVelocity") 309 | Global alSpeedOfSound.__proto_alSpeedOfSound = GetFunction(DLL_OPENAL, "alSpeedOfSound") 310 | Global alDistanceModel.__proto_alDistanceModel = GetFunction(DLL_OPENAL, "alDistanceModel") 311 | ;-------------------------------------------------------------------------- 312 | ; * Renderer State management 313 | ;-------------------------------------------------------------------------- 314 | Global alEnable.__proto_alEnable = GetFunction(DLL_OPENAL, "alEnable") 315 | Global alDisable.__proto_alDisable = GetFunction(DLL_OPENAL, "alDisable") 316 | Global alIsEnabled.__proto_alIsEnabled = GetFunction(DLL_OPENAL, "alIsEnabled") 317 | ;-------------------------------------------------------------------------- 318 | ; * State retrieval 319 | ;-------------------------------------------------------------------------- 320 | Global alGetString.__proto_alGetString = GetFunction(DLL_OPENAL, "alGetString") 321 | Global alGetBooleanv.__proto_alGetBooleanv = GetFunction(DLL_OPENAL, "alGetBooleanv") 322 | Global alGetIntegerv.__proto_alGetIntegerv = GetFunction(DLL_OPENAL, "alGetIntegerv") 323 | Global alGetFloatv.__proto_alGetFloatv = GetFunction(DLL_OPENAL, "alGetFloatv") 324 | Global alGetDoublev.__proto_alGetDoublev = GetFunction(DLL_OPENAL, "alGetDoublev") 325 | Global alGetBoolean.__proto_alGetBoolean = GetFunction(DLL_OPENAL, "alGetBoolean") 326 | Global alGetInteger.__proto_alGetInteger = GetFunction(DLL_OPENAL, "alGetInteger") 327 | Global alGetFloat.__proto_alGetFloat = GetFunction(DLL_OPENAL, "alGetFloat") 328 | Global alGetDouble.__proto_alGetDouble = GetFunction(DLL_OPENAL, "alGetDouble") 329 | ;-------------------------------------------------------------------------- 330 | ; * Error retrieval 331 | ;-------------------------------------------------------------------------- 332 | Global alGetError.__proto_alGetError = GetFunction(DLL_OPENAL, "alGetError") 333 | ;-------------------------------------------------------------------------- 334 | ; * Extension support 335 | ;-------------------------------------------------------------------------- 336 | Global alIsExtensionPresent.__proto_alIsExtensionPresent = GetFunction(DLL_OPENAL, "alIsExtensionPresent") 337 | Global alGetProcAddress.__proto_alGetProcAddress = GetFunction(DLL_OPENAL, "alGetProcAddress") 338 | Global alGetEnumValue.__proto_alGetEnumValue = GetFunction(DLL_OPENAL, "alGetEnumValue") 339 | ;-------------------------------------------------------------------------- 340 | ; * Set Listener parameters 341 | ;-------------------------------------------------------------------------- 342 | Global alListenerf.__proto_alListenerf = GetFunction(DLL_OPENAL, "alListenerf") 343 | Global alListener3f.__proto_alListener3f = GetFunction(DLL_OPENAL, "alListener3f") 344 | Global alListenerfv.__proto_alListenerfv = GetFunction(DLL_OPENAL, "alListenerfv") 345 | Global alListeneri.__proto_alListeneri = GetFunction(DLL_OPENAL, "alListeneri") 346 | Global alListener3i.__proto_alListener3i = GetFunction(DLL_OPENAL, "alListener3i") 347 | Global alListeneriv.__proto_alListeneriv = GetFunction(DLL_OPENAL, "alListeneriv") 348 | ;-------------------------------------------------------------------------- 349 | ; * Get Listener parameters 350 | ;-------------------------------------------------------------------------- 351 | Global alGetListenerf.__proto_alGetListenerf = GetFunction(DLL_OPENAL, "alGetListenerf") 352 | Global alGetListener3f.__proto_alGetListener3f = GetFunction(DLL_OPENAL, "alGetListener3f") 353 | Global alGetListenerfv.__proto_alGetListenerfv = GetFunction(DLL_OPENAL, "alGetListenerfv") 354 | Global alGetListeneri.__proto_alGetListeneri = GetFunction(DLL_OPENAL, "alGetListeneri") 355 | Global alGetListener3i.__proto_alGetListener3i = GetFunction(DLL_OPENAL, "alGetListener3i") 356 | Global alGetListeneriv.__proto_alGetListeneriv = GetFunction(DLL_OPENAL, "alGetListeneriv") 357 | ;-------------------------------------------------------------------------- 358 | ; * Create Source objects 359 | ;-------------------------------------------------------------------------- 360 | Global alGenSources.__proto_alGenSources = GetFunction(DLL_OPENAL, "alGenSources") 361 | ;-------------------------------------------------------------------------- 362 | ; * Delete Source objects 363 | ;-------------------------------------------------------------------------- 364 | Global alDeleteSources.__proto_alDeleteSources = GetFunction(DLL_OPENAL, "alDeleteSources") 365 | ;-------------------------------------------------------------------------- 366 | ; * Verify a handle is a valid Source 367 | ;-------------------------------------------------------------------------- 368 | Global alIsSource.__proto_alIsSource = GetFunction(DLL_OPENAL, "alIsSource") 369 | ;-------------------------------------------------------------------------- 370 | ; * Set Source parameters 371 | ;-------------------------------------------------------------------------- 372 | Global alSourcef.__proto_alSourcef = GetFunction(DLL_OPENAL, "alSourcef") 373 | Global alSource3f.__proto_alSource3f = GetFunction(DLL_OPENAL, "alSource3f") 374 | Global alSourcefv.__proto_alSourcefv = GetFunction(DLL_OPENAL, "alSourcefv") 375 | Global alSourcei.__proto_alSourcei = GetFunction(DLL_OPENAL, "alSourcei") 376 | Global alSource3i.__proto_alSource3i = GetFunction(DLL_OPENAL, "alSource3i") 377 | Global alSourceiv.__proto_alSourceiv = GetFunction(DLL_OPENAL, "alSourceiv") 378 | ;-------------------------------------------------------------------------- 379 | ; * Get Source parameters 380 | ;-------------------------------------------------------------------------- 381 | Global alGetSourcef.__proto_alGetSourcef = GetFunction(DLL_OPENAL, "alGetSourcef") 382 | Global alGetSource3f.__proto_alGetSource3f = GetFunction(DLL_OPENAL, "alGetSource3f") 383 | Global alGetSourcefv.__proto_alGetSourcefv = GetFunction(DLL_OPENAL, "alGetSourcefv") 384 | Global alGetSourcei.__proto_alGetSourcei = GetFunction(DLL_OPENAL, "alGetSourcei") 385 | Global alGetSource3i.__proto_alGetSource3i = GetFunction(DLL_OPENAL, "alGetSource3i") 386 | Global alGetSourceiv.__proto_alGetSourceiv = GetFunction(DLL_OPENAL, "alGetSourceiv") 387 | ;-------------------------------------------------------------------------- 388 | ; * Play, replay, or resume (if paused) a list of Sources 389 | ;-------------------------------------------------------------------------- 390 | Global alSourcePlayv.__proto_alSourcePlayv = GetFunction(DLL_OPENAL, "alSourcePlayv") 391 | ;-------------------------------------------------------------------------- 392 | ; * Stop a list of Sources 393 | ;-------------------------------------------------------------------------- 394 | Global alSourceStopv.__proto_alSourceStopv = GetFunction(DLL_OPENAL, "alSourceStopv") 395 | ;-------------------------------------------------------------------------- 396 | ; * Rewind a list of Sources 397 | ;-------------------------------------------------------------------------- 398 | Global alSourceRewindv.__proto_alSourceRewindv = GetFunction(DLL_OPENAL, "alSourceRewindv") 399 | ;-------------------------------------------------------------------------- 400 | ; * Pause a list of Sources 401 | ;-------------------------------------------------------------------------- 402 | Global alSourcePausev.__proto_alSourcePausev = GetFunction(DLL_OPENAL, "alSourcePausev") 403 | ;-------------------------------------------------------------------------- 404 | ; * Play, replay, or resume a Source 405 | ;-------------------------------------------------------------------------- 406 | Global alSourcePlay.__proto_alSourcePlay = GetFunction(DLL_OPENAL, "alSourcePlay") 407 | ;-------------------------------------------------------------------------- 408 | ; * Stop a Source 409 | ;-------------------------------------------------------------------------- 410 | Global alSourceStop.__proto_alSourceStop = GetFunction(DLL_OPENAL, "alSourceStop") 411 | ;-------------------------------------------------------------------------- 412 | ; * Rewind a Source (set playback postiton to beginning) 413 | ;-------------------------------------------------------------------------- 414 | Global alSourceRewind.__proto_alSourceRewind = GetFunction(DLL_OPENAL, "alSourceRewind") 415 | ;-------------------------------------------------------------------------- 416 | ; * Pause a Source 417 | ;-------------------------------------------------------------------------- 418 | Global alSourcePause.__proto_alSourcePause = GetFunction(DLL_OPENAL, "alSourcePause") 419 | ;-------------------------------------------------------------------------- 420 | ; * Queue buffers onto a source 421 | ;-------------------------------------------------------------------------- 422 | Global alSourceQueueBuffers.__proto_alSourceQueueBuffers = GetFunction(DLL_OPENAL, "alSourceQueueBuffers") 423 | ;-------------------------------------------------------------------------- 424 | ; * Unqueue processed buffers from a source 425 | ;-------------------------------------------------------------------------- 426 | Global alSourceUnqueueBuffers.__proto_alSourceUnqueueBuffers = GetFunction(DLL_OPENAL, "alSourceUnqueueBuffers") 427 | ;-------------------------------------------------------------------------- 428 | ; * Create Buffer objects 429 | ;-------------------------------------------------------------------------- 430 | Global alGenBuffers.__proto_alGenBuffers = GetFunction(DLL_OPENAL, "alGenBuffers") 431 | ;-------------------------------------------------------------------------- 432 | ; * Delete Buffer objects 433 | ;-------------------------------------------------------------------------- 434 | Global alDeleteBuffers.__proto_alDeleteBuffers = GetFunction(DLL_OPENAL, "alDeleteBuffers") 435 | ;-------------------------------------------------------------------------- 436 | ; * Verify a handle is a valid Buffer 437 | ;-------------------------------------------------------------------------- 438 | Global alIsBuffer.__proto_alIsBuffer = GetFunction(DLL_OPENAL, "alIsBuffer") 439 | ;-------------------------------------------------------------------------- 440 | ; * Specifies the data to be copied into a buffer 441 | ;-------------------------------------------------------------------------- 442 | Global alBufferData.__proto_alBufferData = GetFunction(DLL_OPENAL, "alBufferData") 443 | ;-------------------------------------------------------------------------- 444 | ; * Set Buffer parameters 445 | ;-------------------------------------------------------------------------- 446 | Global alBufferf.__proto_alBufferf = GetFunction(DLL_OPENAL, "alBufferf") 447 | Global alBuffer3f.__proto_alBuffer3f = GetFunction(DLL_OPENAL, "alBuffer3f") 448 | Global alBufferfv.__proto_alBufferfv = GetFunction(DLL_OPENAL, "alBufferfv") 449 | Global alBufferi.__proto_alBufferi = GetFunction(DLL_OPENAL, "alBufferi") 450 | Global alBuffer3i.__proto_alBuffer3i = GetFunction(DLL_OPENAL, "alBuffer3i") 451 | Global alBufferiv.__proto_alBufferiv = GetFunction(DLL_OPENAL, "alBufferiv") 452 | ;-------------------------------------------------------------------------- 453 | ; * Get Buffer parameters 454 | ;-------------------------------------------------------------------------- 455 | Global alGetBufferf.__proto_alGetBufferf = GetFunction(DLL_OPENAL, "alGetBufferf") 456 | Global alGetBuffer3f.__proto_alGetBuffer3f = GetFunction(DLL_OPENAL, "alGetBuffer3f") 457 | Global alGetBufferfv.__proto_alGetBufferfv = GetFunction(DLL_OPENAL, "alGetBufferfv") 458 | Global alGetBufferi.__proto_alGetBufferi = GetFunction(DLL_OPENAL, "alGetBufferi") 459 | Global alGetBuffer3i.__proto_alGetBuffer3i = GetFunction(DLL_OPENAL, "alGetBuffer3i") 460 | Global alGetBufferiv.__proto_alGetBufferiv = GetFunction(DLL_OPENAL, "alGetBufferiv") 461 | ;-------------------------------------------------------------------------- 462 | ; * Context management 463 | ;-------------------------------------------------------------------------- 464 | Global alcCreateContext.__proto_alcCreateContext = GetFunction(DLL_OPENAL, "alcCreateContext") 465 | Global alcMakeContextCurrent.__proto_alcMakeContextCurrent = GetFunction(DLL_OPENAL, "alcMakeContextCurrent") 466 | Global alcProcessContext.__proto_alcProcessContext = GetFunction(DLL_OPENAL, "alcProcessContext") 467 | Global alcSuspendContext.__proto_alcSuspendContext = GetFunction(DLL_OPENAL, "alcSuspendContext") 468 | Global alcDestroyContext.__proto_alcDestroyContext = GetFunction(DLL_OPENAL, "alcDestroyContext") 469 | Global alcGetCurrentContext.__proto_alcGetCurrentContext = GetFunction(DLL_OPENAL, "alcGetCurrentContext") 470 | Global alcGetContextsDevice.__proto_alcGetContextsDevice = GetFunction(DLL_OPENAL, "alcGetContextsDevice") 471 | ;-------------------------------------------------------------------------- 472 | ; * Device management 473 | ;-------------------------------------------------------------------------- 474 | Global alcOpenDevice.__proto_alcOpenDevice = GetFunction(DLL_OPENAL, "alcOpenDevice") 475 | Global alcCloseDevice.__proto_alcCloseDevice = GetFunction(DLL_OPENAL, "alcCloseDevice") 476 | ;-------------------------------------------------------------------------- 477 | ; * Error support 478 | ;-------------------------------------------------------------------------- 479 | Global alcGetError.__proto_alcGetError = GetFunction(DLL_OPENAL, "alcGetError") 480 | ;-------------------------------------------------------------------------- 481 | ; * Extension support 482 | ;-------------------------------------------------------------------------- 483 | Global alcIsExtensionPresent.__proto_alcIsExtensionPresent = GetFunction(DLL_OPENAL, "alcIsExtensionPresent") 484 | Global alcGetProcAddress.__proto_alcGetProcAddress = GetFunction(DLL_OPENAL, "alcGetProcAddress") 485 | Global alcGetEnumValue.__proto_alcGetEnumValue = GetFunction(DLL_OPENAL, "alcGetEnumValue") 486 | ;-------------------------------------------------------------------------- 487 | ; * Query function 488 | ;-------------------------------------------------------------------------- 489 | Global alcGetString.__proto_alcGetString = GetFunction(DLL_OPENAL, "alcGetString") 490 | Global alcGetIntegerv.__proto_alcGetIntegerv = GetFunction(DLL_OPENAL, "alcGetIntegerv") 491 | ;-------------------------------------------------------------------------- 492 | ; * Capture function 493 | ;-------------------------------------------------------------------------- 494 | Global alcCaptureOpenDevice.__proto_alcCaptureOpenDevice = GetFunction(DLL_OPENAL, "alcCaptureOpenDevice") 495 | Global alcCaptureCloseDevice.__proto_alcCaptureCloseDevice = GetFunction(DLL_OPENAL, "alcCaptureCloseDevice") 496 | Global alcCaptureStart.__proto_alcCaptureStart = GetFunction(DLL_OPENAL, "alcCaptureStart") 497 | Global alcCaptureStop.__proto_alcCaptureStop = GetFunction(DLL_OPENAL, "alcCaptureStop") 498 | Global alcCaptureSamples.__proto_alcCaptureSamples = GetFunction(DLL_OPENAL, "alcCaptureSamples") 499 | EndProcedure 500 | 501 | Procedure AL_Dispose() 502 | Debug "OpenAL Soft Closing" 503 | CloseLibrary(DLL_OPENAL) 504 | EndProcedure 505 | 506 | Procedure AL_GetFormatFromChannelCount(ChannelCount.i) 507 | Select ChannelCount 508 | Case 1 509 | ProcedureReturn #AL_FORMAT_MONO16 510 | Case 2 511 | ProcedureReturn #AL_FORMAT_STEREO16 512 | Case 4 513 | ProcedureReturn alGetEnumValue("AL_FORMAT_QUAD16") 514 | Case 6 515 | ProcedureReturn alGetEnumValue("AL_FORMAT_51CHN16") 516 | Case 7 517 | ProcedureReturn alGetEnumValue("AL_FORMAT_61CHN16") 518 | Case 8 519 | ProcedureReturn alGetEnumValue("AL_FORMAT_71CHN16") 520 | Default 521 | ProcedureReturn 0 522 | EndSelect 523 | EndProcedure 524 | ; IDE Options = PureBasic 5.71 LTS (Windows - x86) 525 | ; CursorPosition = 7 526 | ; Folding = - 527 | ; EnableXP -------------------------------------------------------------------------------- /Lua/Lua53.pb: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; ** Lua53.pb 3 | ;------------------------------------------------------------------------------ 4 | ; This module represents a Lua5.2&3 header to import Lua (scripting language). 5 | ; http://00laboratories.com/ 6 | ;============================================================================== 7 | IncludeFile #PB_Compiler_File + "i" ;- PBHGEN 8 | 9 | ; 523 Lua 5.2.3 Header 10 | ; 530 Lua 5.3.0 Header 11 | #LUA_VERSION_PUREBASIC = 530 12 | 13 | ;-------------------------------------------------------------------------- 14 | Global DLL_LUA.i ; DLL Handle 15 | ;-------------------------------------------------------------------------- 16 | ; * Lua Version Information 17 | ;-------------------------------------------------------------------------- 18 | CompilerIf #LUA_VERSION_PUREBASIC = 523 19 | #LUA_VERSION_MAJOR = "5" 20 | #LUA_VERSION_MINOR = "2" 21 | #LUA_VERSION_NUM = 502 22 | #LUA_VERSION_RELEASE = "1" 23 | CompilerEndIf 24 | CompilerIf #LUA_VERSION_PUREBASIC = 530 25 | #LUA_VERSION_MAJOR = "5" 26 | #LUA_VERSION_MINOR = "3" 27 | #LUA_VERSION_NUM = 503 28 | #LUA_VERSION_RELEASE = "0" 29 | CompilerEndIf 30 | #LUA_VERSION = "Lua "+#LUA_VERSION_MAJOR+"."+#LUA_VERSION_MINOR 31 | #LUA_RELEASE = #LUA_VERSION+"."+#LUA_VERSION_RELEASE 32 | #LUA_COPYRIGHT = #LUA_RELEASE+" Copyright (C) 1994-2015 Lua.org, PUC-Rio" 33 | #LUA_AUTHORS = "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" 34 | ;-------------------------------------------------------------------------- 35 | ; * PreCompiled Code 36 | ;-------------------------------------------------------------------------- 37 | CompilerIf #LUA_VERSION_PUREBASIC = 523 38 | #LUA_SIGNATURE = Chr(033) + "Lua" 39 | CompilerEndIf 40 | CompilerIf #LUA_VERSION_PUREBASIC = 530 41 | #LUA_SIGNATURE = Chr(027) + "Lua" 42 | CompilerEndIf 43 | ;-------------------------------------------------------------------------- 44 | ; * Lua Calling Options 45 | ;-------------------------------------------------------------------------- 46 | #LUA_MULTRET = -1 ; Option To Return Multiple Values 47 | ;-------------------------------------------------------------------------- 48 | ; * Lua Threading 49 | ;-------------------------------------------------------------------------- 50 | #LUA_OK = 0 ; Thread Status Ok 51 | #LUA_YIELD = 1 ; Thread Status Yield 52 | #LUA_ERRRUN = 2 ; Thread Status Runtime Error 53 | #LUA_ERRSYNTAX = 3 ; Thread Status Syntax Error 54 | #LUA_ERRMEM = 4 ; Thread Status Memory Allocation Error 55 | #LUA_ERRGCMM = 5 ; Thread Status Garbage Collector? 56 | #LUA_ERRERR = 6 ; Thread Status Double Error Attempt to Print 57 | ;-------------------------------------------------------------------------- 58 | ; * Lua Basic Types 59 | ;-------------------------------------------------------------------------- 60 | #LUA_TNONE = -1 ; Nothing 61 | #LUA_TNIL = 0 ; Nil 62 | #LUA_TBOOLEAN = 1 ; Boolean 63 | #LUA_TLIGHTUSERDATA = 2 ; Light User Data 64 | #LUA_TNUMBER = 3 ; Number 65 | #LUA_TSTRING = 4 ; String 66 | #LUA_TTABLE = 5 ; Table 67 | #LUA_TFUNCTION = 6 ; Function 68 | #LUA_TUSERDATA = 7 ; Heavy User Data 69 | #LUA_TTHREAD = 8 ; Thread 70 | #LUA_NUMTAGS = 9 ; Total Types 71 | ;-------------------------------------------------------------------------- 72 | ; * Lua Stack 73 | ;-------------------------------------------------------------------------- 74 | #LUA_MINSTACK = 20 ; Minimum Stack Available for a C Function 75 | ;-------------------------------------------------------------------------- 76 | ; * Lua Registry 77 | ;-------------------------------------------------------------------------- 78 | #LUA_RIDX_MAINTHREAD = 1 ; Main Thread 79 | #LUA_RIDX_GLOBALS = 2 ; Global 80 | #LUA_RIDX_LAST = #LUA_RIDX_GLOBALS 81 | ;-------------------------------------------------------------------------- 82 | ; * Lua Operators 83 | ;-------------------------------------------------------------------------- 84 | CompilerIf #LUA_VERSION_PUREBASIC = 523 85 | #LUA_OPADD = 0 ; + 86 | #LUA_OPSUB = 1 ; - 87 | #LUA_OPMUL = 2 ; * 88 | #LUA_OPDIV = 3 ; / 89 | #LUA_OPMOD = 4 ; % 90 | #LUA_OPPOW = 5 ; ^ 91 | #LUA_OPUNM = 6 ; -v 92 | CompilerEndIf 93 | CompilerIf #LUA_VERSION_PUREBASIC = 530 94 | #LUA_OPADD = 0 95 | #LUA_OPSUB = 1 96 | #LUA_OPMUL = 2 97 | #LUA_OPMOD = 3 98 | #LUA_OPPOW = 4 99 | #LUA_OPDIV = 5 100 | #LUA_OPIDIV = 6 101 | #LUA_OPBAND = 7 102 | #LUA_OPBOR = 8 103 | #LUA_OPBXOR = 9 104 | #LUA_OPSHL = 10 105 | #LUA_OPSHR = 11 106 | #LUA_OPUNM = 12 107 | #LUA_OPBNOT = 13 108 | CompilerEndIf 109 | #LUA_OPEQ = 0 ; == 110 | #LUA_OPLT = 1 ; < 111 | #LUA_OPLE = 2 ; 112 | ;-------------------------------------------------------------------------- 113 | ; * Lua Garbage Collector 114 | ;-------------------------------------------------------------------------- 115 | #LUA_GCSTOP = 0 ; Stop 116 | #LUA_GCRESTART = 1 ; Restart 117 | #LUA_GCCOLLECT = 2 ; Collect 118 | #LUA_GCCOUNT = 3 ; Amount of Memory Kilobytes Used by Lua 119 | #LUA_GCCOUNTB = 4 ; Remainder of Dividing Bytes of Memory by 1024 120 | #LUA_GCSTEP = 5 ; Step 121 | #LUA_GCSETPAUSE = 6 ; Set Pause 122 | #LUA_GCSETSTEPMUL = 7 ; Set Step Mul 123 | #LUA_GCISRUNNING = 9 ; Is Running 124 | CompilerIf #LUA_VERSION_PUREBASIC = 523 125 | #LUA_GCSETMAJORINC = 8 ; Set Major Increase 126 | #LUA_GCGEN = 10 ; Gen 127 | #LUA_GCINC = 11 ; Inc 128 | CompilerEndIf 129 | ;-------------------------------------------------------------------------- 130 | ; * Lua Pseudo Indices 131 | ;-------------------------------------------------------------------------- 132 | #LUA_REGISTRYINDEX = (-10000) 133 | #LUA_ENVIRONINDEX = (-10001) 134 | #LUA_GLOBALSINDEX = (-10002) 135 | ;-------------------------------------------------------------------------- 136 | ; * Lua Event Codes 137 | ;-------------------------------------------------------------------------- 138 | #LUA_HOOKCALL = 0 139 | #LUA_HOOKRET = 1 140 | #LUA_HOOKLINE = 2 141 | #LUA_HOOKCOUNT = 3 142 | #LUA_HOOKTAILRET = 4 143 | ;-------------------------------------------------------------------------- 144 | ; * Lua Event Masks 145 | ;-------------------------------------------------------------------------- 146 | #LUA_MASKCALL = 1 << #LUA_HOOKCALL 147 | #LUA_MASKRET = 1 << #LUA_HOOKRET 148 | #LUA_MASKLINE = 1 << #LUA_HOOKLINE 149 | #LUA_MASKCOUNT = 1 << #LUA_HOOKCOUNT 150 | ;-------------------------------------------------------------------------- 151 | ; * Lua Prototypes: State 152 | ;-------------------------------------------------------------------------- 153 | PrototypeC.l __proto_lua_newstate (*f, *ud) 154 | PrototypeC.l __proto_lua_close (lua_State.i) 155 | PrototypeC.l __proto_lua_newthread (lua_State.i) 156 | PrototypeC.l __proto_lua_atpanic (lua_State.i, *panicf) 157 | CompilerIf #LUA_VERSION_PUREBASIC = 530 158 | PrototypeC.l __proto_lua_version (lua_State.i) 159 | CompilerEndIf 160 | ;-------------------------------------------------------------------------- 161 | ; * Lua Prototypes: Basic Stack Manipulation 162 | ;-------------------------------------------------------------------------- 163 | PrototypeC.l __proto_lua_absindex (lua_State.i, idx.l) 164 | PrototypeC.l __proto_lua_gettop (lua_State.i) 165 | PrototypeC.l __proto_lua_settop (lua_State.i, idx.l) 166 | PrototypeC.l __proto_lua_pushvalue (lua_State.i, idx.l) 167 | CompilerIf #LUA_VERSION_PUREBASIC = 530 168 | PrototypeC.l __proto_lua_rotate (lua_State.i, idx.l, n.l) 169 | Macro lua_remove (L, idx) : lua_rotate(L, (idx), -1) : lua_pop(L, 1) : EndMacro 170 | Macro lua_insert (L, idx) : lua_rotate(L, (idx), 1) : EndMacro 171 | Macro lua_replace (L, idx) : lua_copy(L, -1, (idx)) : lua_pop(L, 1) : EndMacro 172 | CompilerEndIf 173 | CompilerIf #LUA_VERSION_PUREBASIC = 523 174 | PrototypeC.l __proto_lua_remove (lua_State.i, idx.l) 175 | PrototypeC.l __proto_lua_insert (lua_State.i, idx.l) 176 | PrototypeC.l __proto_lua_replace (lua_State.i, idx.l) 177 | CompilerEndIf 178 | PrototypeC.l __proto_lua_copy (lua_State.i, fromidx.l, toidx.l) 179 | PrototypeC.l __proto_lua_checkstack (lua_State.i, sz.l) 180 | PrototypeC.l __proto_lua_xmove (lua_State_from.i, lua_State_to.i, n.l) 181 | ;-------------------------------------------------------------------------- 182 | ; * Lua Prototypes: Access Functions (Stack->C) 183 | ;-------------------------------------------------------------------------- 184 | PrototypeC.l __proto_lua_isnumber (lua_State.i, idx.l) 185 | PrototypeC.l __proto_lua_isstring (lua_State.i, idx.l) 186 | PrototypeC.l __proto_lua_iscfunction (lua_State.i, idx.l) 187 | CompilerIf #LUA_VERSION_PUREBASIC = 530 188 | PrototypeC.l __proto_lua_isinteger (lua_State.i, idx.l) 189 | CompilerEndIf 190 | PrototypeC.l __proto_lua_isuserdata (lua_State.i, idx.l) 191 | PrototypeC.l __proto_lua_type (lua_State.i, idx.l) 192 | PrototypeC.l __proto_lua_typename (lua_State.i, tp.l) 193 | PrototypeC.d __proto_lua_tonumberx (lua_State.i, idx.l, *isnum) 194 | PrototypeC.l __proto_lua_tointegerx (lua_State.i, idx.l, *isnum) 195 | PrototypeC.l __proto_lua_tounsignedx (lua_State.i, idx.l, *isnum) 196 | PrototypeC.l __proto_lua_toboolean (lua_State.i, idx.l) 197 | PrototypeC.l __proto_lua_tolstring (lua_State.i, idx.l, *len) 198 | PrototypeC.l __proto_lua_rawlen (lua_State.i, idx.l) 199 | PrototypeC.l __proto_lua_tocfunction (lua_State.i, idx.l) 200 | PrototypeC.l __proto_lua_touserdata (lua_State.i, idx.l) 201 | PrototypeC.l __proto_lua_tothread (lua_State.i, idx.l) 202 | PrototypeC.l __proto_lua_topointer (lua_State.i, idx.l) 203 | ;-------------------------------------------------------------------------- 204 | ; * Lua Prototypes: Comparison And Arithmetic 205 | ;-------------------------------------------------------------------------- 206 | PrototypeC.l __proto_lua_arith (lua_State.i, op.l) 207 | PrototypeC.l __proto_lua_rawequal (lua_State.i, idx1.l, idx2.l) 208 | PrototypeC.l __proto_lua_compare (lua_State.i, idx1.l, idx2.l, op.l) 209 | ;-------------------------------------------------------------------------- 210 | ; * Lua Prototypes: Push Functions (C->Stack) 211 | ;-------------------------------------------------------------------------- 212 | PrototypeC.l __proto_lua_pushnil (lua_State.i) 213 | PrototypeC.l __proto_lua_pushnumber (lua_State.i, n.d) 214 | PrototypeC.l __proto_lua_pushinteger (lua_State.i, n.q) 215 | PrototypeC.l __proto_lua_pushunsigned (lua_State.i, n.q) 216 | PrototypeC.l __proto_lua_pushlstring (lua_State.i, string.p-ascii, size.i) 217 | PrototypeC.l __proto_lua_pushstring (lua_State.i, string.p-ascii) 218 | PrototypeC.l __proto_lua_pushcclosure (lua_State.i, *fn, n.l) 219 | PrototypeC.l __proto_lua_pushboolean (lua_State.i, b.l) 220 | PrototypeC.l __proto_lua_pushlightuserdata (lua_State.i, *p) 221 | PrototypeC.l __proto_lua_pushthread (lua_State.i) 222 | ;-------------------------------------------------------------------------- 223 | ; * Lua Prototypes: Get Functions (Lua->Stack) 224 | ;-------------------------------------------------------------------------- 225 | PrototypeC.l __proto_lua_getglobal (lua_State.i, *string_var) ; .p-ascii causes memory leak 226 | PrototypeC.l __proto_lua_gettable (lua_State.i, idx.l) 227 | PrototypeC.l __proto_lua_getfield (lua_State.i, idx.l, k.p-ascii) 228 | CompilerIf #LUA_VERSION_PUREBASIC = 530 229 | PrototypeC.l __proto_lua_geti (lua_State.i, idx.l, n.q) 230 | CompilerEndIf 231 | PrototypeC.l __proto_lua_rawget (lua_State.i, idx.l) 232 | PrototypeC.l __proto_lua_rawgeti (lua_State.i, idx.l, n.l) 233 | PrototypeC.l __proto_lua_rawgetp (lua_State.i, idx.l, p.p-ascii) 234 | PrototypeC.l __proto_lua_createtable (lua_State.i, narr.l, nrec.l) 235 | PrototypeC.l __proto_lua_newuserdata (lua_State.i, sz.i) 236 | PrototypeC.l __proto_lua_getmetatable (lua_State.i, objindex.l) 237 | PrototypeC.l __proto_lua_getuservalue (lua_State.i, idx.l) 238 | ;-------------------------------------------------------------------------- 239 | ; * Lua Prototypes: Set Functions (Lua->Stack) 240 | ;-------------------------------------------------------------------------- 241 | PrototypeC.l __proto_lua_setglobal (lua_State.i, var.p-ascii) 242 | PrototypeC.l __proto_lua_settable (lua_State.i, idx.l) 243 | PrototypeC.l __proto_lua_setfield (lua_State.i, idx.l, k.p-ascii) 244 | CompilerIf #LUA_VERSION_PUREBASIC = 530 245 | PrototypeC.l __proto_lua_seti (lua_State.i, idx.l, n.q) 246 | CompilerEndIf 247 | PrototypeC.l __proto_lua_rawset (lua_State.i, idx.l) 248 | PrototypeC.l __proto_lua_rawseti (lua_State.i, idx.l, n.l) 249 | PrototypeC.l __proto_lua_rawsetp (lua_State.i, idx.l, p.p-ascii) 250 | PrototypeC.l __proto_lua_setmetatable (lua_State.i, objindex.l) 251 | PrototypeC.l __proto_lua_setuservalue (lua_State.i, idx.l) 252 | ;-------------------------------------------------------------------------- 253 | ; * Lua Prototypes: Load, Call 254 | ;-------------------------------------------------------------------------- 255 | PrototypeC.l __proto_lua_callk (lua_State.i, nargs.l, nresults.l, ctx.l, *k) 256 | PrototypeC.l __proto_lua_getctx (lua_State.i, *ctx) 257 | PrototypeC.l __proto_lua_pcallk (lua_State.i, nargs.l, nresults.l, *errfunc, ctx.l, *k) 258 | PrototypeC.l __proto_lua_load (lua_State.i, reader.i, *dt, chunkname.p-ascii, mode.p-ascii) 259 | PrototypeC.l __proto_lua_dump (lua_State.i, writer.i, *data_) 260 | ;-------------------------------------------------------------------------- 261 | ; * Lua Prototypes: Coroutine Functions 262 | ;-------------------------------------------------------------------------- 263 | PrototypeC.l __proto_lua_yieldk (lua_State.i, nresults.l, ctx.l, *k) 264 | PrototypeC.l __proto_lua_resume (lua_State.i, lua_State_from.i, narg.l) 265 | PrototypeC.l __proto_lua_status (lua_State.i) 266 | CompilerIf #LUA_VERSION_PUREBASIC = 530 267 | PrototypeC.l __proto_lua_isyieldable (lua_State.i) 268 | CompilerEndIf 269 | ;-------------------------------------------------------------------------- 270 | ; * Lua Prototypes: Garbage Collection 271 | ;-------------------------------------------------------------------------- 272 | PrototypeC.l __proto_lua_gc (lua_State.i, what.l, data_.i) 273 | ;-------------------------------------------------------------------------- 274 | ; * Lua Prototypes: Miscellaneous Functions 275 | ;-------------------------------------------------------------------------- 276 | PrototypeC.l __proto_lua_error (lua_State.i) 277 | PrototypeC.l __proto_lua_next (lua_State.i, idx.l) 278 | PrototypeC.l __proto_lua_concat (lua_State.i, n.l) 279 | PrototypeC.l __proto_lua_len (lua_State.i, idx.l) 280 | CompilerIf #LUA_VERSION_PUREBASIC = 530 281 | PrototypeC.l __proto_lua_stringtonumber (lua_State.i, str.p-ascii) 282 | CompilerEndIf 283 | PrototypeC.l __proto_lua_getallocf (lua_State.i, *ud) 284 | PrototypeC.l __proto_lua_setallocf (lua_State.i, *f, *ud) 285 | ;-------------------------------------------------------------------------- 286 | PrototypeC.l __proto_luaopen_base (lua_State.i) 287 | PrototypeC.l __proto_luaopen_coroutine (lua_State.i) 288 | PrototypeC.l __proto_luaopen_table (lua_State.i) 289 | PrototypeC.l __proto_luaopen_io (lua_State.i) 290 | PrototypeC.l __proto_luaopen_os (lua_State.i) 291 | PrototypeC.l __proto_luaopen_string (lua_State.i) 292 | PrototypeC.l __proto_luaopen_bit32 (lua_State.i) 293 | PrototypeC.l __proto_luaopen_math (lua_State.i) 294 | PrototypeC.l __proto_luaopen_debug (lua_State.i) 295 | PrototypeC.l __proto_luaopen_package (lua_State.i) 296 | ;-------------------------------------------------------------------------- 297 | ; * Lua Prototypes: Macro Functions 298 | ;-------------------------------------------------------------------------- 299 | PrototypeC.l __proto_luaL_openlibs (lua_State.i) 300 | PrototypeC.l __proto_luaL_openlib (lua_State.i, libname.p-ascii, *luaL_Reg, nup.l) 301 | PrototypeC.l __proto_luaL_register (lua_State.i, libname.p-ascii, *luaL_Reg) 302 | PrototypeC.l __proto_luaL_getmetafield (lua_State.i, obj.l, e.p-ascii) 303 | PrototypeC.l __proto_luaL_callmeta (lua_State.i, obj.l, e.p-ascii) 304 | PrototypeC.l __proto_luaL_typerror (lua_State.i, narg.l, tname.p-ascii) 305 | PrototypeC.l __proto_luaL_argerror (lua_State.i, numarg.l, extramsg.p-ascii) 306 | PrototypeC.l __proto_luaL_checklstring (lua_State.i, numarg.l, size.l) 307 | PrototypeC.l __proto_luaL_optlstring (lua_State.i, numarg.l, def.p-ascii, size.l) 308 | PrototypeC.l __proto_luaL_checknumber (lua_State.i, numarg.l) 309 | PrototypeC.l __proto_luaL_optnumber (lua_State.i, narg, LUA_NUMBER.d) 310 | PrototypeC.l __proto_luaL_checkinteger (lua_State.i, numarg.l) 311 | PrototypeC.l __proto_luaL_optinteger (lua_State.i, narg.l, LUA_INTEGER.l) 312 | PrototypeC.l __proto_luaL_checkstack (lua_State.i, sz.l, msg.p-ascii) 313 | PrototypeC.l __proto_luaL_checktype (lua_State.i, narg.l, t.l) 314 | PrototypeC.l __proto_luaL_checkany (lua_State.i, narg.l) 315 | PrototypeC.l __proto_luaL_newmetatable (lua_State.i, tname.p-ascii) 316 | PrototypeC.l __proto_luaL_checkudata (lua_State.i, ud.l, tname.p-ascii) 317 | PrototypeC.l __proto_luaL_where (lua_State.i, lvl.l) 318 | PrototypeC.l __proto_luaL_checkoption (lua_State.i, narg.l, def.p-ascii, *string_array) 319 | PrototypeC.l __proto_luaL_ref (lua_State.i, t.l) 320 | PrototypeC.l __proto_luaL_unref (lua_State.i, t.l, ref.l) 321 | PrototypeC.l __proto_luaL_loadfilex (lua_State.i, filename.p-ascii, *mode) 322 | PrototypeC.l __proto_luaL_loadbuffer (lua_State.i, buff.l, size.l, name.p-ascii) 323 | PrototypeC.l __proto_luaL_loadstring (lua_State.i, string.p-ascii) 324 | ;luaL_loadfile (lua_State.i, filename.p-ascii) 325 | PrototypeC.l __proto_luaL_gsub (lua_State.i, s.p-ascii, p.p-ascii, r.p-ascii) 326 | PrototypeC.l __proto_luaL_newstate () 327 | PrototypeC.l __proto_luaL_findtable (lua_State.i, Index.l, fname.p-ascii) 328 | PrototypeC.l __proto_luaL_buffinit (lua_State.i, *luaL_Buffer) 329 | PrototypeC.l __proto_luaL_prepbuffer (*luaL_Buffer) 330 | PrototypeC.l __proto_luaL_addlstring (*luaL_Buffer, s.p-ascii, size.l) 331 | PrototypeC.l __proto_luaL_addstring (*luaL_Buffer, s.p-ascii) 332 | PrototypeC.l __proto_luaL_addvalue (*luaL_Buffer) 333 | PrototypeC.l __proto_luaL_pushresult (*luaL_Buffer) 334 | ;-------------------------------------------------------------------------- 335 | ; * Initialize and Import Lua Library 336 | ;-------------------------------------------------------------------------- 337 | Procedure Lua_Initialize() 338 | Debug "Lua Initializing" 339 | CompilerIf #PB_Compiler_Processor = #PB_Processor_x64 340 | DLL_LUA = OpenLibrary(#PB_Any, "x64/lua53.dll") ; select your dll here! 341 | CompilerElse 342 | DLL_LUA = OpenLibrary(#PB_Any, "x86/lua53.dll") ; select your dll here! 343 | CompilerEndIf 344 | ;-------------------------------------------------------------------------- 345 | ; * Lua Library: State 346 | ;-------------------------------------------------------------------------- 347 | Global lua_newstate.__proto_lua_newstate = GetFunction(DLL_LUA, "lua_newstate") 348 | Global lua_close.__proto_lua_close = GetFunction(DLL_LUA, "lua_close") 349 | Global lua_newthread.__proto_lua_newthread = GetFunction(DLL_LUA, "lua_newthread") 350 | Global lua_atpanic.__proto_lua_atpanic = GetFunction(DLL_LUA, "lua_atpanic") 351 | CompilerIf #LUA_VERSION_PUREBASIC = 530 352 | Global lua_version.__proto_lua_version = GetFunction(DLL_LUA, "lua_version") 353 | CompilerEndIf 354 | ;-------------------------------------------------------------------------- 355 | ; * Lua Library: Basic Stack Manipulation 356 | ;-------------------------------------------------------------------------- 357 | Global lua_absindex.__proto_lua_absindex = GetFunction(DLL_LUA, "lua_absindex") 358 | Global lua_gettop.__proto_lua_gettop = GetFunction(DLL_LUA, "lua_gettop") 359 | Global lua_settop.__proto_lua_settop = GetFunction(DLL_LUA, "lua_settop") 360 | Global lua_pushvalue.__proto_lua_pushvalue = GetFunction(DLL_LUA, "lua_pushvalue") 361 | CompilerIf #LUA_VERSION_PUREBASIC = 530 362 | Global lua_rotate.__proto_lua_rotate = GetFunction(DLL_LUA, "lua_rotate") 363 | CompilerEndIf 364 | CompilerIf #LUA_VERSION_PUREBASIC = 523 365 | Global lua_remove.__proto_lua_remove = GetFunction(DLL_LUA, "lua_remove") 366 | Global lua_insert.__proto_lua_insert = GetFunction(DLL_LUA, "lua_insert") 367 | Global lua_replace.__proto_lua_replace = GetFunction(DLL_LUA, "lua_replace") 368 | CompilerEndIf 369 | Global lua_copy.__proto_lua_copy = GetFunction(DLL_LUA, "lua_copy") 370 | Global lua_checkstack.__proto_lua_checkstack = GetFunction(DLL_LUA, "lua_checkstack") 371 | Global lua_xmove.__proto_lua_xmove = GetFunction(DLL_LUA, "lua_xmove") 372 | ;-------------------------------------------------------------------------- 373 | ; * Lua Library: Access Functions (Stack->C) 374 | ;-------------------------------------------------------------------------- 375 | Global lua_isnumber.__proto_lua_isnumber = GetFunction(DLL_LUA, "lua_isnumber") 376 | Global lua_isstring.__proto_lua_isstring = GetFunction(DLL_LUA, "lua_isstring") 377 | Global lua_iscfunction.__proto_lua_iscfunction = GetFunction(DLL_LUA, "lua_iscfunction") 378 | CompilerIf #LUA_VERSION_PUREBASIC = 530 379 | Global lua_isinteger.__proto_lua_isinteger = GetFunction(DLL_LUA, "lua_isinteger") 380 | CompilerEndIf 381 | Global lua_isuserdata.__proto_lua_isuserdata = GetFunction(DLL_LUA, "lua_isuserdata") 382 | Global lua_type.__proto_lua_type = GetFunction(DLL_LUA, "lua_type") 383 | Global lua_typename.__proto_lua_typename = GetFunction(DLL_LUA, "lua_typename") 384 | Global lua_tonumberx.__proto_lua_tonumberx = GetFunction(DLL_LUA, "lua_tonumberx") 385 | Global lua_tointegerx.__proto_lua_tointegerx = GetFunction(DLL_LUA, "lua_tointegerx") 386 | Global lua_tounsignedx.__proto_lua_tounsignedx = GetFunction(DLL_LUA, "lua_tounsignedx") 387 | Global lua_toboolean.__proto_lua_toboolean = GetFunction(DLL_LUA, "lua_toboolean") 388 | Global lua_tolstring.__proto_lua_tolstring = GetFunction(DLL_LUA, "lua_tolstring") 389 | Global lua_rawlen.__proto_lua_rawlen = GetFunction(DLL_LUA, "lua_rawlen") 390 | Global lua_tocfunction.__proto_lua_tocfunction = GetFunction(DLL_LUA, "lua_tocfunction") 391 | Global lua_touserdata.__proto_lua_touserdata = GetFunction(DLL_LUA, "lua_touserdata") 392 | Global lua_tothread.__proto_lua_tothread = GetFunction(DLL_LUA, "lua_tothread") 393 | Global lua_topointer.__proto_lua_topointer = GetFunction(DLL_LUA, "lua_topointer") 394 | ;-------------------------------------------------------------------------- 395 | ; * Lua Library: Comparison And Arithmetic 396 | ;-------------------------------------------------------------------------- 397 | Global lua_arith.__proto_lua_arith = GetFunction(DLL_LUA, "lua_arith") 398 | Global lua_rawequal.__proto_lua_rawequal = GetFunction(DLL_LUA, "lua_rawequal") 399 | Global lua_compare.__proto_lua_compare = GetFunction(DLL_LUA, "lua_compare") 400 | ;-------------------------------------------------------------------------- 401 | ; * Lua Library: Push Functions (C->Stack) 402 | ;-------------------------------------------------------------------------- 403 | Global lua_pushnil.__proto_lua_pushnil = GetFunction(DLL_LUA, "lua_pushnil") 404 | Global lua_pushnumber.__proto_lua_pushnumber = GetFunction(DLL_LUA, "lua_pushnumber") 405 | Global lua_pushinteger.__proto_lua_pushinteger = GetFunction(DLL_LUA, "lua_pushinteger") 406 | Global lua_pushunsigned.__proto_lua_pushunsigned = GetFunction(DLL_LUA, "lua_pushunsigned") 407 | Global lua_pushlstring.__proto_lua_pushlstring = GetFunction(DLL_LUA, "lua_pushlstring") 408 | Global lua_pushstring.__proto_lua_pushstring = GetFunction(DLL_LUA, "lua_pushstring") 409 | Global lua_pushcclosure.__proto_lua_pushcclosure = GetFunction(DLL_LUA, "lua_pushcclosure") 410 | Global lua_pushboolean.__proto_lua_pushboolean = GetFunction(DLL_LUA, "lua_pushboolean") 411 | Global lua_pushlightuserdata.__proto_lua_pushlightuserdata = GetFunction(DLL_LUA, "lua_pushlightuserdata") 412 | Global lua_pushthread.__proto_lua_pushthread = GetFunction(DLL_LUA, "lua_pushthread") 413 | ;-------------------------------------------------------------------------- 414 | ; * Lua Library: Get Functions (Lua->Stack) 415 | ;-------------------------------------------------------------------------- 416 | Global lua_getglobal.__proto_lua_getglobal = GetFunction(DLL_LUA, "lua_getglobal") 417 | Global lua_gettable.__proto_lua_gettable = GetFunction(DLL_LUA, "lua_gettable") 418 | Global lua_getfield.__proto_lua_getfield = GetFunction(DLL_LUA, "lua_getfield") 419 | CompilerIf #LUA_VERSION_PUREBASIC = 530 420 | Global lua_geti.__proto_lua_geti = GetFunction(DLL_LUA, "lua_geti") 421 | CompilerEndIf 422 | Global lua_rawget.__proto_lua_rawget = GetFunction(DLL_LUA, "lua_rawget") 423 | Global lua_rawgeti.__proto_lua_rawgeti = GetFunction(DLL_LUA, "lua_rawgeti") 424 | Global lua_rawgetp.__proto_lua_rawgetp = GetFunction(DLL_LUA, "lua_rawgetp") 425 | Global lua_createtable.__proto_lua_createtable = GetFunction(DLL_LUA, "lua_createtable") 426 | Global lua_newuserdata.__proto_lua_newuserdata = GetFunction(DLL_LUA, "lua_newuserdata") 427 | Global lua_getmetatable.__proto_lua_getmetatable = GetFunction(DLL_LUA, "lua_getmetatable") 428 | Global lua_getuservalue.__proto_lua_getuservalue = GetFunction(DLL_LUA, "lua_getuservalue") 429 | ;-------------------------------------------------------------------------- 430 | ; * Lua Library: Set Functions (Lua->Stack) 431 | ;-------------------------------------------------------------------------- 432 | Global lua_setglobal.__proto_lua_setglobal = GetFunction(DLL_LUA, "lua_setglobal") 433 | Global lua_settable.__proto_lua_settable = GetFunction(DLL_LUA, "lua_settable") 434 | Global lua_setfield.__proto_lua_setfield = GetFunction(DLL_LUA, "lua_setfield") 435 | CompilerIf #LUA_VERSION_PUREBASIC = 530 436 | Global lua_seti.__proto_lua_seti = GetFunction(DLL_LUA, "lua_seti") 437 | CompilerEndIf 438 | Global lua_rawset.__proto_lua_rawset = GetFunction(DLL_LUA, "lua_rawset") 439 | Global lua_rawseti.__proto_lua_rawseti = GetFunction(DLL_LUA, "lua_rawseti") 440 | Global lua_rawsetp.__proto_lua_rawsetp = GetFunction(DLL_LUA, "lua_rawsetp") 441 | Global lua_setmetatable.__proto_lua_setmetatable = GetFunction(DLL_LUA, "lua_setmetatable") 442 | Global lua_setuservalue.__proto_lua_setuservalue = GetFunction(DLL_LUA, "lua_setuservalue") 443 | ;-------------------------------------------------------------------------- 444 | ; * Lua Library: Load, Call 445 | ;-------------------------------------------------------------------------- 446 | Global lua_callk.__proto_lua_callk = GetFunction(DLL_LUA, "lua_callk") 447 | Global lua_getctx.__proto_lua_getctx = GetFunction(DLL_LUA, "lua_getctx") 448 | Global lua_pcallk.__proto_lua_pcallk = GetFunction(DLL_LUA, "lua_pcallk") 449 | Global lua_load.__proto_lua_load = GetFunction(DLL_LUA, "lua_load") 450 | Global lua_dump.__proto_lua_dump = GetFunction(DLL_LUA, "lua_dump") 451 | ;-------------------------------------------------------------------------- 452 | ; * Lua Library: Coroutine Functions 453 | ;-------------------------------------------------------------------------- 454 | Global lua_yieldk.__proto_lua_yieldk = GetFunction(DLL_LUA, "lua_yieldk") 455 | Global lua_resume.__proto_lua_resume = GetFunction(DLL_LUA, "lua_resume") 456 | Global lua_status.__proto_lua_status = GetFunction(DLL_LUA, "lua_status") 457 | CompilerIf #LUA_VERSION_PUREBASIC = 530 458 | Global lua_isyieldable.__proto_lua_isyieldable = GetFunction(DLL_LUA, "lua_isyieldable") 459 | CompilerEndIf 460 | ;-------------------------------------------------------------------------- 461 | ; * Lua Library: Garbage Collection 462 | ;-------------------------------------------------------------------------- 463 | Global lua_gc.__proto_lua_gc = GetFunction(DLL_LUA, "lua_gc") 464 | ;-------------------------------------------------------------------------- 465 | ; * Lua Library: Miscellaneous Functions 466 | ;-------------------------------------------------------------------------- 467 | Global lua_error.__proto_lua_error = GetFunction(DLL_LUA, "lua_error") 468 | Global lua_next.__proto_lua_next = GetFunction(DLL_LUA, "lua_next") 469 | Global lua_concat.__proto_lua_concat = GetFunction(DLL_LUA, "lua_concat") 470 | Global lua_len.__proto_lua_len = GetFunction(DLL_LUA, "lua_len") 471 | CompilerIf #LUA_VERSION_PUREBASIC = 530 472 | Global lua_stringtonumber.__proto_lua_stringtonumber = GetFunction(DLL_LUA, "lua_stringtonumber") 473 | CompilerEndIf 474 | Global lua_getallocf.__proto_lua_getallocf = GetFunction(DLL_LUA, "lua_getallocf") 475 | Global lua_setallocf.__proto_lua_setallocf = GetFunction(DLL_LUA, "lua_setallocf") 476 | ;-------------------------------------------------------------------------- 477 | Global luaopen_base.__proto_luaopen_base = GetFunction(DLL_LUA, "luaopen_base") 478 | Global luaopen_coroutine.__proto_luaopen_coroutine = GetFunction(DLL_LUA, "luaopen_coroutine") 479 | Global luaopen_table.__proto_luaopen_table = GetFunction(DLL_LUA, "luaopen_table") 480 | Global luaopen_io.__proto_luaopen_io = GetFunction(DLL_LUA, "luaopen_io") 481 | Global luaopen_os.__proto_luaopen_os = GetFunction(DLL_LUA, "luaopen_os") 482 | Global luaopen_string.__proto_luaopen_string = GetFunction(DLL_LUA, "luaopen_string") 483 | Global luaopen_bit32.__proto_luaopen_bit32 = GetFunction(DLL_LUA, "luaopen_bit32") 484 | Global luaopen_math.__proto_luaopen_math = GetFunction(DLL_LUA, "luaopen_math") 485 | Global luaopen_debug.__proto_luaopen_debug = GetFunction(DLL_LUA, "luaopen_debug") 486 | Global luaopen_package.__proto_luaopen_package = GetFunction(DLL_LUA, "luaopen_package") 487 | ;-------------------------------------------------------------------------- 488 | ; * Lua Library: Macro Functions 489 | ;-------------------------------------------------------------------------- 490 | Global luaL_openlibs.__proto_luaL_openlibs = GetFunction(DLL_LUA, "luaL_openlibs") 491 | Global luaL_openlib.__proto_luaL_openlib = GetFunction(DLL_LUA, "luaL_openlib") 492 | Global luaL_register.__proto_luaL_register = GetFunction(DLL_LUA, "luaL_register") 493 | Global luaL_getmetafield.__proto_luaL_getmetafield = GetFunction(DLL_LUA, "luaL_getmetafield") 494 | Global luaL_callmeta.__proto_luaL_callmeta = GetFunction(DLL_LUA, "luaL_callmeta") 495 | Global luaL_typerror.__proto_luaL_typerror = GetFunction(DLL_LUA, "luaL_typerror") 496 | Global luaL_argerror.__proto_luaL_argerror = GetFunction(DLL_LUA, "luaL_argerror") 497 | Global luaL_checklstring.__proto_luaL_checklstring = GetFunction(DLL_LUA, "luaL_checklstring") 498 | Global luaL_optlstring.__proto_luaL_optlstring = GetFunction(DLL_LUA, "luaL_optlstring") 499 | Global luaL_checknumber.__proto_luaL_checknumber = GetFunction(DLL_LUA, "luaL_checknumber") 500 | Global luaL_optnumber.__proto_luaL_optnumber = GetFunction(DLL_LUA, "luaL_optnumber") 501 | Global luaL_checkinteger.__proto_luaL_checkinteger = GetFunction(DLL_LUA, "luaL_checkinteger") 502 | Global luaL_optinteger.__proto_luaL_optinteger = GetFunction(DLL_LUA, "luaL_optinteger") 503 | Global luaL_checkstack.__proto_luaL_checkstack = GetFunction(DLL_LUA, "luaL_checkstack") 504 | Global luaL_checktype.__proto_luaL_checktype = GetFunction(DLL_LUA, "luaL_checktype") 505 | Global luaL_checkany.__proto_luaL_checkany = GetFunction(DLL_LUA, "luaL_checkany") 506 | Global luaL_newmetatable.__proto_luaL_newmetatable = GetFunction(DLL_LUA, "luaL_newmetatable") 507 | Global luaL_checkudata.__proto_luaL_checkudata = GetFunction(DLL_LUA, "luaL_checkudata") 508 | Global luaL_where.__proto_luaL_where = GetFunction(DLL_LUA, "luaL_where") 509 | Global luaL_checkoption.__proto_luaL_checkoption = GetFunction(DLL_LUA, "luaL_checkoption") 510 | Global luaL_ref.__proto_luaL_ref = GetFunction(DLL_LUA, "luaL_ref") 511 | Global luaL_unref.__proto_luaL_unref = GetFunction(DLL_LUA, "luaL_unref") 512 | Global luaL_loadfilex.__proto_luaL_loadfilex = GetFunction(DLL_LUA, "luaL_loadfilex") 513 | Global luaL_loadbuffer.__proto_luaL_loadbuffer = GetFunction(DLL_LUA, "luaL_loadbuffer") 514 | Global luaL_loadstring.__proto_luaL_loadstring = GetFunction(DLL_LUA, "luaL_loadstring") 515 | Global luaL_gsub.__proto_luaL_gsub = GetFunction(DLL_LUA, "luaL_gsub") 516 | Global luaL_newstate.__proto_luaL_newstate = GetFunction(DLL_LUA, "luaL_newstate") 517 | Global luaL_findtable.__proto_luaL_findtable = GetFunction(DLL_LUA, "luaL_findtable") 518 | Global luaL_buffinit.__proto_luaL_buffinit = GetFunction(DLL_LUA, "luaL_buffinit") 519 | Global luaL_prepbuffer.__proto_luaL_prepbuffer = GetFunction(DLL_LUA, "luaL_prepbuffer") 520 | Global luaL_addlstring.__proto_luaL_addlstring = GetFunction(DLL_LUA, "luaL_addlstring") 521 | Global luaL_addstring.__proto_luaL_addstring = GetFunction(DLL_LUA, "luaL_addstring") 522 | Global luaL_addvalue.__proto_luaL_addvalue = GetFunction(DLL_LUA, "luaL_addvalue") 523 | Global luaL_pushresult.__proto_luaL_pushresult = GetFunction(DLL_LUA, "luaL_pushresult") 524 | EndProcedure 525 | ;-------------------------------------------------------------------------- 526 | ; * Dispose Lua Library 527 | ;-------------------------------------------------------------------------- 528 | Procedure Lua_Dispose() 529 | Debug "Lua Closing" 530 | CloseLibrary(DLL_LUA) 531 | EndProcedure 532 | ;-------------------------------------------------------------------------- 533 | ; * IDX To String 534 | ;-------------------------------------------------------------------------- 535 | Procedure.s lua_tostring(Lua_State, idx) 536 | Protected *Temp_String = lua_tolstring(Lua_State, idx, #Null) 537 | If *Temp_String : Protected Result_String$ = PeekS(*Temp_String, -1, #PB_Ascii) : Else : Result_String$ = "" : EndIf 538 | ProcedureReturn Result_String$ 539 | EndProcedure 540 | 541 | Macro lua_call(L, n, r) 542 | lua_callk((L), (n), (r), 0, #Null) 543 | EndMacro 544 | 545 | Macro lua_pcall(L, n, r, f) 546 | lua_pcallk((L), (n), (r), (f), 0, #Null) 547 | EndMacro 548 | 549 | Macro lua_yield(L, n) 550 | lua_yieldk((L), (n), 0, #Null) 551 | EndMacro 552 | 553 | Procedure.d lua_tonumber(L, i) 554 | Protected Value.d = lua_tonumberx((L), (i), #Null) 555 | CompilerIf #PB_Compiler_OS = #PB_OS_Windows And #PB_Compiler_Processor = #PB_Processor_x64 556 | EnableASM 557 | MOVQ Value, XMM0 558 | DisableASM 559 | CompilerEndIf 560 | ProcedureReturn Value 561 | EndProcedure 562 | 563 | Macro lua_tointeger(L, i) 564 | lua_tointegerx((L), (i), #Null) 565 | EndMacro 566 | 567 | Macro lua_tounsigned(L, i) 568 | lua_tounsignedx((L), (i), #Null) 569 | EndMacro 570 | 571 | Macro lua_pop(L, n) 572 | lua_settop((L), -(n)-1) 573 | EndMacro 574 | 575 | Macro lua_newtable(L) 576 | lua_createtable((L), 0, 0) 577 | EndMacro 578 | 579 | Macro lua_register(L, n, f) 580 | lua_pushcfunction((L), (f)) 581 | lua_setglobal((L), n) 582 | EndMacro 583 | 584 | Macro lua_pushcfunction(L, f) 585 | lua_pushcclosure((L), (f), 0) 586 | EndMacro 587 | 588 | Macro lua_isfunction(L, n) 589 | (lua_type((L), (n)) = #LUA_TFUNCTION) 590 | EndMacro 591 | 592 | Macro lua_istable(L, n) 593 | (lua_type((L), (n)) = #LUA_TTABLE) 594 | EndMacro 595 | 596 | Macro lua_islightuserdata(L, n) 597 | (lua_type((L), (n)) = #LUA_TLIGHTUSERDATA) 598 | EndMacro 599 | 600 | Macro lua_isnil(L, n) 601 | (lua_type((L), (n)) = #LUA_TNIL) 602 | EndMacro 603 | 604 | Macro lua_isboolean(L, n) 605 | (lua_type((L), (n)) = #LUA_TBOOLEAN) 606 | EndMacro 607 | 608 | Macro lua_isthread(L, n) 609 | (lua_type((L), (n)) = #LUA_TTHREAD) 610 | EndMacro 611 | 612 | Macro lua_isnone(L, n) 613 | (lua_type((L), (n)) = #LUA_TNONE) 614 | EndMacro 615 | 616 | Macro lua_isnoneornil(L, n) 617 | (lua_type((L), (n)) 618 | EndMacro 619 | 620 | Macro luaL_dofile(Lua_State, Filename) 621 | luaL_loadfile(Lua_State, Filename) 622 | lua_pcall(Lua_State, 0, #LUA_MULTRET, 0) 623 | EndMacro 624 | 625 | Macro luaL_dostring(Lua_State, String) 626 | luaL_loadstring(Lua_State, String) 627 | lua_pcall(Lua_State, 0, #LUA_MULTRET, 0) 628 | EndMacro 629 | 630 | Macro luaL_loadfile(L, f) 631 | luaL_loadfilex((L),f,#Null) 632 | EndMacro 633 | 634 | Procedure lua_getglobal_fixed(L, String$) ; Because of a memory leak with .p-ascii 635 | Protected *String_Buffer = AllocateMemory(StringByteLength(String$, #PB_Ascii)+1) 636 | If *String_Buffer 637 | PokeS(*String_Buffer, String$, -1, #PB_Ascii) 638 | EndIf 639 | lua_getglobal(L, *String_Buffer) 640 | FreeMemory(*String_Buffer) 641 | EndProcedure 642 | ; IDE Options = PureBasic 6.02 LTS (Windows - x64) 643 | ; CursorPosition = 351 644 | ; FirstLine = 339 645 | ; Folding = --------- 646 | ; EnableXP --------------------------------------------------------------------------------