You are browsing as a guest. Sign up (or log in) to start making projects!

infinite_silly

@infinite_silly

Joined June 3rd, 2026

  • 71Devlogs
  • 3Projects
  • 4Ships
  • 48Votes
I'm just a silly human who likes Rust :3. Also a recovering Python user and Zig learner. I also don't know how to Δ my pfp. My best projects are a CLI tool I built to assist in the renaming of filenames, Leading Zeros Utility, and a GameBoy emulator, Riggurly, both built in Rust :3. Also, mad respect to Lua devs because we need somebody to write our Neovim plugins
Ship Pending review

Hello Everyone!

Riggurly is a small terminal-based Game Boy emulator and emulator core.
Riggurly CLI renders your games straight to your Terminal window for
a good time without leaving the comfort of your favorite terminal.
Since the Game Boy only has four colors, Riggurly supports different
themes for your play experience, such as Wisteria and GBGreen. The only
theme that uses ANSI colours is BW, however, just as a note.

Building this was an amazing experience that I would recommend to anyone else who
want to learn how computers work better. Building an emulator requires a deep knowledge
of how the actual hardware works, from instruction nitpicks to actual hardware bugs that
need to be emulated just the same as an intentional feature. On the very popular Austin
Z. Henley article “Challenging projects every programmer should try”, they put building an
emulator as harder than building a Mini Operating System!

Notes on Installation

It is recommended that you install Riggurly via Homebrew instead of crates.io,
as it handles some things like dependencies and man-page installation for you
so you don’t have to do it manually. Unfortunately, crates.io does not support this
as of now, and possibly forever.

Also, you will need a terminal like Kitty, iTerm2, or Ghostty to properly
render output. More information is available in the README.

Thank you so much for taking the time to play around with my Magnum Opus, and I sincerely hope you enjoy!

  • 51 devlogs
  • 162h
Try project → See source code →
Open comments for this post

4h 45m 48s logged

Bittersweet

Hello everyone, one final time. Let’s dive right in so I can watch a movie for Spanish class.

Pass (ft. Marcy Nabors)

I finished up the ROM test suite yesterday!!
I finished the big test that tests have of all possible types of errors and all successes,
then I quickly made the rom too short and bad checksum test. It was finally done, and it was kind of cathartic.

Cadmium Colors

After dealing with the ROM tet suite, I decided to update the README. I did end up forgetting to add a cool image,
but what are you gonna do? I might add one to the README tomorrow, after shipping.
Riggurly doesn’t work on Apple’s Terminal.app because it doesn’t render block characters properly, but IT WORKS
ON RATTY (though it is slow enough that sound doesn’t work at times), which is pretty huge considering
I can activate mobius strip mode and 3D mode for the memes. There was also some other README information that needed
to be added.

Liaison

For a second, I considered changing the binary name to rigg, but I decided against it in the end because it would be to
much work for so little gain, and I don’t want to let AI touch my code that much to automate the changes.

Manifesto

After that, it was finally time to release. I quickly dropped it on crates.io, then I made the homebrew tap, which ended
up being a lot more complicated than my last project’s because of how audio is used on Linux by software.

Shiny Chariot

And with that, Riggurly was done. Truly a transformative experience for me as a programmer. I’ll probably take a
break to work on my NixOS rice, after which I’ll probably build either a mini OS OR a CHIP-8 interpreter in Rust.
I’m a significantly better programmer than when I started this project, and it feels insane that it’s over.
Thanks to @EfflawIThink and @asho for being awesome people and thanks to the rest of you who gave me the time of day.
:3-blahaj-spinning:

0
0
32
Open comments for this post

4h 19m 44s logged

ROMulus and Remus

Hello everyone! Let’s dive in so I can fool around with my Raspberry Pi 4 running on NixOS before I go to bed!

There’s a reasone Remus didn’t lead ROMe

