start of sfx mark2
This commit is contained in:
parent
c97abb6460
commit
e214a141b7
|
@ -0,0 +1,228 @@
|
|||
--[[
|
||||
love-microphone
|
||||
QueueableSource.lua
|
||||
|
||||
Provides a QueueableSource object, pseudo-inheriting from Source.
|
||||
See http://love2d.org/wiki/Source for better documentation on
|
||||
most methods except queue and new.
|
||||
]]
|
||||
|
||||
local ffi = require("ffi")
|
||||
local al = require("openal")
|
||||
|
||||
local QueueableSource = {}
|
||||
local typecheck = {
|
||||
Object = true,
|
||||
QueueableSource = true
|
||||
}
|
||||
|
||||
--[[
|
||||
alFormat getALFormat(SoundData data)
|
||||
data: The SoundData to query.
|
||||
|
||||
Returns the correct alFormat enum value for the given SoundData.
|
||||
]]
|
||||
local function getALFormat(data)
|
||||
local stereo = data:getChannels() == 2
|
||||
local deep = data:getBitDepth() == 16
|
||||
|
||||
if (stereo) then
|
||||
if (deep) then
|
||||
return al.AL_FORMAT_STEREO16
|
||||
else
|
||||
return al.AL_FORMAT_STEREO8
|
||||
end
|
||||
end
|
||||
|
||||
if (deep) then
|
||||
return al.AL_FORMAT_MONO16
|
||||
else
|
||||
return al.AL_FORMAT_MONO8
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
QueueableSource QueueableSource:new(uint bufferCount=16)
|
||||
bufferCount: The number of buffers to use to hold queued sounds.
|
||||
|
||||
Creates a new QueueableSource object.
|
||||
]]
|
||||
function QueueableSource:new(bufferCount)
|
||||
if (bufferCount) then
|
||||
if (type(bufferCount) ~= "number" or bufferCount % 1 ~= 0 or bufferCount < 0) then
|
||||
return nil, "Invalid argument #1: bufferCount must be a positive integer if given."
|
||||
end
|
||||
else
|
||||
bufferCount = 16
|
||||
end
|
||||
|
||||
local new = {}
|
||||
|
||||
for key, value in pairs(self) do
|
||||
if (key ~= "new") then
|
||||
new[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
local pBuffers = ffi.new("ALuint[?]", bufferCount)
|
||||
al.alGenBuffers(bufferCount, pBuffers)
|
||||
|
||||
local freeBuffers = {}
|
||||
for i = 0, bufferCount - 1 do
|
||||
table.insert(freeBuffers, pBuffers[i])
|
||||
end
|
||||
|
||||
local pSource = ffi.new("ALuint[1]")
|
||||
al.alGenSources(1, pSource)
|
||||
al.alSourcei(pSource[0], al.AL_LOOPING, 0)
|
||||
|
||||
new._bufferCount = bufferCount
|
||||
new._pBuffers = pBuffers
|
||||
new._freeBuffers = freeBuffers
|
||||
new._source = pSource[0]
|
||||
new._pAvailable = ffi.new("ALint[1]")
|
||||
new._pBufferHolder = ffi.new("ALuint[16]")
|
||||
|
||||
local wrapper = newproxy(true)
|
||||
getmetatable(wrapper).__index = new
|
||||
getmetatable(wrapper).__gc = function(self)
|
||||
al.alSourceStop(new._source)
|
||||
al.alSourcei(new._source, al.AL_BUFFER, 0)
|
||||
al.alDeleteSources(1, pSource)
|
||||
al.alDeleteBuffers(bufferCount, pBuffers)
|
||||
end
|
||||
|
||||
return wrapper
|
||||
end
|
||||
|
||||
--[[
|
||||
string QueueableSource:type()
|
||||
|
||||
Returns the string name of the class, "QueueableSource".
|
||||
]]
|
||||
function QueueableSource:type()
|
||||
return "QueueableSource"
|
||||
end
|
||||
|
||||
--[[
|
||||
bool QueueableSource:typeOf(string type)
|
||||
type: The type to check against.
|
||||
|
||||
Returns whether the object matches the given type.
|
||||
]]
|
||||
function QueueableSource:typeOf(type)
|
||||
return typecheck[type]
|
||||
end
|
||||
|
||||
--[[
|
||||
void QueueableSource:queue(SoundData data) (Success)
|
||||
(void, string) QueueableSource:queue(SoundData data) (Failure)
|
||||
data: The SoundData to queue for playback.
|
||||
|
||||
Queues a new SoundData to play.
|
||||
|
||||
Will fail and return nil and an error message if no buffers were available.
|
||||
]]
|
||||
function QueueableSource:queue(data)
|
||||
self:step()
|
||||
|
||||
if (#self._freeBuffers == 0) then
|
||||
return nil, "No free buffers were available to playback the given audio."
|
||||
end
|
||||
|
||||
local top = table.remove(self._freeBuffers, 1)
|
||||
|
||||
al.alBufferData(top, getALFormat(data), data:getPointer(), data:getSize(), data:getSampleRate())
|
||||
al.alSourceQueueBuffers(self._source, 1, ffi.new("ALuint[1]", top))
|
||||
end
|
||||
|
||||
--[[
|
||||
void QueueableSource:step()
|
||||
|
||||
Opens up queues that have been used.
|
||||
Called automatically by queue.
|
||||
]]
|
||||
function QueueableSource:step()
|
||||
al.alGetSourcei(self._source, al.AL_BUFFERS_PROCESSED, self._pAvailable)
|
||||
|
||||
if (self._pAvailable[0] > 0) then
|
||||
al.alSourceUnqueueBuffers(self._source, self._pAvailable[0], self._pBufferHolder)
|
||||
|
||||
for i = 0, self._pAvailable[0] - 1 do
|
||||
table.insert(self._freeBuffers, self._pBufferHolder[i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
void QueueableSource:clear()
|
||||
|
||||
Stops playback and clears all queued data.
|
||||
]]
|
||||
function QueueableSource:clear()
|
||||
self:pause()
|
||||
|
||||
for i = 0, self._bufferCount - 1 do
|
||||
al.alSourceUnqueueBuffers(self._source, self._bufferCount, self._pBuffers)
|
||||
table.insert(self._freeBuffers, self._pBuffers[i])
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
uint QueueableSource:getFreeBufferCount()
|
||||
|
||||
Returns the number of free buffers for queueing sounds with this QueueableSource.
|
||||
]]
|
||||
function QueueableSource:getFreeBufferCount()
|
||||
return #self._freeBuffers
|
||||
end
|
||||
|
||||
--[[
|
||||
void QueueableSource:play()
|
||||
|
||||
Begins playing audio.
|
||||
]]
|
||||
function QueueableSource:play()
|
||||
if (not self:isPlaying()) then
|
||||
al.alSourcePlay(self._source)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
bool QueueableSource:isPlaying()
|
||||
|
||||
Returns whether the source is playing audio.
|
||||
]]
|
||||
function QueueableSource:isPlaying()
|
||||
local state = ffi.new("ALint[1]")
|
||||
|
||||
al.alGetSourcei(self._source, al.AL_SOURCE_STATE, state)
|
||||
|
||||
return (state[0] == al.AL_PLAYING)
|
||||
end
|
||||
|
||||
--[[
|
||||
void QueueableSource:pause()
|
||||
|
||||
Stops playing audio.
|
||||
]]
|
||||
function QueueableSource:pause()
|
||||
if (not self:isPaused()) then
|
||||
al.alSourcePause(self._source)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
void QueueableSource:isPaused()
|
||||
|
||||
Returns whether the source is paused.
|
||||
]]
|
||||
function QueueableSource:isPaused()
|
||||
local state = ffi.new("ALint[1]")
|
||||
|
||||
al.alGetSourcei(self._source, al.AL_SOURCE_STATE, state)
|
||||
|
||||
return (state[0] == al.AL_PAUSED)
|
||||
end
|
||||
|
||||
return QueueableSource
|
160
main.lua
160
main.lua
|
@ -113,6 +113,10 @@ local __pico_audio_channels = {
|
|||
}
|
||||
|
||||
local __pico_sfx = {}
|
||||
local __audio_channels
|
||||
local rate = 22050
|
||||
local channel = 1
|
||||
local bits = 8
|
||||
|
||||
local __pico_music = {}
|
||||
|
||||
|
@ -123,6 +127,8 @@ function get_bits(v,s,e)
|
|||
return shr(band(mask,v))
|
||||
end
|
||||
|
||||
local QueueableSource = require "QueueableSource"
|
||||
|
||||
function love.load(argv)
|
||||
love_args = argv
|
||||
if love.system.getOS() == "Android" then
|
||||
|
@ -133,17 +139,49 @@ function love.load(argv)
|
|||
end
|
||||
|
||||
osc = {}
|
||||
osc[0] = denver.get{waveform='triangle',frequency=66}
|
||||
osc[1] = denver.get{waveform='sawtooth',frequency=66} -- should be filtered
|
||||
osc[2] = denver.get{waveform='sawtooth',frequency=66}
|
||||
osc[3] = denver.get{waveform='square',frequency=66}
|
||||
osc[4] = denver.get{waveform='square',frequency=66,pwm=0.25} -- impulse
|
||||
osc[5] = denver.get{waveform='square',frequency=66} -- should be ?
|
||||
osc[6] = denver.get{waveform='brownnoise',frequency=66} -- noise
|
||||
osc[7] = denver.get{waveform='triangle',frequency=66} -- triangle with harmonics
|
||||
osc[0] = function(x)
|
||||
-- tri
|
||||
return (abs((x%2)-1)-0.5) * 0.5
|
||||
end
|
||||
osc[1] = function(x)
|
||||
-- uneven tri
|
||||
local t = x%1
|
||||
return (((t < 0.875) and (t * 16 / 7) or ((1-t)*16)) -1) * 0.5
|
||||
end
|
||||
osc[2] = function(x)
|
||||
-- saw
|
||||
return (x%1-0.5) * 0.333
|
||||
end
|
||||
osc[3] = function(x)
|
||||
-- sqr
|
||||
return (x%2 < 0.5 and 1 or -1) * 0.25
|
||||
end
|
||||
osc[4] = function(x)
|
||||
-- pulse
|
||||
return (x%2 < 0.25 and 1 or -1) * 0.25
|
||||
end
|
||||
osc[5] = function(x)
|
||||
-- tri/2
|
||||
return (abs((x%2)-1)-0.5 + (abs(((x*0.5)%2)-1)-0.5)/2) * 0.333
|
||||
end
|
||||
osc[6] = function(x)
|
||||
-- noise
|
||||
return (love.math.random()*2-1) * 0.666
|
||||
end
|
||||
osc[7] = function(x)
|
||||
-- detuned tri
|
||||
return (abs((x%2)-1)-0.5 + (abs(((x*0.97)%2)-1)-0.5)/2) * 0.333
|
||||
end
|
||||
|
||||
for i=0,7 do
|
||||
osc[i]:setLooping(true)
|
||||
__audio_channels = {
|
||||
[0]=QueueableSource:new(16),
|
||||
QueueableSource:new(16),
|
||||
QueueableSource:new(16),
|
||||
QueueableSource:new(16)
|
||||
}
|
||||
|
||||
for i=0,3 do
|
||||
__audio_channels[i]:play()
|
||||
end
|
||||
|
||||
love.graphics.clear()
|
||||
|
@ -664,55 +702,59 @@ function love.run()
|
|||
dt = dt + love.timer.getDelta()
|
||||
end
|
||||
|
||||
for i=0,3 do
|
||||
if __pico_audio_channels[i] ~= nil then
|
||||
local ch = __pico_audio_channels[i]
|
||||
local s = __pico_sfx[__pico_audio_channels[i].sfx]
|
||||
if s.speed <= 0 then s.speed = 1/30 end
|
||||
ch.offset = ch.offset + (dt*4) / s.speed
|
||||
if s.loop_end ~= 0 then
|
||||
if ch.offset >= s.loop_end then
|
||||
if ch.loop then
|
||||
ch.offset = s.loop_start + (ch.offset-s.loop_end)
|
||||
ch.last_step = s.loop_start-1
|
||||
else
|
||||
love.audio.stop(ch.current)
|
||||
ch.current = nil
|
||||
__pico_audio_channels[i] = nil
|
||||
end
|
||||
end
|
||||
elseif ch.offset >= 32 then
|
||||
if ch.current then
|
||||
love.audio.stop(ch.current)
|
||||
ch.current = nil
|
||||
end
|
||||
__pico_audio_channels[i] = nil
|
||||
end
|
||||
if __pico_audio_channels[i] then
|
||||
-- if we pass a step
|
||||
if flr(ch.offset) > ch.last_step then
|
||||
if ch.current then
|
||||
love.audio.stop(ch.current)
|
||||
ch.current = nil
|
||||
end
|
||||
local note,instr,vol,fx = unpack(s[flr(ch.offset)])
|
||||
if vol > 0 then
|
||||
local o = osc[instr]
|
||||
o:setPitch((note/12)+1)
|
||||
ch.current = o
|
||||
o:setLooping(true)
|
||||
o:setVolume((1/7)*vol)
|
||||
love.audio.play(o)
|
||||
end
|
||||
ch.last_step = flr(ch.offset)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Call update and draw
|
||||
local render = false
|
||||
while dt > 1/30 do
|
||||
for i=0,3 do
|
||||
local snd = love.sound.newSoundData(flr(rate*dt),rate,bits,channel)
|
||||
for tick=0,31 do
|
||||
if __pico_audio_channels[i] ~= nil then
|
||||
local ch = __pico_audio_channels[i]
|
||||
local s = __pico_sfx[__pico_audio_channels[i].sfx]
|
||||
if s.speed <= 0 then s.speed = 1/30 end
|
||||
ch.offset = ch.offset + (dt/32) / s.speed
|
||||
if s.loop_end ~= 0 then
|
||||
if ch.offset >= s.loop_end then
|
||||
if ch.loop then
|
||||
ch.offset = s.loop_start + (ch.offset-s.loop_end)
|
||||
ch.last_step = s.loop_start-1
|
||||
else
|
||||
ch.current = nil
|
||||
__pico_audio_channels[i] = nil
|
||||
end
|
||||
end
|
||||
elseif ch.offset >= 32 then
|
||||
if ch.current then
|
||||
ch.current = nil
|
||||
end
|
||||
__pico_audio_channels[i] = nil
|
||||
end
|
||||
if __pico_audio_channels[i] then
|
||||
-- get a sounddata of the right length
|
||||
local ch = __pico_audio_channels[i]
|
||||
local note,instr,vol,fx = unpack(s[flr(ch.offset)])
|
||||
local freq = (65.41*math.pow(2,flr(note/12)))
|
||||
local samples = flr(rate*dt)/32
|
||||
for smp=0,samples-1 do
|
||||
snd:setSample(smp,(osc[instr]((ch.offset*rate)+smp*(freq/rate))) * vol)
|
||||
end
|
||||
if not __audio_channels[i]:isPlaying() then
|
||||
__audio_channels[i]:play()
|
||||
end
|
||||
-- if we pass a step
|
||||
if flr(ch.offset) > ch.last_step then
|
||||
if ch.current then
|
||||
ch.current = nil
|
||||
end
|
||||
--local note,instr,vol,fx = unpack(s[flr(ch.offset)])
|
||||
ch.last_step = flr(ch.offset)
|
||||
end
|
||||
end
|
||||
end
|
||||
__audio_channels[i]:queue(snd)
|
||||
end
|
||||
end
|
||||
|
||||
if love.update then love.update(1/30) end -- will pass 0 if love.timer is disabled
|
||||
dt = dt - 1/30
|
||||
render = true
|
||||
|
@ -1103,6 +1145,9 @@ function line(x0,y0,x1,y1,col)
|
|||
fraction = fraction + dy
|
||||
--love.graphics.point(flr(x0),flr(y0))
|
||||
table.insert(points,{flr(x0),flr(y0)})
|
||||
if #points > 181 then
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
local fraction = dx - bit.rshift(dy, 1)
|
||||
|
@ -1115,6 +1160,9 @@ function line(x0,y0,x1,y1,col)
|
|||
fraction = fraction + dx
|
||||
--love.graphics.point(flr(x0),flr(y0))
|
||||
table.insert(points,{flr(x0),flr(y0)})
|
||||
if #points > 181 then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
lineMesh:setVertices(points)
|
||||
|
|
|
@ -0,0 +1,381 @@
|
|||
--[[
|
||||
love-micrphone
|
||||
openal.lua
|
||||
|
||||
LuaJIT FFI binding for OpenAL-soft
|
||||
]]
|
||||
|
||||
local ffi = require("ffi")
|
||||
-- Load OpenAL32.dll on Windows (from LOVE) or use ffi.C
|
||||
local openal = (ffi.os == "Windows") and ffi.load("openal32") or ffi.C
|
||||
|
||||
--alc.h
|
||||
ffi.cdef([[
|
||||
enum {
|
||||
ALC_INVALID = 0, //Deprecated
|
||||
|
||||
ALC_VERSION_0_1 = 1,
|
||||
|
||||
ALC_FALSE = 0,
|
||||
ALC_TRUE = 1,
|
||||
ALC_FREQUENCY = 0x1007,
|
||||
ALC_REFRESH = 0x1008,
|
||||
ALC_SYNC = 0x1009,
|
||||
|
||||
ALC_MONO_SOURCES = 0x1010,
|
||||
ALC_STEREO_SOURCES = 0x1011,
|
||||
|
||||
ALC_NO_ERROR = 0,
|
||||
ALC_INVALID_DEVICE = 0xA001,
|
||||
ALC_INVALID_CONTEXT = 0xA002,
|
||||
ALC_INVALID_ENUM = 0xA003,
|
||||
ALC_INVALID_VALUE = 0xA004,
|
||||
ALC_OUT_OF_MEMORY = 0xA005,
|
||||
|
||||
ALC_MAJOR_VERSION = 0x1000,
|
||||
ALC_MINOR_VERSION = 0x1001,
|
||||
|
||||
ALC_ATTRIBUTES_SIZE = 0x1002,
|
||||
ALC_ALL_ATTRIBUTES = 0x1003,
|
||||
|
||||
ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004,
|
||||
ALC_DEVICE_SPECIFIER = 0x1005,
|
||||
ALC_EXTENSIONS = 0x1006,
|
||||
|
||||
ALC_EXT_CAPTURE = 1,
|
||||
ALC_CAPTURE_DEVICE_SPECIFIER = 0x310,
|
||||
ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311,
|
||||
ALC_CAPTURE_SAMPLES = 0x312,
|
||||
|
||||
ALC_DEFAULT_ALL_DEVICES_SPECIFIER = 0x1012,
|
||||
ALC_ALL_DEVICES_SPECIFIER = 0x1013
|
||||
};
|
||||
|
||||
typedef struct ALCdevice_struct ALCdevice;
|
||||
typedef struct ALCcontext_struct ALCcontext;
|
||||
|
||||
typedef char ALCboolean;
|
||||
typedef char ALCchar;
|
||||
typedef signed char ALCbyte;
|
||||
typedef unsigned char ALCubyte;
|
||||
typedef short ALCshort;
|
||||
typedef unsigned short ALCushort;
|
||||
typedef int ALCint;
|
||||
typedef unsigned int ALCuint;
|
||||
typedef int ALCsizei;
|
||||
typedef int ALCenum;
|
||||
typedef float ALCfloat;
|
||||
typedef double ALCdouble;
|
||||
typedef void ALCvoid;
|
||||
|
||||
ALCcontext* alcCreateContext(ALCdevice *device, const ALCint* attrlist);
|
||||
ALCboolean alcMakeContextCurrent(ALCcontext *context);
|
||||
void alcProcessContext(ALCcontext *context);
|
||||
void alcSuspendContext(ALCcontext *context);
|
||||
void alcDestroyContext(ALCcontext *context);
|
||||
ALCcontext* alcGetCurrentContext(void);
|
||||
ALCdevice* alcGetContextsDevice(ALCcontext *context);
|
||||
|
||||
ALCdevice* alcOpenDevice(const ALCchar *devicename);
|
||||
ALCboolean alcCloseDevice(ALCdevice *device);
|
||||
|
||||
ALCenum alcGetError(ALCdevice *device);
|
||||
ALCboolean alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname);
|
||||
void* alcGetProcAddress(ALCdevice *device, const ALCchar *funcname);
|
||||
ALCenum alcGetEnumValue(ALCdevice *device, const ALCchar *enumname);
|
||||
|
||||
const ALCchar* alcGetString(ALCdevice *device, ALCenum param);
|
||||
void alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
|
||||
|
||||
ALCdevice* alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
|
||||
ALCboolean alcCaptureCloseDevice(ALCdevice *device);
|
||||
void alcCaptureStart(ALCdevice *device);
|
||||
void alcCaptureStop(ALCdevice *device);
|
||||
void alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
|
||||
typedef ALCcontext* (*LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist);
|
||||
typedef ALCboolean (*LPALCMAKECONTEXTCURRENT)(ALCcontext *context);
|
||||
typedef void (*LPALCPROCESSCONTEXT)(ALCcontext *context);
|
||||
typedef void (*LPALCSUSPENDCONTEXT)(ALCcontext *context);
|
||||
typedef void (*LPALCDESTROYCONTEXT)(ALCcontext *context);
|
||||
typedef ALCcontext* (*LPALCGETCURRENTCONTEXT)(void);
|
||||
typedef ALCdevice* (*LPALCGETCONTEXTSDEVICE)(ALCcontext *context);
|
||||
typedef ALCdevice* (*LPALCOPENDEVICE)(const ALCchar *devicename);
|
||||
typedef ALCboolean (*LPALCCLOSEDEVICE)(ALCdevice *device);
|
||||
typedef ALCenum (*LPALCGETERROR)(ALCdevice *device);
|
||||
typedef ALCboolean (*LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname);
|
||||
typedef void* (*LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname);
|
||||
typedef ALCenum (*LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname);
|
||||
typedef const ALCchar* (*LPALCGETSTRING)(ALCdevice *device, ALCenum param);
|
||||
typedef void (*LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values);
|
||||
typedef ALCdevice* (*LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize);
|
||||
typedef ALCboolean (*LPALCCAPTURECLOSEDEVICE)(ALCdevice *device);
|
||||
typedef void (*LPALCCAPTURESTART)(ALCdevice *device);
|
||||
typedef void (*LPALCCAPTURESTOP)(ALCdevice *device);
|
||||
typedef void (*LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
|
||||
]])
|
||||
|
||||
--al.h
|
||||
ffi.cdef([[
|
||||
enum {
|
||||
AL_NONE = 0,
|
||||
AL_FALSE = 0,
|
||||
AL_TRUE = 1,
|
||||
|
||||
AL_SOURCE_RELATIVE = 0x202,
|
||||
AL_CONE_INNER_ANGLE = 0x1001,
|
||||
AL_CONE_OUTER_ANGLE = 0x1002,
|
||||
AL_PITCH = 0x1003,
|
||||
AL_POSITION = 0x1004,
|
||||
AL_DIRECTION = 0x1005,
|
||||
AL_VELOCITY = 0x1006,
|
||||
AL_LOOPING = 0x1007,
|
||||
AL_BUFFER = 0x1009,
|
||||
AL_GAIN = 0x100A,
|
||||
AL_MIN_GAIN = 0x100D,
|
||||
AL_MAX_GAIN = 0x100E,
|
||||
AL_ORIENTATION = 0x100F,
|
||||
AL_SOURCE_STATE = 0x1010,
|
||||
|
||||
AL_INITIAL = 0x1011,
|
||||
AL_PLAYING = 0x1012,
|
||||
AL_PAUSED = 0x1013,
|
||||
AL_STOPPED = 0x1014,
|
||||
|
||||
AL_BUFFERS_QUEUED = 0x1015,
|
||||
AL_BUFFERS_PROCESSED = 0x1016,
|
||||
|
||||
AL_REFERENCE_DISTANCE = 0x1020,
|
||||
AL_ROLLOFF_FACTOR = 0x1021,
|
||||
AL_CONE_OUTER_GAIN = 0x1022,
|
||||
AL_MAX_DISTANCE = 0x1023,
|
||||
|
||||
AL_SEC_OFFSET = 0x1024,
|
||||
AL_SAMPLE_OFFSET = 0x1025,
|
||||
AL_BYTE_OFFSET = 0x1026,
|
||||
|
||||
AL_SOURCE_TYPE = 0x1027,
|
||||
|
||||
AL_STATIC = 0x1028,
|
||||
AL_STREAMING = 0x1029,
|
||||
AL_UNDETERMINED = 0x1030,
|
||||
|
||||
AL_FORMAT_MONO8 = 0x1100,
|
||||
AL_FORMAT_MONO16 = 0x1101,
|
||||
AL_FORMAT_STEREO8 = 0x1102,
|
||||
AL_FORMAT_STEREO16 = 0x1103,
|
||||
|
||||
AL_FREQUENCY = 0x2001,
|
||||
AL_BITS = 0x2002,
|
||||
AL_CHANNELS = 0x2003,
|
||||
AL_SIZE = 0x2004,
|
||||
|
||||
AL_UNUSED = 0x2010,
|
||||
AL_PENDING = 0x2011,
|
||||
AL_PROCESSED = 0x2012,
|
||||
|
||||
AL_NO_ERROR = 0,
|
||||
AL_INVALID_NAME = 0xA001,
|
||||
AL_INVALID_ENUM = 0xA002,
|
||||
AL_INVALID_VALUE = 0xA003,
|
||||
AL_INVALID_OPERATION = 0xA004,
|
||||
AL_OUT_OF_MEMORY = 0xA005,
|
||||
|
||||
AL_VENDOR = 0xB001,
|
||||
AL_VERSION = 0xB002,
|
||||
AL_RENDERER = 0xB003,
|
||||
AL_EXTENSIONS = 0xB004,
|
||||
|
||||
AL_DOPPLER_FACTOR = 0xC000,
|
||||
AL_DOPPLER_VELOCITY = 0xC001,
|
||||
AL_SPEED_OF_SOUND = 0xC003,
|
||||
AL_DISTANCE_MODEL = 0xD000,
|
||||
|
||||
AL_INVERSE_DISTANCE = 0xD001,
|
||||
AL_INVERSE_DISTANCE_CLAMPED = 0xD002,
|
||||
AL_LINEAR_DISTANCE = 0xD003,
|
||||
AL_LINEAR_DISTANCE_CLAMPED = 0xD004,
|
||||
AL_EXPONENT_DISTANCE = 0xD005,
|
||||
AL_EXPONENT_DISTANCE_CLAMPED = 0xD006
|
||||
};
|
||||
|
||||
typedef char ALboolean;
|
||||
typedef char ALchar;
|
||||
typedef signed char ALbyte;
|
||||
typedef unsigned char ALubyte;
|
||||
typedef short ALshort;
|
||||
typedef unsigned short ALushort;
|
||||
typedef int ALint;
|
||||
typedef unsigned int ALuint;
|
||||
typedef int ALsizei;
|
||||
typedef int ALenum;
|
||||
typedef float ALfloat;
|
||||
typedef double ALdouble;
|
||||
typedef void ALvoid;
|
||||
|
||||
void alDopplerFactor(ALfloat value);
|
||||
void alDopplerVelocity(ALfloat value);
|
||||
void alSpeedOfSound(ALfloat value);
|
||||
void alDistanceModel(ALenum distanceModel);
|
||||
|
||||
void alEnable(ALenum capability);
|
||||
void alDisable(ALenum capability);
|
||||
ALboolean alIsEnabled(ALenum capability);
|
||||
|
||||
const ALchar* alGetString(ALenum param);
|
||||
void alGetBooleanv(ALenum param, ALboolean *values);
|
||||
void alGetIntegerv(ALenum param, ALint *values);
|
||||
void alGetFloatv(ALenum param, ALfloat *values);
|
||||
void alGetDoublev(ALenum param, ALdouble *values);
|
||||
ALboolean alGetBoolean(ALenum param);
|
||||
ALint alGetInteger(ALenum param);
|
||||
ALfloat alGetFloat(ALenum param);
|
||||
ALdouble alGetDouble(ALenum param);
|
||||
|
||||
ALenum alGetError(void);
|
||||
|
||||
ALboolean alIsExtensionPresent(const ALchar *extname);
|
||||
void* alGetProcAddress(const ALchar *fname);
|
||||
ALenum alGetEnumValue(const ALchar *ename);
|
||||
|
||||
void alListenerf(ALenum param, ALfloat value);
|
||||
void alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
void alListenerfv(ALenum param, const ALfloat *values);
|
||||
void alListeneri(ALenum param, ALint value);
|
||||
void alListener3i(ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
void alListeneriv(ALenum param, const ALint *values);
|
||||
|
||||
void alGetListenerf(ALenum param, ALfloat *value);
|
||||
void alGetListener3f(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
void alGetListenerfv(ALenum param, ALfloat *values);
|
||||
void alGetListeneri(ALenum param, ALint *value);
|
||||
void alGetListener3i(ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
void alGetListeneriv(ALenum param, ALint *values);
|
||||
|
||||
void alGenSources(ALsizei n, ALuint *sources);
|
||||
void alDeleteSources(ALsizei n, const ALuint *sources);
|
||||
ALboolean alIsSource(ALuint source);
|
||||
|
||||
void alSourcef(ALuint source, ALenum param, ALfloat value);
|
||||
void alSource3f(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
void alSourcefv(ALuint source, ALenum param, const ALfloat *values);
|
||||
void alSourcei(ALuint source, ALenum param, ALint value);
|
||||
void alSource3i(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
void alSourceiv(ALuint source, ALenum param, const ALint *values);
|
||||
|
||||
void alGetSourcef(ALuint source, ALenum param, ALfloat *value);
|
||||
void alGetSource3f(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
void alGetSourcefv(ALuint source, ALenum param, ALfloat *values);
|
||||
void alGetSourcei(ALuint source, ALenum param, ALint *value);
|
||||
void alGetSource3i(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
void alGetSourceiv(ALuint source, ALenum param, ALint *values);
|
||||
|
||||
void alSourcePlayv(ALsizei n, const ALuint *sources);
|
||||
void alSourceStopv(ALsizei n, const ALuint *sources);
|
||||
void alSourceRewindv(ALsizei n, const ALuint *sources);
|
||||
void alSourcePausev(ALsizei n, const ALuint *sources);
|
||||
|
||||
void alSourcePlay(ALuint source);
|
||||
void alSourceStop(ALuint source);
|
||||
void alSourceRewind(ALuint source);
|
||||
void alSourcePause(ALuint source);
|
||||
|
||||
void alSourceQueueBuffers(ALuint source, ALsizei nb, const ALuint *buffers);
|
||||
void alSourceUnqueueBuffers(ALuint source, ALsizei nb, ALuint *buffers);
|
||||
|
||||
void alGenBuffers(ALsizei n, ALuint *buffers);
|
||||
void alDeleteBuffers(ALsizei n, const ALuint *buffers);
|
||||
ALboolean alIsBuffer(ALuint buffer);
|
||||
|
||||
void alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
|
||||
|
||||
void alBufferf(ALuint buffer, ALenum param, ALfloat value);
|
||||
void alBuffer3f(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
void alBufferfv(ALuint buffer, ALenum param, const ALfloat *values);
|
||||
void alBufferi(ALuint buffer, ALenum param, ALint value);
|
||||
void alBuffer3i(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
void alBufferiv(ALuint buffer, ALenum param, const ALint *values);
|
||||
|
||||
void alGetBufferf(ALuint buffer, ALenum param, ALfloat *value);
|
||||
void alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
void alGetBufferfv(ALuint buffer, ALenum param, ALfloat *values);
|
||||
void alGetBufferi(ALuint buffer, ALenum param, ALint *value);
|
||||
void alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
void alGetBufferiv(ALuint buffer, ALenum param, ALint *values);
|
||||
|
||||
typedef void (*LPALENABLE)(ALenum capability);
|
||||
typedef void (*LPALDISABLE)(ALenum capability);
|
||||
typedef ALboolean (*LPALISENABLED)(ALenum capability);
|
||||
typedef const ALchar* (*LPALGETSTRING)(ALenum param);
|
||||
typedef void (*LPALGETBOOLEANV)(ALenum param, ALboolean *values);
|
||||
typedef void (*LPALGETINTEGERV)(ALenum param, ALint *values);
|
||||
typedef void (*LPALGETFLOATV)(ALenum param, ALfloat *values);
|
||||
typedef void (*LPALGETDOUBLEV)(ALenum param, ALdouble *values);
|
||||
typedef ALboolean (*LPALGETBOOLEAN)(ALenum param);
|
||||
typedef ALint (*LPALGETINTEGER)(ALenum param);
|
||||
typedef ALfloat (*LPALGETFLOAT)(ALenum param);
|
||||
typedef ALdouble (*LPALGETDOUBLE)(ALenum param);
|
||||
typedef ALenum (*LPALGETERROR)(void);
|
||||
typedef ALboolean (*LPALISEXTENSIONPRESENT)(const ALchar *extname);
|
||||
typedef void* (*LPALGETPROCADDRESS)(const ALchar *fname);
|
||||
typedef ALenum (*LPALGETENUMVALUE)(const ALchar *ename);
|
||||
typedef void (*LPALLISTENERF)(ALenum param, ALfloat value);
|
||||
typedef void (*LPALLISTENER3F)(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (*LPALLISTENERFV)(ALenum param, const ALfloat *values);
|
||||
typedef void (*LPALLISTENERI)(ALenum param, ALint value);
|
||||
typedef void (*LPALLISTENER3I)(ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (*LPALLISTENERIV)(ALenum param, const ALint *values);
|
||||
typedef void (*LPALGETLISTENERF)(ALenum param, ALfloat *value);
|
||||
typedef void (*LPALGETLISTENER3F)(ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (*LPALGETLISTENERFV)(ALenum param, ALfloat *values);
|
||||
typedef void (*LPALGETLISTENERI)(ALenum param, ALint *value);
|
||||
typedef void (*LPALGETLISTENER3I)(ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (*LPALGETLISTENERIV)(ALenum param, ALint *values);
|
||||
typedef void (*LPALGENSOURCES)(ALsizei n, ALuint *sources);
|
||||
typedef void (*LPALDELETESOURCES)(ALsizei n, const ALuint *sources);
|
||||
typedef ALboolean (*LPALISSOURCE)(ALuint source);
|
||||
typedef void (*LPALSOURCEF)(ALuint source, ALenum param, ALfloat value);
|
||||
typedef void (*LPALSOURCE3F)(ALuint source, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (*LPALSOURCEFV)(ALuint source, ALenum param, const ALfloat *values);
|
||||
typedef void (*LPALSOURCEI)(ALuint source, ALenum param, ALint value);
|
||||
typedef void (*LPALSOURCE3I)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (*LPALSOURCEIV)(ALuint source, ALenum param, const ALint *values);
|
||||
typedef void (*LPALGETSOURCEF)(ALuint source, ALenum param, ALfloat *value);
|
||||
typedef void (*LPALGETSOURCE3F)(ALuint source, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (*LPALGETSOURCEFV)(ALuint source, ALenum param, ALfloat *values);
|
||||
typedef void (*LPALGETSOURCEI)(ALuint source, ALenum param, ALint *value);
|
||||
typedef void (*LPALGETSOURCE3I)(ALuint source, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (*LPALGETSOURCEIV)(ALuint source, ALenum param, ALint *values);
|
||||
typedef void (*LPALSOURCEPLAYV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (*LPALSOURCESTOPV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (*LPALSOURCEREWINDV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (*LPALSOURCEPAUSEV)(ALsizei n, const ALuint *sources);
|
||||
typedef void (*LPALSOURCEPLAY)(ALuint source);
|
||||
typedef void (*LPALSOURCESTOP)(ALuint source);
|
||||
typedef void (*LPALSOURCEREWIND)(ALuint source);
|
||||
typedef void (*LPALSOURCEPAUSE)(ALuint source);
|
||||
typedef void (*LPALSOURCEQUEUEBUFFERS)(ALuint source, ALsizei nb, const ALuint *buffers);
|
||||
typedef void (*LPALSOURCEUNQUEUEBUFFERS)(ALuint source, ALsizei nb, ALuint *buffers);
|
||||
typedef void (*LPALGENBUFFERS)(ALsizei n, ALuint *buffers);
|
||||
typedef void (*LPALDELETEBUFFERS)(ALsizei n, const ALuint *buffers);
|
||||
typedef ALboolean (*LPALISBUFFER)(ALuint buffer);
|
||||
typedef void (*LPALBUFFERDATA)(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
|
||||
typedef void (*LPALBUFFERF)(ALuint buffer, ALenum param, ALfloat value);
|
||||
typedef void (*LPALBUFFER3F)(ALuint buffer, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3);
|
||||
typedef void (*LPALBUFFERFV)(ALuint buffer, ALenum param, const ALfloat *values);
|
||||
typedef void (*LPALBUFFERI)(ALuint buffer, ALenum param, ALint value);
|
||||
typedef void (*LPALBUFFER3I)(ALuint buffer, ALenum param, ALint value1, ALint value2, ALint value3);
|
||||
typedef void (*LPALBUFFERIV)(ALuint buffer, ALenum param, const ALint *values);
|
||||
typedef void (*LPALGETBUFFERF)(ALuint buffer, ALenum param, ALfloat *value);
|
||||
typedef void (*LPALGETBUFFER3F)(ALuint buffer, ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3);
|
||||
typedef void (*LPALGETBUFFERFV)(ALuint buffer, ALenum param, ALfloat *values);
|
||||
typedef void (*LPALGETBUFFERI)(ALuint buffer, ALenum param, ALint *value);
|
||||
typedef void (*LPALGETBUFFER3I)(ALuint buffer, ALenum param, ALint *value1, ALint *value2, ALint *value3);
|
||||
typedef void (*LPALGETBUFFERIV)(ALuint buffer, ALenum param, ALint *values);
|
||||
typedef void (*LPALDOPPLERFACTOR)(ALfloat value);
|
||||
typedef void (*LPALDOPPLERVELOCITY)(ALfloat value);
|
||||
typedef void (*LPALSPEEDOFSOUND)(ALfloat value);
|
||||
typedef void (*LPALDISTANCEMODEL)(ALenum distanceModel);
|
||||
]])
|
||||
|
||||
return openal
|
Loading…
Reference in New Issue