The purpose of this module is to provide audio functions for things like playback, capture, and volume on both Windows (via the mmsystem calls) and Linux (through ALSA).
It is only aimed at the basics, and will be filled in as I want a particular feature. I don't generally need super configurability and see it as a minus, since I don't generally care either, so I'm going to be going for defaults that just work. If you need more though, you can hack the source or maybe just use it for the operating system bindings.
For example, I'm starting this because I want to write a volume control program for my linux box, so that's what is going first. That will consist of a listening callback for volume changes and being able to get/set the volume.
TODO: * pre-resampler that loads a clip and prepares it for repeated fast use * controls so you can tell a particular thing to keep looping until you tell it to stop, or stop after the next loop, etc (think a phaser sound as long as you hold the button down) * playFile function that detects automatically. basically: if(args.endsWith("ogg")) a.playOgg(args); else if(args.endsWith("wav")) a.playWav(args); else if(mp3) a.playMp3(args);
Thrown on audio failures. Subclass this to provide OS-specific exceptions
Old thread implementation. I decided to deprecate it in favor of AudioOutputThread because RAII semantics make it easier to get right at the usage point. See that to go forward.
Makes an audio thread for you that you can make various sounds on and it will mix them with good enough latency for simple games.
Puts a note on at the beginning of the passed slice, advancing it by the amount of the message size. Returns the message slice.
Pitch bend. FIXME doesn't work right
Provides an interface to control a sound.
A reasonable default volume for an individual sample. It doesn't need to be large; in fact it needs to not be large so mixing doesn't clip too much.
Gives PCM input access (such as a microphone).
Interfaces with the default sound card. You should only have a single instance of this and it should be stack allocated, so its destructor cleans up after it.
Gives PCM output access (such as the speakers).
Wraps AudioPcmOutThreadImplementation with RAII semantics for better error handling and disposal than the old way.
A clock you can use for multimedia applications. It compares time elapsed against a position variable you pass in to figure out how long to wait to get to that point. Very similar to Phobos' StopWatch but with built-in wait capabilities.
For reading midi events from hardware, for example, an electronic piano keyboard attached to the computer.
Gives MIDI output access.
* play audio high level with options to wait until completion or return immediately * midi mid-level stuff but see arsd.midi!
* some kind of encoder???????
I will probably NOT do OSS anymore, since my computer doesn't even work with it now. Ditto for Macintosh, as I don't have one and don't really care about them.
GPL3 unless you compile with -version=without_resampler and do *not* use the mp3 functions, in which case it is BSL-1.0.