As I mentioned before, I’ve been working on unittests for the ROM side of the ROM mudule as opposed
to the save side. So far, I’ve completed 2 unittests, both of which will be eclipsed by the one I am
currently writing. Right now, I’m working on one big master test to check the success and failure of
every possible combination mbcs and ram sizes. In its current trajectory, it’ll only tests mbcs that
Riggurly supports alongisde all RAM sizes, but I’ll probably have it iterate over every possible byte
that could be an mbc, real or not, just for efficiency sake, since all the machinery is/will be there
to test them. The reason I am logging four hours is because these tests take a lot more mental acrobatics
to think about and I’ve messed with the structure of the latest test quite a bit, though I’ve found
something I like now.

After writing this test and the tests for short ROMs and bad checksums, I’ll release to crates.io,
make the Codeberg release, finish the Homebrew tap, and ship!

Earlier today, I was listening to Jamie Paige while I was historianing, but while I was programming
on my couch, I was too lazy to grab my headphones — or pee for that matter, I really need to pee —
for the entire time, so I just watched Doctor X (the Korean one) with my dad, fire show btw, would
highly recommend, had my dying with laughter at times. Y’all should make sure to keep listening to
Jamie Paige, as that is how you make programmer friends IRL — half the people I know who listen to
her music are also programmers, including @ElffawIThink, the second-to-third-best programmer I know
irl. Anyway, hopefully I can pee AND work on my NixOS rice before I go to bed.

0
0
39
Open comments for this post

3h 1m 27s logged

Saviour

Hello everyone! Let’s dive right in so I can go to bed!

Failsafing

As I mentioned in my last devlog, I had addressed the success scenarios for saving, so I needed to address failure scenarios as well.
Since I have only built tests for saving so far, it was only natural to enforce the failures of the saves before doing ROMs.
I built a bunch of tests with mismatched save sizes compared to the size specified by the ROM, as well as a good few with save files that were damaged, but I ended up deleting a lot of the latter because of unnecesary redundancy.
Now, since I finished with all the save tests, I can work on the ROM loading tests, which will be interesting.

This is also the first time in forever that I am typing with near-zero keyboard visibility, and it could be going worse. I’ve been listening to a lot of The Crane Wives recently as well, would recommend to add to your rotation alongside Jamie Paige. That’s it for now folks, see y’all next time!

0
0
47
Open comments for this post

8h 37m 28s logged

Scooby-Doo

Hello friends! I just got an email from Stardance saying I have 8+ unlogged hours, so let’s dive in?

I Wish That I Could [Fail]

I haven’t exactly done much of aything since my last devlog. I’ve written two unit tests, I guess, which do partially (mostly) address the situation with ensuring that ROM state isn’t changed by a bad save, such as with an RTC or loading in a bad save. I covered the case for two MBCs (MBC1 and MBC3) that the number of banks for the save is mismatched with what ROM was loaded (eg. 4 banks on a 1 bank ROM or MBC2 style ram on an MBC3 rom, though I will cover this case in the future).

As for where the time came from, it may be that I stared at my TODO list too hard, as I have my TODOs for Riggurly in one emacs split and my TODOs for school in the other, but I have my school.org in a completely different location in my FS, in my org directory ~/org instead of my my Riggurly directory ~/projects/riggurly, but I have no clue. I didn’t even edit either file for more than a total of 5 minutes!!!

Anyway, that’s all for now folks! Make sure to keep listening to Jamie Paige and drop @ElffawIThink a follow! :3-blahaj-spinning:

Also, the novel is a stupid ad I saw on Royal Road whiul ereading 1% lifesteal

0
0
20
Open comments for this post

3h 24m 12s logged

Failing Tests

Hello everybody! We’re back with another devlog! Let’s dive right in so I can got to bed!

All Tests Pass

A good bit of test writing has happened since the last devlog. The ROM suite has gone from a measly 3 tests to a much nicer 16, though still incomplete.
I wrote more tests to test combinations of roms and save sizes that are meant to work, as well as a bunch of those that also test RTC functionality for MBC3.
I ended up putting ROM construction into a helper, as well as making a helper for most of the save round trip tests, probably saving a few hundred lines of code.
Next tests are probably going to be broken saves, saves that don’t match, etc. etc. to see that ROMs are preserved and such.

