Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (53 sloc) 3.505 kb
578b9c3 @taisel readme update.
authored
1 <h1>XAudioJS</h1>
fc453ec @taisel Updated the README to document that adobe flash support has indeed been ...
authored
2 <h3>A minimal cross-browser API for writing PCM audio samples:</h3>
be3ddf1 @taisel Readme update.
authored
3 <p>This simple JavaScript library abstracts the push-for-audio API of Mozilla Audio, the MediaStream API in experimental Firefox Nightlies, and the passive callback API of Web Audio.
2d3bdf6 @taisel Updating Readme
authored
4 This library introduces an abstraction layer that provides a push-for-audio and a callback API in one. We even provide a flash fallback to bring us to a total of 4 APIs supported.</p>
578b9c3 @taisel readme update.
authored
5 <br>
153f803 @taisel Adding a public domaiin statement.
authored
6 <b>This software is hereby placed in the public domain for anyone to use.</b>
fc453ec @taisel Updated the README to document that adobe flash support has indeed been ...
authored
7 <br>
578b9c3 @taisel readme update.
authored
8 <h3>How To Initialize:</h3>
9 <dl>
756000b @taisel Fixing some bugs. Genneral cleanup. Support for greater than two sound c...
authored
10 <dt>new XAudioServer(int channels, double sampleRate, int bufferLow, int bufferHigh, function underRunCallback, double volume, function failureCallback);</dt>
578b9c3 @taisel readme update.
authored
11 <dd>Make sure only one instance of XAudioServer is running at any time.</dd>
12 <dd>bufferLow MUST be less than bufferHigh.</dd>
6019093 @taisel Clarifying the buffer ring type.
authored
13 <dd>bufferHigh sets the internal FIFO buffer length for all APIs except the Mozilla Audio Data API. Overfill on FIFO causes the oldest samples to be dropped first.</dd>
0b7bdc8 @taisel update.
authored
14 <dd>
3c84eb8 @taisel update.
authored
15 <h4>Array underRunCallback (int samplesRequested)</h4>
354aa2d @taisel update.
authored
16 <blockquote>
045f827 @taisel update.
authored
17 Arguments: Passed the number of samples that are needed to replenish the internal audio buffer back to bufferLow.<br><br>
18 Functionality: JS developer set callback that can pass back any number of samples to replenish the audio buffer with.<br><br>
3c84eb8 @taisel update.
authored
19 Return: Array of samples to be passed into the underlying audio buffer. MUST be divisible by number of channels used (Whole frames required.). The return array length DOES NOT NEED to be of length samplesRequested.
354aa2d @taisel update.
authored
20 </blockquote>
0b7bdc8 @taisel update.
authored
21 </dd>
cc3ec73 @taisel Added the volume option. Remove the defaultNeutral, which really only wo...
authored
22 <dd>volume is the output volume.</dd>
756000b @taisel Fixing some bugs. Genneral cleanup. Support for greater than two sound c...
authored
23 <dd>
24 <h4>void failureCallback (void)</h4>
25 <blockquote>
26 Functionality: JS developers set this callback to handle no audio support being available from the browser.
27 </blockquote>
28 </dd>
578b9c3 @taisel readme update.
authored
29 </dl>
30 <h3>Function Reference:</h3>
31 <dl>
32 <dt>void writeAudio (Array buffer)</dt>
33 <dd>Arguments: Pass an array of audio samples that is divisible by the number of audio channels utilized (buffer % channels == 0).</dd>
3ac3529 @taisel update.
authored
34 <dd>Functionality: Passes the audio samples directly into the underlying audio subsystem, <b>and can call the specified sample buffer under-run callback as needed (Does the equivalent of executeCallback in addition to the forced sample input.)<b>.</dd>
578b9c3 @taisel readme update.
authored
35 <dd>Return: void (None).</dd>
b4f648a @taisel Updating documentation for an API function that I forgot to document.
authored
36 <dt>void writeAudioNoCallback (Array buffer)</dt>
37 <dd>Arguments: Pass an array of audio samples that is divisible by the number of audio channels utilized (buffer % channels == 0).</dd>
155dbc5 @taisel TiP0s
authored
38 <dd>Functionality: Passes the audio samples directly into the underlying audio subsystem.</dd>
b4f648a @taisel Updating documentation for an API function that I forgot to document.
authored
39 <dd>Return: void (None).</dd>
578b9c3 @taisel readme update.
authored
40 <dt>int remainingBuffer (void)</dt>
41 <dd>Arguments: void (None).</dd>
42 <dd>Functionality: Returns the number of samples left in the audio system before running out of playable samples.</dd>
5a2c32f @taisel Unbanning the Mozilla Audio Data API for windows/linux.
authored
43 <dd>Return (On valid): int samples_remaining (<b>CAN BE NEGATIVE<b>)</dd>
44 <dd>Return (On invalid): null</dd>
578b9c3 @taisel readme update.
authored
45 <dt>void executeCallback (void)</dt>
46 <dd>Arguments: void (None).</dd>
47 <dd>Functionality: Executes the audio sample under-run callback if the samples remaining is below the set buffer low limit.</dd>
48 <dd>Return: void (None).</dd>
cc3ec73 @taisel Added the volume option. Remove the defaultNeutral, which really only wo...
authored
49 <dt>void changeVolume (double)</dt>
50 <dd>Arguments: double float between 0 and 1 specifying the volume.</dd>
51 <dd>Functionality: Changes the volume. Will affect samples in buffer, so has a low-latency effect (Use this to do a fast-mute).</dd>
52 <dd>Return: void (None).</dd>
578b9c3 @taisel readme update.
authored
53 </dl>
Something went wrong with that request. Please try again.