Commit graph

321 commits

Author SHA1 Message Date
Gered b856ab2fc6 add doc comments for audio functionality 2022-07-10 14:31:23 -04:00
Gered 44984c716c add "apply" method variant that handles device locking itself
rename the old "apply" to "apply_to_device". meh. naming is hard.
i expect that most of the time i'd want to use the "apply" method i'm
adding here that handles device locking internally, so that is why i've
chosen to let it be called "apply" and to rename the other one.
2022-07-10 14:21:52 -04:00
Gered 253e70463e better method name
i guess "from" implies it is converting one thing to another, but that
is not what this method was doing really.
2022-07-10 13:18:59 -04:00
Gered cbfd66d42e return index of the audio channel instead of the channel itself
this is more useful because playing/stopping can be done on a specific
channel more easily by specifying a channel index. and the index can
obviously also be used to get the channel itself when/if needed, but
it's not super convenient to get the index of a channel when you only
have the channel itself
2022-07-10 12:58:14 -04:00
Gered 06d3d927fe return true/false based on if playback was actually started or not 2022-07-10 12:55:09 -04:00
Gered b4e641ed41 forgot to commit necessary test asset for previously added tests
another oopsie.
2022-07-10 11:52:11 -04:00
Gered 933811f705 address some compiler warnings. oopsie 2022-07-10 11:51:05 -04:00
Gered 6b7b525597 add font string measurement 2022-07-10 11:49:36 -04:00
Gered 67005faa7b mark some getter methods inline 2022-07-09 18:19:01 -04:00
Gered 0ccc37420d add blit_atlas method
for some additional convenience when blitting BitmapAtlas tiles
2022-07-09 18:17:28 -04:00
Gered 6a730ed70c remove redundant clones 2022-07-01 16:29:47 -04:00
Gered e276eb950d add AudioQueue
for queuing audio "commands" which is a much nicer way to interact
with the audio system in general in a more complex application, as this
lets you play audio in more of a "fire and forget" kind of way.

Rc<AudioBuffer> play methods provided as an alternative because
otherwise you end up with a somewhat gross double-copy of the audio
buffer being played. but i didn't want to necessarily force use of
Rc<AudioBuffer> just yet ... thus both versions of these methods are
provided.
2022-07-01 16:23:28 -04:00
Gered 1a82436661 re-organize audio crates a bit 2022-07-01 15:23:34 -04:00
Gered 2b082fe040 add flipped blit clipping tests 2022-06-15 18:22:26 -04:00
Gered bb54c3bec6 fix flipped blit clipping 2022-06-15 18:10:34 -04:00
Gered 20d0d8630d add global audio volume control 2022-06-05 18:42:09 -04:00
Gered 13b18e3d71 convenience methods for playing/stopping specific audio channels 2022-06-05 18:29:57 -04:00
Gered 5f5bc79d86 doc comment update for clarification 2022-06-05 13:01:10 -04:00
Gered 39964eb4de method naming standardization 2022-06-05 12:57:03 -04:00
Gered 51a9bddc33 add vertically and horizontally flipped BlitMethod variations 2022-06-05 12:55:31 -04:00
Gered d3e034d211 give multi-parameter BlitMethod enum values named parameters 2022-06-05 11:11:39 -04:00
Gered 12ad705fce mini refactor 2022-06-04 16:26:51 -04:00
Gered 819603ca2a more formatting and doc comments 2022-06-04 16:22:51 -04:00
Gered 1d9fceb98c rustfmt applied 2022-06-04 16:22:41 -04:00
Gered 71556c6d65 add color offset blit method variants
these allow a per-pixel color index offset to be applied during blits
2022-06-04 16:13:50 -04:00
Gered 6bb52e57e1 add initial somewhat imperfect rotozoom blit method 2022-06-04 15:54:37 -04:00
Gered a48f785ad0 mark some methods as inline
this probably doesn't really matter, as i understand it rust inlines
a hell of a lot of stuff, especially for method calls from within
the same crate ...
2022-05-29 19:23:16 -04:00
Gered 17e30fdec4 simplify 2022-05-29 17:47:24 -04:00
Gered 28c964e37e add initial support for playing custom audio waveform generators
with typical sine wave generator example added to the audio_playback
example project
2022-05-29 17:43:51 -04:00
Gered 9e8727c02b replace TARGET_AUDIO_SPEC with separate constants for freq and channels 2022-05-29 14:27:04 -04:00
Gered 94922caf71 minor updates to audio_playback example
using Audio's AudioSpec property to get the target format to convert to
2022-05-29 13:53:35 -04:00
Gered 03950c8d3e formatting 2022-05-29 13:52:53 -04:00
Gered 7ee256e12e add Audio struct to wrap underlying SDL AudioDevice
doesn't provide much value currently, but serves as a base for future
extension (e.g. queuing play commands, global volume changes, etc)
2022-05-29 13:51:55 -04:00
Gered c5b2e216cf formatting 2022-05-29 13:22:03 -04:00
Gered 23f2d4da02 update audio_playback example with varied wav file formats to convert 2022-05-29 13:18:51 -04:00
Gered 00eb6fcb20 support loading 16-bit wav files 2022-05-29 13:18:15 -04:00
Gered dd6178ca1f improve wav file loading. handle buggy/naive cases better 2022-05-29 12:54:02 -04:00
Gered b28c0f6555 add stream_size method
this is just a temporary alternative to the currently unstable
stream_len method, because i don't currently want to depend on unstable
rust versions if i don't need to.
2022-05-29 12:52:58 -04:00
Gered 9c35d670fa some AudioSpec usage cleanups and minor improvements 2022-05-29 11:19:57 -04:00
Gered e4a90e7f10 play_buffer now enforces matching AudioSpecs 2022-05-29 10:57:04 -04:00
Gered 3d3f46417d change audio channel methods to return options in places. add comments
i figure the option return types help clarify intent a bit instead of
using 0's as a default.
2022-05-28 20:57:14 -04:00
Gered 3bf69d651d add audio_playback example 2022-05-28 20:29:40 -04:00
Gered 342e2a3877 add initial audio playback and wav file support 2022-05-28 20:29:17 -04:00
Gered bc03961a49 bitmap font/char rendering now requires a FontRenderOpts
this is more flexible for future font types, which may not require
only a simple u8 color value (e.g. bitmap fonts)
2022-05-27 17:52:23 -04:00
Gered 51cb8a5bf5 add template_complicated example 2022-05-26 21:18:45 -04:00
Gered 0afc7e822a add template_minimal example 2022-05-26 18:43:22 -04:00
Gered 246367b50b remove push/pusher components from dead slime corpses 2022-05-23 20:32:12 -04:00
Gered 1f80c9943e attribute original artists 2022-05-23 18:17:53 -04:00
Gered 4f3928cf56 add READMEs and screenshots for examples 2022-05-23 17:45:22 -04:00
Gered 1ab1d8e0ad add "slimed" example 2022-05-23 17:43:38 -04:00