Algospeak

Going back to the RTC, I remade the function that adds a number of seconds to the internal RTC. What I was doing before was calling a function that ticked by ticks with an amount of ticks equal to 1 second FOR EACH SECOND. That’s often hundreds of thousands or millions of function calls, with O(n) time complexity.
I was pretty easily able to swap it for an O(1) modulus thingy.

Switchie-Shwoo

Going back to ROM preservation, I recently realised that it was loading in new timestamp data before checking save validity, which could end up being problematic. I just swapped the order of those two and the problem was solved, though, as I said before, this needs to be test-enforced.

That’s it for now folks! See y’all next time! :3-blahaj-spinning:

0
0
26
Open comments for this post

2h 21m 9s logged

sleep(); sleep(); sleep(); allTestsPass()

Hello everyone! Let’s dive in so I can get back to work before I go to bed!

Testing, Testing, 1, 2, 3

For the last couple hours, I’ve been writing unit tests for the ROM module.
I’ve been going on and off with unit tests for a while. Before, I wanted to write unit test for cpu instructions before realising Blarrg made test ROMs for that.
Because of that, test ROMs are the primary mode of testing out Riggurly, especially since test ROM developers know much more about specifics, like the halt bug, than I do.
However, trest ROMs don’t test things like saving and loading, which is something I CAN write tests for in a reasonable amount of time.

A lot of the work I’ve done was just making one helper function and figuring out what I wanted to be covered by it and what I want the tests to do. I might also refactor some repeated stuff into another helper for more efficient code after I finish writing the save round trip unit tests.

That’s it for now friends, and don’t forget to listen to Flavor Foley’s new album, Mirror Modulation, which dropped today? on all music streaming platforms :3-blahaj-spinning:

0
0
43
Open comments for this post

2h 54m 11s logged

Little Bonuses

Hello Everyone! I have to go walk the dogs, so let’s dive right in!

Building Codes

Since I want a few more hours to try to see if I can get a Framework 13 and Celeste, I decided it would be good to add all the nicities I did for my last CLI, leading-zero-util (I know, terribly named), namely, man file and completion generation.
On lzu, I used a hidden flag for completions and had a build.rs for the man page. However, I found it best to merge all of them into one hidden flag for ease of use. At first I tried a build.rs, but it kinda made dependencies annoying and made either my or lib users’ lives worse.
That’s it for now folks! Next I’ll be working on unit tests for ROM stuff. :3-blahaj-spinning:

0
0
15
Open comments for this post

5h 32m 35s logged

Much TODO About Nothing

Hello everyone! We are finally back after a devlog hiatus due to me having to write essays to apply for my school’s software team! Let’s dive in so I can work on my history homework!

Read It and Weep

Last time, I talked about, in one title line by accident, how writing documentation and documenting my software’s flaws really exposed what was wrong with it. This update is all about fixing those flaws (mostly)

A Multitude of Screams

One of the biggest issues with my emulator was the audio. Not in the backend, but the frontend. Due to laziness, I didn’t bother adding mono audio support, which ended up being a 5-minute fix.

There was also another glaring issue with the audio: Once it crashed, it wouldn’t rebuild the stream. If you unplugged your headphones, thinking the audio would continue on your other speakers, it would just turn it off and modulate speed with std:🧵 :sleep(). It took me a while to write all the rebuilding code in such a way to maximise user QoL for all users.

When did I download you?!

Since Riggurly is both a CLI AND a library, it has dependencies that are used only in the CLI that are still a part of the package as a whole. Library users still have to download and compile these dependencies, which can be a hassle and a waste of time.

I’ve been meaning to put CLI-only dependencies behind a feature so library users can easily prevent themselves from downloading and compiling a bunch of heavy extra dependencies. This also taught me how to use features, which was good.

You’re a Waste of the Air You Breathe!

