public static void Init() { Sounds = new List <Sound>(); Howl.Load(); // Register callbacks Howl.OnPlay += e => { //Sounds.ForEach(a => { // if (e.SoundId == a.SoundId) a.IsPlaying = true; //}); }; Howl.OnEnd += e => { Sounds.Where(a => a.SoundId == e.SoundId).ToList().ForEach(a => { a.IsPlaying = false; }); SoundStoppedEventHandler handler = OnEnd; if (handler != null) { handler(e); } }; PlaySound(SoundManagerSounds.empty); }
static void Main(string[] args) { Console.WriteLine("Crash Team Racing HOWL Extractor by DCxDemo*.\r\n"); if (args.Length == 1) { string fn = args[0]; if (!File.Exists(fn)) { Console.WriteLine("{0} doesn't exist.", fn); return; } using (BinaryReaderEx br = new BinaryReaderEx(File.OpenRead(fn))) { Howl hwl = Howl.FromReader(br); hwl.DetectHowl(fn); Console.Write(hwl.ToString()); hwl.ExportCSEQ(br); hwl.ExportAllSamples(); Console.WriteLine("Done!"); return; } } else { Console.WriteLine("Usage:\r\n\thowl.exe <path to KART.HWL>\r\n\r\nPress any key to quit..."); } }
internal static bool UI() { BeginHorizontal(); Section(S.SymsetConfig, bottom: 0); FlexibleSpace(); if (Button(S.Btn_ApplyNotation)) { Howl.ReApply(); } EndHorizontal(); if (Config.ι.showTips) { Label(S.SymsetNote); } Label(S.NotWYSIWYG, miniLabel); Ruler(); scrollPos = BeginScrollView(scrollPos); // ImportConfig.Read(); bool dirty = false; foreach (var k in Map.@default) { ItemUI(k as Rep, ref dirty); } if (dirty) { ImportConfig.Write(); } // EndScrollView(); return(true); }
[Test] public void HandleConflicts() { var π = "Assets/Howl/Tests/Data"; var conflicts = Howl.ImportDir(π, "*.scs", dry: true); o(conflicts.Count, Config.ι.ignoreConflicts ? 0 : 1); }
static void Main(string[] args) { Console.WriteLine( "{0}\r\n{1}\r\n\r\n{2}\r\n", $"CTR-Tools: howl - {Meta.GetSignature()}", "Extracts samples and music sequences from HOWL and BNK", Meta.GetVersion()); if (args.Length == 0) { Console.WriteLine("Usage:\r\n\tExtract HWL:\thowl.exe C:\\example\\KART.HWL\r\n\tExtract BNK:\thowl.exe C:\\example\\01_canyon.bnk"); return; } string filename = args[0]; if (!File.Exists(filename)) { Console.WriteLine($"{filename} doesn't exist."); return; } string basepath = Path.GetDirectoryName(filename); string name = Path.GetFileNameWithoutExtension(filename); string ext = Path.GetExtension(filename).ToLower(); string path = Path.Combine(basepath, Path.GetFileNameWithoutExtension(filename)); switch (ext) { case ".hwl": using (BinaryReaderEx br = new BinaryReaderEx(File.OpenRead(filename))) { Howl hwl = Howl.FromReader(br); Console.Write(hwl.ToString()); hwl.ExportCSEQ(path, br); hwl.ExportAllSamples(path); Console.WriteLine("Done!"); } break; case ".bnk": Bank.ReadNames(); Bank bnk = Bank.FromFile(filename); bnk.ExportAll(0, Path.Combine(basepath, name)); break; case ".xnf": XaInfo xnf = XaInfo.FromFile(filename); Console.WriteLine(xnf.ToString()); break; default: Console.WriteLine("Unsupported file."); break; } }
public MainForm() { InitializeComponent(); this.DoubleBuffered = true; LoadMeta(); Howl.ReadSampleNames(Meta.BasePath + "CTRFramework.Data\\samplenames.txt"); }
public static async void PlaySound(SoundManagerSounds sound, bool oneatatime = false, bool excludefrommute = false) { if (MuteAllSounds && !excludefrommute) { return; } if (oneatatime) { if (Sounds.Any(a => a.SoundName == sound && a.IsPlaying)) { return; } } var options = new HowlOptions { Sources = new[] { "/Assets/sounds/" + Enum.GetName(typeof(SoundManagerSounds), sound) + ".mp3" }, Formats = new[] { "mp3" } }; var soundid = await Howl.Play(options); if (!Sounds.Any(a => a.SoundName == sound)) { Sounds.Add(new Sound() { SoundId = soundid, SoundName = sound, IsPlaying = true }); } else { Sounds.FirstOrDefault(a => a.SoundName == sound).SoundId = soundid; Sounds.FirstOrDefault(a => a.SoundName == sound).IsPlaying = true; } }
/// <summary> /// Inits a new Sprite object. /// </summary> /// <param name="rootEl">Root HTML element where sprites will be rendered.</param> /// <param name="options">Settings to pass into and setup the sound and visuals.</param> public Sprite(HTMLDivElement rootEl, SpriteOptions options) { // Setup the options to define this sprite display. _options = options; Render(rootEl); // Create our audio sprite definition. _sound = new Howl(new IHowlProperties { src = options.Src, sprite = options.Sprite }); // Setup a resize event and fire it to setup our sprite overlays. window.addEventListener("resize", e => { Resize(); }, false); Resize(); // Begin the progress step tick. requestAnimationFrame(Step); }
static void Main(string[] args) { Console.WriteLine("Crash Team Racing HOWL Extractor by DCxDemo*.\r\n"); if (args.Length == 1) { string fn = args[0]; if (File.Exists(fn)) { byte[] data = File.ReadAllBytes(fn); MemoryStream ms = new MemoryStream(data); BinaryReaderEx br = new BinaryReaderEx(ms); Howl hwl = new Howl(fn); hwl.Read(br); Console.Write(hwl.ToString()); hwl.ExportCSEQ(br); hwl.ExportAllSamples(); Console.WriteLine("Done!"); } else { Console.WriteLine("{0} doesn't exist.", fn); } } else { Console.WriteLine("Usage:\r\n\thowl.exe <path to KART.HWL>\r\n\r\nPress any key to quit..."); } //Console.ReadKey(); }
private void LoadHowl(string filename) { howl = Howl.FromFile(filename); label1.Text = $"Howl loaded from {filename}."; }
public static void StopAllSounds() { Howl.Stop(); Sounds.ForEach(a => Howl.Pause(a.SoundId)); }
private void LoadLevelFromBig(int absId, int levelId = 0, int mode = 0, int files = 2) { if (big == null) { if (File.Exists("bigfile.big")) { big = new BigFileReader(File.OpenRead("bigfile.big")); } else { return; } } if (levelId == -1 && files == 3) { string[] levels = new string[5]; for (int i = 0; i < 5; i++) { big.FileCursor = 200 + i * 3; Directory.CreateDirectory(Path.Combine(Meta.BasePath, Directory.GetParent(big.GetFilename()).FullName)); File.WriteAllBytes(Path.Combine(Meta.BasePath, big.GetFilename()), big.ReadFile()); big.NextFile(); levels[i] = Path.Combine(Meta.BasePath, big.GetFilename()); File.WriteAllBytes(levels[i], big.ReadFile()); } LoadStuff(levels); } else { big.FileCursor = (files == 3 ? 200 + levelId * 3 : levelId * 8) + mode * files; Directory.CreateDirectory(Path.Combine(Meta.BasePath, Directory.GetParent(big.GetFilename()).FullName)); File.WriteAllBytes(Path.Combine(Meta.BasePath, big.GetFilename()), big.ReadFile()); big.NextFile(); File.WriteAllBytes(Path.Combine(Meta.BasePath, big.GetFilename()), big.ReadFile()); LoadStuff(new string[] { Path.Combine(Meta.BasePath, big.GetFilename()) }); } if (howl == null) { if (File.Exists("kart.hwl")) { howl = Howl.FromFile("kart.hwl"); } else { return; } } //howl.ExportAllSamples(); }
public static void Main() { // Set up the canvas, or die tryin'! try { Canvas.Create(true); } catch (KissException) { Window.Alert("Oh crap! Your browser doesn't support the HTML5 stuff we need to make this game work. Please enable JavaScript or switch to a different browser (like Chrome or Firefox)."); return; } // Load an image Canvas.LoadGraphic("images/ball.png"); // Create the game objects var player = new GameObject(); player.X = 32; player.Y = 320; player.Width = 8; player.Height = 64; player.Speed = 4; var test = new GameObject(); test.X = 32; test.Y = 0; test.Width = 8; test.Height = 64; test.Speed = 4; // Our animation loop does look kinda Pong-like Canvas.StartAnimationLoop(() => { // Tested the collision method if (player.Collision(test)) { player.Y = 320; } // Update the player's position if (direction == 38 && player.Y >= 4) { player.Y -= player.Speed; } else if (direction == 40 && player.Y <= Window.InnerHeight - 64) { player.Y += player.Speed; } Canvas.DrawGraphic("images/ball.png", 64, 32, 16, 16); Canvas.FillStyle = "red"; Canvas.FillRect(player.X, player.Y, player.Width, player.Height); Canvas.FillStyle = "blue"; Canvas.FillRect(test.X, test.Y, test.Width, test.Height); }); // Test adding an event - gettin fancy this time with keyboard events // NOTE: I had to change the event listener from the canvas to the Window element. // Doing it this way might also help with other events, like onresize etc. too // so down the road, we might want to have this just be fullscreen all the time Canvas.AddEvent("keydown", (e) => { var E = (KeyboardEvent)e; if (E.Which >= 37 && E.Which <= 40) { direction = E.Which; } else { Canvas.Pause(); } }); Canvas.AddEvent("keyup", (e) => { direction = 0; }); // Test Howler (worked) // NOTE: I still have to build out the rest of the definition file, and also the spatial plug-in. Howl sound = new Howl(new Options() { Src = new string[] { "test.wav" }, Loop = true, OnLoad = () => { Bridge.Script.Call("console.log", "Sound Loaded"); } }); // sound.Play(); }