Initial commit.
This commit is contained in:
39
engine/ljud/bus.odin
Normal file
39
engine/ljud/bus.odin
Normal file
@@ -0,0 +1,39 @@
|
||||
package ljud
|
||||
|
||||
import "core:log"
|
||||
import "core:strings"
|
||||
|
||||
import ma "vendor:miniaudio"
|
||||
|
||||
Bus :: ma.sound_group
|
||||
|
||||
create_bus :: proc(engine: ^Engine) -> (^Bus, bool) {
|
||||
assert(engine != nil)
|
||||
|
||||
b := new(Bus)
|
||||
assert(b != nil)
|
||||
|
||||
result := ma.sound_group_init(
|
||||
pEngine = &engine.ma_engine,
|
||||
flags = {},
|
||||
pParentGroup = nil, // TODO: SS - Support parent busses.
|
||||
pGroup = b,
|
||||
)
|
||||
if result != .SUCCESS {
|
||||
free(b)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
ma.sound_group_set_spatialization_enabled(b, true) // TODO: SS - Needs to be configurable outside.
|
||||
ma.sound_group_set_min_distance(b, 1.0) // TODO: SS - Needs to be configurable outside.
|
||||
ma.sound_group_set_max_distance(b, 50) // TODO: SS - Needs to be configurable outside.
|
||||
|
||||
return b, true
|
||||
}
|
||||
|
||||
destroy_bus :: proc(engine: ^Engine, bus: ^Bus) {
|
||||
assert(engine != nil)
|
||||
assert(bus != nil)
|
||||
|
||||
ma.sound_group_uninit(bus)
|
||||
}
|
||||
Reference in New Issue
Block a user