This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct InputElement { | |
| const char* name; | |
| ShaderFormat format; | |
| int offset; | |
| int inputSlot; | |
| bool perInstance; | |
| }; | |
| static InputElement elements[] = { | |
| {"POSITION", SF_R32G32B32_FLOAT, 0, 0, false}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Voice::Play(bool loop) | |
| { | |
| if (!IsReady()) { | |
| return; | |
| } | |
| auto playback = [](SLAndroidSimpleBufferQueueItf q, void* context_) { | |
| double now = GetTime(); | |
| if (now - systemMisc.GetLastUpdateTime() >= 0.5) { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Voice::Play(bool loop) | |
| { | |
| if (!IsReady()) { | |
| return; | |
| } | |
| auto playback = [](SLAndroidSimpleBufferQueueItf q, void* context_) { | |
| WaveContext* context = (WaveContext*)context_; | |
| int totalSize; | |
| const void* buf = RiffFindChunk(context->fileImg, "data", &totalSize); | |
| SLCall(q, Enqueue, (char*)buf, totalSize); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct WaveFormatEx { | |
| uint16_t tag, channels; | |
| uint32_t samplesPerSecond, averageBytesPerSecond; | |
| uint16_t blockAlign, bitsPerSample; | |
| }; | |
| struct WaveContext | |
| { | |
| SLObjectItf playerObject; | |
| SLPlayItf playerPlay; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <class T> void SafeDestroy(T& p) | |
| { | |
| if (p) { | |
| (*p)->Destroy(p); | |
| p = nullptr; | |
| } | |
| } | |
| SLresult _slHandleError(const char* func, int line, const char* command, SLresult r) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SL { | |
| SLObjectItf engineObject = nullptr; | |
| SLEngineItf engineEngine = nullptr; | |
| SLObjectItf outputMixObject = nullptr; | |
| public: | |
| SL() { | |
| SLHandleError(slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr)); | |
| SLCall(engineObject, Realize, SL_BOOLEAN_FALSE); | |
| SLCall(engineObject, GetInterface, SL_IID_ENGINE, &engineEngine); | |
| SLInterfaceID ids = SL_IID_ENVIRONMENTALREVERB; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function require(m) | |
| package.loaded[m] = package.loaded[m] or dofile(m..".lua") or true | |
| return package.loaded[m] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print("calling with dofile", dofile("random.lua"), dofile("random.lua"), dofile("random.lua")) | |
| print("calling with require", require("random"), require("random"), require("random")) | |
| assert(require("random") == package.loaded["random"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function require(m) | |
| dofile(m..".lua") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| return "A message from callee!" |