One thing that’s been bugging me for a while is efficiency. My array for the fallback memory bus array in the memory bus struct has always been 0x10000 bytes long (1 mebibyte, how much ram a GB has (kind of)). How reading and writing has worked is that there are match statements you go through to see if you access that array or you access the rom or if you access the vram or something else. The problem is that over 3/4 of that array’s length is useless and shadowed by ROM/CRAM/VRAM. I was wasting 768 kb of heap-memory. I ended up dropping the first 3/4 and just having a smaller array. Unfortunately, some space is still wasted, but it’s not much compared to before. I showed @ElffawIThink and they though it was funny.

Also, one of the ROM types comes with 512 HALF-BYTES(nibbles) of RAM, which I had been representing with a [u8,512] with the upper nibbles of EVERY BYTE going unused. I shrank this down to a [u8,256] and use both nibbles for a fish in the sea.

Take Me Home

Before, I had to put a disclaimer in my README that you couldn’t use ~ as your home directory in your default ROM path in your config.toml because different users have different home directories and I have to use the dirs crate to find that out at runtime. This was a surprisingly long fix, though it was quite simple. Just a few lines of code to strip the ~ and replace it with the already found home directory.

That’s all for tonight comrades! Make sure to listen to Jamie Paige, especially Clover! That song is now the first song in my playlist with vocal (sequentially, obviously my playlist has other songs with vocals), overtaking Lemon Boy by Cavetown, it’s just that good. It has also shown itself to be a better daily anthem than Villain by Teniwoha and Schifty Five, the YouTube classic.

0
0
31
Open comments for this post

2h 22m 33s logged

Lover Tell Me if You CanHello everyone! Let’s dive in so I can work on improving the user experience!## ManThis devlog is all about README. I have actually never used Markdown before, only org, Emacs’s outliner/md format, because it is more intuitive and Emacs gives you more toys. My style guide is in org, my todo lists are in org; the only things that aren’t are the AGENTS.md I stole from Ghostty and the README.md. I ended up using a combination of the Stardance and Phantom README guides to help me figure out what to put in it and how to do syntax. Working on the README put an emphasis on some flaws in my code:- config path ~ not expanding- my glaring lack of a homebrew tap- mono audio still being unsupported- feature gating on binary-only depsThat’s it for now folks!

1
0
72
Open comments for this post

3h 12m 44s logged

Erroneous

Hello everyone! I have a history in-class-writing in 6 hours, so let’s dive right in!

Error 404

Once I started adding support for loading ROMs and saves, failure points became possible. I hadn’t previously written errors before, so I just wrote strings and propagated them through with Result< T, Box> and the ? operator, with no regard to API users that may want to recover from a failure. I’ve been putting this off for so long, and was even considering doing this after shipping, but since I have so much time on my hands and the only other big TODOs left are the README.md and the Homebrew tap, I decided, why not? This has been a very interesting process over all, and it even gave me the impetus to do some proper gating on load_rom. Different MBCs only support some cram sizes, but because I wasn’t gating on load, these would fail at runtime with a mismatch.

Read All About It

Next up is the README. I previously had a mediocre, small, incomplete README in a file formet I forgot crates.io doesn’t have a renderer for, so I figured it would be best to start from scratch in Markdown instead of trying to port it over from Org. I also chnaged the name to Riggurly since that rolls off the tongue more.

That’s it for this morning! I also found the bathroom in ENA: Dream BBQ, which was cool. I still need to go inside. Also, make sure to listen to Jamie Paige, as she always boosts my productivity!

0
0
50
Open comments for this post

4h 9m 16s logged

Vendetta

Hello everyone! Let’s dive right in so I can work on my math homework so I don’t fail my calc test next week!

TUIzers

I COMPLETED THE TUIIIIII!!! I added a text entry box for people to manually enter the names of their new saves. I also stylised the highlighting a bit more, and , even though its not in the video, now, the color changes to green when you’re selecting a save. This was a really fun learning experience.

I originally wanted to make a TUI because one of the raters on my last project, leading zero util, complained about having to use a simple CLI and told me it wasn’t that good because of the lack of TUI, so this has been kind of a personal vendetta against that person to improve my software and user experience.

