-
-
Save GitGhillie/b8b56c077e73e77ae16a3b81619c8c33 to your computer and use it in GitHub Desktop.
Steam Audio reflection crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn set_listener(&mut self, listener: Orientation) { | |
self.shared_inputs.get_mut().listener = listener.into(); | |
let shared_inputs = self.shared_inputs.get_mut(); | |
shared_inputs.numRays = 128; | |
shared_inputs.numBounces = 8; | |
shared_inputs.duration = 2.0; | |
shared_inputs.order = 1; | |
shared_inputs.irradianceMinDistance = 1.0; | |
unsafe { | |
ffi::iplSimulatorSetSharedInputs( | |
self.inner, | |
ffi::IPLSimulationFlags_IPL_SIMULATIONFLAGS_REFLECTIONS, | |
self.shared_inputs.as_ptr(), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sampling_rate = 44100; | |
let frame_size = 1024; | |
let context = Context::new().unwrap(); | |
let scene = context.create_scene().unwrap(); | |
// Create some audio geometry | |
let vertices: [[f32; 3]; 4] = [ | |
[-0.5, -0.5, 0.0], | |
[0.5, -0.5, 0.0], | |
[0.5, 0.5, 0.0], | |
[-0.5, 0.5, 0.0], | |
]; | |
let triangles: [[u32; 3]; 2] = [[0, 1, 2], [0, 2, 3]]; | |
let material = steamaudio::scene::Material { | |
absorption: [0.1, 0.1, 0.1], | |
scattering: 0.05, | |
transmission: [0.60, 0.05, 0.05], | |
}; | |
let materials = [material]; | |
let material_indices: [u32; 2] = [0, 0]; | |
// Add mesh to the scene | |
let mut static_mesh = scene | |
.create_static_mesh( | |
triangles.as_slice(), | |
vertices.as_slice(), | |
material_indices.as_slice(), | |
materials.as_slice(), | |
) | |
.unwrap(); | |
static_mesh.set_visible(true); | |
scene.commit(); | |
let mut simulator = context.create_simulator(sampling_rate, frame_size).unwrap(); | |
simulator.set_scene(&scene); | |
simulator.set_listener(Orientation::default()); | |
// Create source and set it to active | |
let mut simulator_source = simulator.create_source().unwrap(); | |
simulator_source.set_reflections(); | |
simulator_source.set_active(true); | |
// Commit and run simulation | |
simulator.commit(); | |
simulator.run_reflections(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut simulation_settings = ffi::IPLSimulationSettings { | |
flags: ffi::IPLSimulationFlags_IPL_SIMULATIONFLAGS_REFLECTIONS, | |
sceneType: ffi::IPLSceneType_IPL_SCENETYPE_DEFAULT, | |
reflectionType: ffi::IPLReflectionEffectType_IPL_REFLECTIONEFFECTTYPE_CONVOLUTION, | |
maxNumOcclusionSamples: 8, | |
maxNumRays: 128, | |
numDiffuseSamples: 32, | |
maxDuration: 2.0, | |
maxOrder: 1, | |
maxNumSources: 8, | |
numThreads: 2, | |
rayBatchSize: 0, | |
numVisSamples: 0, | |
samplingRate: sampling_rate as i32, | |
frameSize: frame_size as i32, | |
openCLDevice: std::ptr::null_mut(), | |
radeonRaysDevice: std::ptr::null_mut(), | |
tanDevice: std::ptr::null_mut(), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn set_reflections(&mut self) { | |
self.inputs.get_mut().flags |= ffi::IPLSimulationFlags_IPL_SIMULATIONFLAGS_REFLECTIONS; | |
unsafe { | |
ffi::iplSourceSetInputs( | |
self.inner, | |
ffi::IPLSimulationFlags_IPL_SIMULATIONFLAGS_REFLECTIONS, | |
self.inputs.as_ptr(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment