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_pitchset_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_Optionsstruct that you can pass toload_font_from_fileto 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!
- Platform interface procedure name cleanup by @karl-zylinski in #51
- add scissor on opengl backend by @EliasPrescott in #55
- Mac Handle Cmd-Q Terminate Message Gracefully by @EliasPrescott in #60
- Mac Memory Leak Fixes by @EliasPrescott in #59
- Fix for mac_set_screen_size by @cpoile in #62
- Fix incorrect input format for OpenGL shaders when passing layout_formats by @lucaspoffo in #74
- Fix wayland mouse button mapping by @henbr in #73
- Fix typos and formatting in README.md by @rofrol in #70
- Fix override shader input index (OpenGL) by @lucaspoffo in #75
- Use f32 for audio samples instead of i16 by @karl-zylinski in #77
- CoreAudio audio backend by @laytan in #85
- ALSA thread by @karl-zylinski in #87
- Warning is outdated- New release of odin is out by @RobinsAviary in #95
- Upstream changes from subtree in game project by @karl-zylinski in #101
- Upstream from game project: Draw triangle, font texture options and rect_from_pos_size by @karl-zylinski in #103
- Audio stream (for streaming music from a file etc) by @karl-zylinski in #90
- Support for mono sound sources by @karl-zylinski in #104
- Audio stream from bytes by @karl-zylinski in #106
- Sound Instances revamp by @karl-zylinski in #109
New Contributors
- @EliasPrescott made their first contribution in #55
- @lucaspoffo made their first contribution in #74
- @henbr made their first contribution in #73
- @rofrol made their first contribution in #70
- @laytan made their first contribution in #85
- @RobinsAviary made their first contribution in #95
Full Changelog: beta-2...beta-3