The Other Interface

This project isn’t just a CLI utility. The entire time I’ve been building this, I’ve wanted to enable others to make a frontend for it, whether it be on the web or a gui or some port of it in something. I’ve maintained a careful separation between lib and bin, with the exception that they are the same crate. For library users, dealing with my errors would be impossible since many of them are just strings and they are all just Box. Before throwing this on crates.io, I want to make error enums and stuff so people can do error matching.

Tap Tap

After completing error enums and stuff, I’m going to throw it on crates.io and make a github release so I can make a Homebrew tap. The last time I made a homebrew tap, I gave the project it’s own separate tap repo, but this time I’ll keep all my taps in a new tap repo on my GitHub instead of Codeberg for users.

That’s it for now! I’m excited to make error enums so I can have that skill under my belt as well! Also, I’ve reached the point where shipping would probably let me get a framework 12, which is very exciting for me.

0
0
22
Open comments for this post

3h 33m 59s logged

Pick Me

Hello everyone! Let’s dive in so I can go feed my gecko and sleep!

Seleccionar

For the past few hours, I’ve been working on the file picker for selecting a rom and a save file. A lot of it is just learning about how to use Ratatui. Originally, I was going to have the selecting happen all at once, by one function, but I switched it to two calls so that load_rom() and has_battery() can be called to check whether the save menu should even come up.

Write-In Candidate

The thing is, since with a new save, the file has to be constructed by the emulator and it doesn’t exist. Right now, I’m writing a little text input field to be triggered if the save menu gets close with Esc. This will be pretty short, and won’t require a large change to existing code. After that, I’ll wire it in and test.

Next Steps

  • Homebrew Cask
  • Separating frontend from backend crate by crate, so lib users don’t have to deal with frontend only imports.
0
0
63
Open comments for this post

2h 25m 28s logged

Ratatouille

Hello everyone, we’re back with another devlog! Let’s dive right in so I can hit bed so I can go rafting the day after tomorrow!

Compliance Chips

I’ve finally finished dealing with compliance! I’m surprised by how many extranneous parentheses I had! I knew I had a lot, but I didn’t know it was this much! I’m so happy that is over so I can get to real work!

Tui T. Sutherland

The last big feature I wanted to add before shipping was a TUI for selecting ROMs and saves. To do this, I need to use the ratatui crate, which fortunately run off the same crossterm my project already does.

So far, all I’ve done is learn about it and write the fn for getting the directories/files with the appropriate endings and sorting them for display use.

I’ll see y’all in a couple days!

0
0
13
Open comments for this post

1h 35m 43s logged

Comply-cations

Hello everyone!! We’re back with another devlog today. Let’s dive right in so I can start the next step!

Parensal Issues

As I said in my last devlog, while working on compliance for joypad.rs, I realised that I needed to delete extra parentheses around operators with obvious precedence. After working on that file, I continued down the buffers open in Neovim, also correcting that issue in addition to the others.

Because I only caught it midway through, I have to complete a second pass of compliance editing. Fortunately, I have mini.surround installed, so deleting parentheses is really easy.

That’s all that really happened. Make sure to listen to the daily dose of Jamie Paige and Vane Lily’s new song!

0
0
65
Open comments for this post

1h 56m 5s logged

You Will Be Terminated

Hello everyone! We’re back with another devlog! Let’s dive right in since it is 02:00 over here!

Lookin’ So Fab

I have contined with my quest to implement my BEAUTIFUL and living style guide.

Here’s what I did, since this work is mostly just repetitive and long.

  • gpu.rs and memory_bs.rs publicity compliance.
    Before today, 4/6 of Gpu’s fields were pub(crate) something they had no business being, so I refactored so everything uses methods. Took a chunk of time but it was very worth it.

  • registers.rs
    This one was pretty stupid. It had two main issues, publicity and masks.

The lackluster and incomplete guide I was following had me write registers.rs with a ton of bitmasks it didn’t need it in a way that was ugly and sad, so I dropped the masks.

