github karl-zylinski/karl2d beta-3
Beta 3: Audio

latest releases: karl2d-jam-hotfix-1, karl2d-jam, beta-3-hotfix-1...
one month ago

The third beta of Karl2D is here!

The big thing: Audio support

Since beta 2, audio support has been added. This is done using a custom software mixer. The mixer is part of karl2d.odin. It takes all the playing sounds and audio streams and mixes them together. The resulting mix is sent off to platform specific backends. I have avoided using libraries that abstract the audio interfaces of each OS, instead we have written an audio backend per operating system. These backends tend to be small because the software mixer does the heavy lifting.

The audio works on:

  • Windows (waveOut backend)
  • Mac (CoreAudio backend)
  • Linux (ALSA backend)
  • Web (WebAudio backend)

See the audio example and positional audio example for ideas on how to use the audio features.

I've written a blog post about the audio mixer: https://zylinski.se/posts/audio-in-karl2d-software-mixing/

Support the project

The audio capabilities took a lot of work. Since a few weeks back I'm back working full-time on my own projects. If you want to support my work then please become a GitHub sponsor or a Patron. This will help me get Karl2D to a stable 1.0 release quicker!

API changes since beta 2

  • Renamed proc: set_window_size -> set_screen_size
  • New proc: get_held_modifiers
  • New proc: draw_triangle
  • New audio procs: play_sound, stop_sound, sound_is_playing, set_sound_volume, set_sound_pan, set_sound_pitch set_sound_loop, load_sound_from_file, load_sound_from_bytes, load_sound_from_bytes_raw, load_audio_buffer_from_file, load_audio_buffer_from_bytes, load_audio_buffer_from_bytes_raw, create_sound_from_audio_buffer, destroy_sound, load_audio_stream_from_file, load_audio_stream_from_bytes, destroy_audio_stream, play_audio_stream, pause_audio_stream, stop_audio_stream, set_audio_stream_volume, set_audio_stream_pan, set_audio_stream_pitch, set_audio_stream_loop, update_audio_mixer
  • New rect procs: rect_overlapping, rect_overlap, point_in_rect, rect_middle, rect_from_pos_size, rect_top_left, rect_top_middle, rect_top_right, rect_bottom_left, rect_bottom_middle, rect_bottom_right, rect_shrink, rect_expand
  • New rect cut procs: rect_cut_top, rect_cut_bottom, rect_cut_left, rect_cut_right
  • New misc procs: rotate
  • Renamed proc: get_camera_view_matrix -> camera_view_matrix
  • Renamed proc: get_camera_world_matrix -> camera_world_matrix
  • New proc: get_fullscreen_rect
  • Font_Options struct that you can pass to load_font_from_file to specify premultiplication of alpha etc.

Merged Pull Requests

While a lot of the audio work was done by me in the master branch, I also got a lot of Pull Requests. Thanks everyone!

New Contributors

Full Changelog: beta-2...beta-3

Don't miss a new karl2d release

NewReleases is sending notifications on new releases.