aboutsummaryrefslogtreecommitdiffhomepage
path: root/applause.lua
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2023-09-05 03:41:01 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2023-09-05 23:39:23 +0300
commit8cdcf6f747cd85ebc1425acfd9d8a9ebfa84e752 (patch)
treee4c6307c3b93e9fb3160702dd3f83b739be974e8 /applause.lua
parent8ac5f63d63b298bb729dedde02e8c50d0efb17f4 (diff)
downloadapplause2-8cdcf6f747cd85ebc1425acfd9d8a9ebfa84e752.tar.gz
moved common definitions into applause.h
Diffstat (limited to 'applause.lua')
-rw-r--r--applause.lua25
1 files changed, 5 insertions, 20 deletions
diff --git a/applause.lua b/applause.lua
index 342264c..e80f6c0 100644
--- a/applause.lua
+++ b/applause.lua
@@ -24,6 +24,8 @@ function cdef_include(file)
hnd:close()
end
+cdef_include "applause.h"
+
--
-- Define C functions for benchmarking (POSIX libc)
--
@@ -47,6 +49,9 @@ typedef enum {
} clockid_t;
int clock_gettime(clockid_t clk_id, struct timespec *tp);
+
+// Useful in various situations
+void free(void *ptr);
]]
-- Measure time required to execute fnc()
@@ -73,26 +78,6 @@ function benchmark(fnc)
print("Elapsed CPU time: "..tonumber(t2_ms - t1_ms).."ms")
end
---
--- Define the Lua FFI part of Applause's C core.
--- These functions and types are defined in applause.c
--- FIXME: Could be read from a common file.
---
-cdef_safe[[
-enum applause_audio_state {
- APPLAUSE_AUDIO_OK = 0,
- APPLAUSE_AUDIO_INTERRUPTED,
- APPLAUSE_AUDIO_XRUN,
- APPLAUSE_AUDIO_INVALID_PORT
-};
-
-enum applause_audio_state applause_push_sample(int output_port_id,
- double sample_double);
-
-// Useful in various situations
-void free(void *ptr);
-]]
-
-- Sample rate
-- This is overwritten by the C core
samplerate = 44100