All of Registers’ field and subfields are pub(crate), which I determined is optimal because it would be a major and massive chang to Cpu, and the registers are purely for the Cpu to use, and are part of the Cpu.

  • rom.rs
    rom.rs was pretty chill, only a few things here and there.

  • joypad.rs
    Despite this one taking a matter of minutes, this one is going to cause my so much work. All of its publicity was correct, as well as bit selecting formatting. Turns out I’ve been forgetting to remove parentheses around my files! Simply ridiculous!

ANyway, that’s all for now, since I need to go touch bed. So y’all later, and keep listening to Jamie Paige!

0
0
71
Open comments for this post

2h 17m 29s logged

If You Do Not Comply

Hello everyone! We’re back with another devlog! I need to go to school soon, so let’s dive right in!

Numerics, Literally

Since I made the style guide, it was time to start implementing it. So far, I’ve gone through emulator.rs, memory_bus.rs, apu.rs, and cpu.rs.

  • emulator.rs
    This one just needed doccomment formatting.

  • memory-bus.rs
    This one needed a few numeric literal changes. I also directly accesses the stat field of gpu, which is unnacceptable, but since I’m doing gpu.rs next, I left it for the time being.

  • apu.rs
    Despite being the file in which I came up with a chunk of my numeric literal style while writing, it felt like every literal was wrong.

  • cpu.rs
    This was the second easiest file, despite it being the longest by a wide margin. There was some repetitive numeric literal issues in the methods, but that was it. I also tried to split it into multiple files for length since it is double the size of any other file, but I lowkey failed.

Next up is gpu.rs compliance. I’ll see y’all next time!

0
0
44
Open comments for this post

4h 6m 6s logged

Dripmogging

Hello developer theme users! It’s been a couple days since my last devlog, since I couldn’t make one last night since my dad thought I had school today, so let’s dive in so I can work on compliance and becoming a peer tutor for math for my school!

Bitmasks: origins

One of the biggest parts of this project is working with bytes and getting data from bytes. To do this, you have to shift the bits you want to the end and then mask them like (byte >> shift) & bitmask. I feel like I’ve gone through dozens of different styles for bitmask and shift numeric literals, which is where the whole style guide idea came from.

Personal Stylist

For the past 4 hours, I’ve been perfecting a style guide for my codebase. It’s a beautiful org doc with that sweet sweet table of contents with rules on everything from numeric literals to tests to error enums. There’s not to much to say except the next step is going over all 5000+ lines of code to enforce compliance.

I’d like that written up

A quick note on org. Many online code hosting services like GitHub and Codeberg support org rendering. Rather unfortunately, crates.io only supports a README.md, and not a README.org, which gives me a big sad, especially since I’ll haveto rewrite my README in markdown (ew), which does not give me the luxury of an automatically generated table of contents.

That’s it for now folks, see y’all tonight!

0
0
33
Open comments for this post

5h 28m 25s logged

Scream it Loud and Scream it Proud

Hello everyone! We are back with the once again DAILY devlog!!! Let’s dive right in!

IT LIIIIIVES!!!

This morning, as soon as I came up, I sat my @ down to trouble shoot my audio processing on 4 hours of sleep :3-blahaj-spinning: . Despite adding the manual sleep time reduction, I was still experiencing some crackling, so I found a bug in the channels, solving which didn’t solve anything, but switching timing to be based off of audio when available worked like a charm, giving better and more accuracte speeds and crisp audio, so I was able to show off my COMPLETED EMULATOR CORE to some of my friends (as well as my backpack with Ferris on it).

IT DIIIIIES!!!

After adding the audio, I had to make sure that it wouldn’t cause the emulator to break, so I added a timeout that shuts off audio if it’s broken for more than 500 ms

YES CAAAAAAP

Because of how I was translating from u16 audio to f32, I was getting popping, so I implemented a software capacitor to slowly dampen sounds closer to EQUILIBRIUM

SWITCH IT UUUUP

After audio had all it needed, it was time to work on something I had long anticipated, a lib.rs for people o build their own frontends on top of my emulator. I also added an Emulator wrapper struct around Cpu so that it would be easier to manage pub methods and such without the ~1550 other lines in cpu.rs making things hard. There’s a reason this project isn’t just one big file of 5000 SLoC.

I also added some documentation, and I found the best use of Claude Code is checking for spelling errors (it’s like I’m illiterate!)

Speaking of SLoC, I cracked 5000 today! This is about 3.5x larger than my last two projects combined! I’ll see y’all next time, and don’t forget to listen to beabadoobee’s new album Pylon and Jamie Paige!

0
0
50
Open comments for this post

5h 57m 16s logged

BLAAALAKKLJHSLJHDKHJALKJHLKGSFG

Hello everyone! It seems that the devlogs have become oppositely bidaily — just this once, don’t you worry — than my last two devlogs. Let’s dive right in since we have so much to cover.

audio output master race

After I finished chan 4, it was time to implement master apu registers and channel mixing and panning.
Most of the registers were pretty simple, except the one with the master APU power on/power off, as to implement it I had to gate every write on whether it was on, except the wave RAM. I also did that during my PE class (while exercising, of course), which contributed to the difficulty. Fortunately, I write my code in Neovim, so it really sped things up, including 1-handed editing.
With that, the backend was nearly done, and I had reached the point at which I would no longer need Pan Docs or anything of the like, just straight Rust sailing.

Thread the Needle

In order to get the audio timed correctly, I had to hook up tick_channels() to a channel on which it sends a tuple of u16s (left and right amplitudes) to some receiver. This lets the audio be decoupled from whatever frontend one has.

Your Pal, CPAL

cpal is a a Rust crate for audio and stuff. Here’s the audio stuff because I can’t think straight it’s so late & I have an integration by parts quiz tomorrow and I don’t want to fail something light b/c I didn’t sleep.

fn get_audio_stream(cpu: &mut Cpu) -> Result<Option<Stream>, Box<dyn std::error: :Error>> {
    if true && let Some(device) = cpal::default_host().default_output_device() {
        let supported_stream_config = device.default_output_config()?;
        let stream_config = supported_stream_config.config();
        let sample_format = supported_stream_config.sample_format();
        let (sender, receiver) = std::sync::mpsc::sync_channel::<(u16, u16)>(5000);
        let error_callback = |_err: cpal::Error| {};

        cpu.set_audio_sample_rate(stream_config.sample_rate);
        cpu.set_audio_sample_sender(sender);

        let stream = match sample_format {
            cpal::SampleFormat::F32 => {
                let data_callback = make_data_callback::<f32>(receiver, stream_config.channels);
                let stream = device.build_output_stream(
                    stream_config,
                    data_callback,
                    error_callback,
                    None,
                )?;
                stream.play()?;
                Some(stream)
            }
            cpal::SampleFormat::I16 => {
                let data_callback = make_data_callback::<i16>(receiver, stream_config.channels);
                let stream = device.build_output_stream(
                    stream_config,
                    data_callback,
                    error_callback,
                    None,
                )?;
                stream.play()?;
                Some(stream)
            }
            cpal::SampleFormat::U16 => {
                let data_callback = make_data_callback::<u16>(receiver, stream_config.channels);
                let stream = device.build_output_stream(
                    stream_config,
                    data_callback,
                    error_callback,
                    None,
                )?;
                stream.play()?;
                Some(stream)
            }
            _ => Err(
                "Audio output sample format not supported! Try disabling audio in your config with 'audio = false'",
            )?,
        };
        return Ok(stream);
    }
    Ok(None)
}
// makedatacallback not shown due to char limits

Position,Velocity, Acceleration, Jerk, Snap, Crackle, and Pop

After that, I tested it, but there was some terrible audio crackling. Turns out it was due to oversleeping when trying to time things correctly, though before finding this out, I ended up slightly optimising draw_frame().The artifacts seem to be mostly gone and I will leave this to tomorrow silly. nearly @ 5000 sloc :3-blahaj-spinning:

0
0
27
Loading more…

Followers

Loading…