From 9f1d6a36fc1fd480f27977f047d86a152109b786 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Sat, 8 Apr 2017 09:46:40 -0400 Subject: [PATCH] Load a test XM module, does not yet play. --- Cargo.toml | 3 ++- mandelwow.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 706d69e..0d51822 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,9 @@ authors = ["Bernie Innocenti "] [dependencies] glium = "*" glutin = "*" -genmesh = "0.4" +genmesh = "0.4.1" obj = { version = "0.5", features = ["usegenmesh"] } +libxm = "1.0.0" [[bin]] name = "mandelwow" diff --git a/mandelwow.rs b/mandelwow.rs index 3c4da07..f760a26 100644 --- a/mandelwow.rs +++ b/mandelwow.rs @@ -4,12 +4,17 @@ extern crate glium; extern crate glutin; +extern crate libxm; use glium::{DisplayBuild, Surface}; use glium::index::{IndexBuffer, PrimitiveType}; use glutin::ElementState::Pressed; use glutin::Event::KeyboardInput; use glutin::VirtualKeyCode; +use libxm::XMContext; +use std::fs::File; +use std::io::Read; + mod support; @@ -268,8 +273,16 @@ fn mandelwow(display: &glium::Display, mandel(&display, &mut frame, &program, &uniforms, bounds, z0); } } +fn play_xm(raw_xm: &[u8]) { + let freq = 48000u32; + let mut xm = XMContext::new(&raw_xm, freq).unwrap(); +} fn main() { + let mut xm = Vec::new(); + File::open("flora.xm").unwrap().read_to_end(&mut xm).unwrap(); + play_xm(&xm); + let display = glium::glutin::WindowBuilder::new() //.with_dimensions(1024, 768) .with_fullscreen(glutin::get_primary_monitor()) -- 2.25.1