Renamed 'ljud' to 'miniaudio' to better represent what engine it is.
This commit is contained in:
@@ -4,7 +4,7 @@ import os "core:os/os2"
|
||||
import "core:container/queue"
|
||||
import "core:log"
|
||||
|
||||
import "ljud"
|
||||
import "miniaudio"
|
||||
|
||||
Sound :: struct {
|
||||
path: string, // Where I was loaded from.
|
||||
@@ -17,6 +17,7 @@ Sound_Instance :: struct {
|
||||
backend: Sound_Instance_Backend, // Backend-representation.
|
||||
|
||||
spatialized: bool,
|
||||
loop: bool,
|
||||
volume: f32, // 0..1
|
||||
position: [3]f32,
|
||||
min_distance, max_distance: f32,
|
||||
@@ -48,8 +49,8 @@ load_sound_from_path :: proc(engine: ^Engine, path: string) -> (Sound, bool) {
|
||||
return {}, false
|
||||
}
|
||||
|
||||
when AUDIO_ENGINE_LJUD {
|
||||
backend, ok := ljud.load_sound_from_data(&engine.backend, data, ext)
|
||||
when AUDIO_ENGINE_MINIAUDIO {
|
||||
backend, ok := miniaudio.load_sound_from_data(&engine.backend, data, ext)
|
||||
if !ok {
|
||||
return {}, false
|
||||
}
|
||||
@@ -80,8 +81,8 @@ unload_sound :: proc(engine: ^Engine, sound: ^Sound) {
|
||||
assert(sound != nil)
|
||||
assert(sound.data != nil)
|
||||
|
||||
when AUDIO_ENGINE_LJUD {
|
||||
ljud.unload_sound(&engine.backend, sound.backend)
|
||||
when AUDIO_ENGINE_MINIAUDIO {
|
||||
miniaudio.unload_sound(&engine.backend, sound.backend)
|
||||
}
|
||||
else when AUDIO_ENGINE_FMOD {
|
||||
|
||||
@@ -116,8 +117,8 @@ create_sound_instance :: proc(engine: ^Engine, sound: ^Sound, bus: ^Bus) -> (^So
|
||||
sound_instance.backend = {}
|
||||
|
||||
instance_ok: bool
|
||||
when AUDIO_ENGINE_LJUD {
|
||||
instance_ok = ljud.init_sound_instance(&engine.backend, bus != nil ? bus.backend : nil, sound.backend, &sound_instance.backend)
|
||||
when AUDIO_ENGINE_MINIAUDIO {
|
||||
instance_ok = miniaudio.init_sound_instance(&engine.backend, bus != nil ? bus.backend : nil, sound.backend, &sound_instance.backend)
|
||||
}
|
||||
else when AUDIO_ENGINE_FMOD {
|
||||
|
||||
@@ -138,18 +139,17 @@ play_sound_instance :: proc(engine: ^Engine, sound_instance: ^Sound_Instance) ->
|
||||
assert(engine != nil)
|
||||
assert(sound_instance != nil)
|
||||
|
||||
when AUDIO_ENGINE_LJUD {
|
||||
spec := ljud.Play_Sound_Instance_Spec {
|
||||
spatialized = sound_instance.spatialized,
|
||||
volume = sound_instance.volume,
|
||||
|
||||
position = sound_instance.position,
|
||||
distance = {
|
||||
min = sound_instance.min_distance,
|
||||
max = sound_instance.max_distance,
|
||||
},
|
||||
}
|
||||
return ljud.play_sound_instance(&engine.backend, &sound_instance.backend, spec)
|
||||
when AUDIO_ENGINE_MINIAUDIO {
|
||||
return miniaudio.play_sound_instance(
|
||||
&engine.backend,
|
||||
&sound_instance.backend,
|
||||
sound_instance.spatialized,
|
||||
sound_instance.loop,
|
||||
sound_instance.volume,
|
||||
sound_instance.position,
|
||||
sound_instance.min_distance,
|
||||
sound_instance.max_distance,
|
||||
)
|
||||
}
|
||||
else when AUDIO_ENGINE_FMOD {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user