mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add U16view, I16view, U32view, I32view classes
This commit is contained in:
parent
86a4060a68
commit
aa54e900d9
4 changed files with 69 additions and 9 deletions
|
|
@ -124,10 +124,11 @@ function on_hud_open()
|
|||
streamid = audio.play_stream_2d("test-stream", 2.0, 1.0, "ui")
|
||||
|
||||
|
||||
s = audio.PCMStream(44100, 1, 8)
|
||||
local buffer = Bytearray(44100)
|
||||
for i=1, #buffer do
|
||||
buffer[i] = math.random(1, 8)
|
||||
s = audio.PCMStream(44100, 1, 16)
|
||||
local buffer = Bytearray(44100 * 4)
|
||||
local view = U16view(buffer)
|
||||
for i=1, view.size do
|
||||
view[i] = 16000 + math.sin(i / 200.0 * (1 + i * 0.0001)) * 2000
|
||||
end
|
||||
s:feed(buffer)
|
||||
s:create_sound("test-sound")
|
||||
|
|
|
|||
|
|
@ -269,6 +269,10 @@ require "core:internal/extensions/string"
|
|||
local bytearray = require "core:internal/bytearray"
|
||||
Bytearray = bytearray.FFIBytearray
|
||||
Bytearray_as_string = bytearray.FFIBytearray_as_string
|
||||
U16view = bytearray.FFIU16view
|
||||
I16view = bytearray.FFII16view
|
||||
U32view = bytearray.FFIU32view
|
||||
I32view = bytearray.FFII32view
|
||||
Bytearray_construct = function(...) return Bytearray(...) end
|
||||
|
||||
bit.compile = require "core:bitwise/compiler"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue