Class Index | File Index

Classes


Class weasel.AudioBuffer


Defined in: AudioBuffer.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
weasel.AudioBuffer(iPlaybackFrequency, iSoundChannels, iBufferSizeInSamples)
Object used to store Audio data before it gets sent to the Browser, responsible for mixing the created Channels together into stereo.
Field Summary
Field Attributes Field Name and Description
 
Supported mixer types (that may change in future), also used for display names where '$' is converted to '-' and '_' becomes ' '.
Method Summary
Method Attributes Method Name and Description
 
Append a sample to this Audio Sample buffer, incredibly slow, so is not recommended for large call volume.
 
clear(iSamplesToFill)
Clear part of the audio buffer (for use with mod with more than 4 channels as the mixing process is different).
 
Clear the audio buffers.
 
clip(iSamplesToFill)
Clip part of the audio buffer (for use with mod with more than 4 channels as the mixing process is different), clips to -1.0 to 1.0 range.
 
clipRLMDFat(iSamplesToFill)
Clip part of the audio buffer (for use with mod with more than 4 channels as the mixing process is different), clips to -1.0 to 1.0 range.
 
Get the actual audio buffer directly, is used because feeding samples with appendSampleToBuffer() is far too slow.
 
Get the length of the audio buffer in samples (number of channels is ignored, so same value is returned for stereo and mono).
 
Get the position in the audio buffer directly, is used because feeding samples with appendSampleToBuffer() is far too slow.
 
Get the circular audio buffer containing the rendered sample that is passed to the Audio sub system (its in interleaved stereo format).
 
Get the current position in the circular array (rendered sample data is behind this offset).
 
get Ignore Circular Buffer.
 
Get the mixer type.
 
Get the number of sound channels used in this audio buffer.
 
Get list of supported mixer type, used for populating a drop down list for user selection.
 
Get the number of written samples, which is the number of samples that have left this buffer and been given to the actual audio sub system (the Audio object in most cases).
 
mix(iSamplesToFill, aSamples1, aSamples2, aSamples3, aSamples4, iCircularBufferOffset, bFilterOn)
Mix sound channels together.
 
mixIn(iSamplesToFill, aSamples, iCircularBufferOffset, iPanningPosition)
Mix sound a channel into the AudioBuffer.
 
panningFT2Left(fPanning)
Fasttracker 2 Panning Law, which is (as far as I can tell) a logarithmic curve - or at least part of the curve with ~2.5db roll off for the center channel.
 
panningFT2Right(fPanning)
Fasttracker 2 Panning Law, which is (as far as I can tell) a logarithmic curve - or at least part of the curve with ~2.5db roll off for the center channel.
 
panningLawLeft(fPanning)
Panning Law for left channel, reduce the channels sound level the close it gets to the center (so that the sample volume stays approximately the same as it pans from left to right).
 
panningLawRight(fPanning)
Panning Law for right channel, reduce the channels sound level the close it gets to the center (so that the sample volume stays approximately the same as it pans from left to right).
 
removeSamples(lSamplesToRemove)
Inform AudioBuffer that samples were added to the audio sub system and should be removed from this AudioBuffer object.
 
Get the samples to fill, the number of sample slots available for use within this audio buffer (ignores the number of channels).
 
Set Ignore Circular Buffer, which records 1 seconds worth of output, only useful for oscilloscopes and (surprisingly) can be the difference between working and not on slow CPUs.
 
setMixerType(iMixerType)
Set the mixer type.
Class Detail
weasel.AudioBuffer(iPlaybackFrequency, iSoundChannels, iBufferSizeInSamples)
Object used to store Audio data before it gets sent to the Browser, responsible for mixing the created Channels together into stereo.
Author: Warren Willmey 2011.
Parameters:
{int} iPlaybackFrequency
= The playback frequency in hertz to use.
{int} iSoundChannels
= The number of sound channels (2 = stereo, anything else will fail).
{int} iBufferSizeInSamples
= The size of the audio buffer to use in samples (so this value is the same no matter the number of sound channels).
Field Detail
SupportedMixerTypes
Supported mixer types (that may change in future), also used for display names where '$' is converted to '-' and '_' becomes ' '..
Method Detail
appendSampleToBuffer(fSample)
Append a sample to this Audio Sample buffer, incredibly slow, so is not recommended for large call volume.
Parameters:
{float} fSample
= The Sample to add.
Throws:
Is thrown if audio buffer is already full.

clear(iSamplesToFill)
Clear part of the audio buffer (for use with mod with more than 4 channels as the mixing process is different).
Parameters:
{int} iSamplesToFill
= The number of samples to clear (ignoring stereo).

clearAudioBuffers()
Clear the audio buffers.

clip(iSamplesToFill)
Clip part of the audio buffer (for use with mod with more than 4 channels as the mixing process is different), clips to -1.0 to 1.0 range.
Parameters:
{int} iSamplesToFill
= The number of samples to clear (ignoring stereo).

clipRLMDFat(iSamplesToFill)
Clip part of the audio buffer (for use with mod with more than 4 channels as the mixing process is different), clips to -1.0 to 1.0 range.
Parameters:
{int} iSamplesToFill
= The number of samples to clear (ignoring stereo).

{Array} getBuffer()
Get the actual audio buffer directly, is used because feeding samples with appendSampleToBuffer() is far too slow.
Returns:
{Array} = The Audio buffer array (Audio Channels are interleaved, e.g. left-0, right-0, left-1, right-2, left-3, right-3 etc.

{int} getBufferLengthInSamples()
Get the length of the audio buffer in samples (number of channels is ignored, so same value is returned for stereo and mono).
Returns:
{int} = The Audio buffer size in samples.

{int} getBufferPosition()
Get the position in the audio buffer directly, is used because feeding samples with appendSampleToBuffer() is far too slow.
Returns:
{int} = The offset into the Audio buffer array (beware of stereo etc).

{Array} getCircularAudioBuffer()
Get the circular audio buffer containing the rendered sample that is passed to the Audio sub system (its in interleaved stereo format).
Returns:
{Array} = The circular array containing the rendered sample data.

{int} getCircularBufferPosition()
Get the current position in the circular array (rendered sample data is behind this offset).
Returns:
{int} = The current position in the circular array containing the rendered sample data.

{bool} getIgnoreCircularBuffer()
get Ignore Circular Buffer.
Returns:
{bool} = true : the circular buffer is not being filled.

{int} getMixerType()
Get the mixer type.
Returns:
{int} = The ID of the mixer, 0 = Linear, 1 = RLM D-Fat.

{int} getSoundChannels()
Get the number of sound channels used in this audio buffer.
Returns:
{int} = The number of sound channels used in this buffer (1 = mono, 2 = stereo).

{weasel.AudioBuffer.prototype.SupportedMixerTypes} getSupportedMixerTypes()
Get list of supported mixer type, used for populating a drop down list for user selection.
Returns:
{weasel.AudioBuffer.prototype.SupportedMixerTypes} = The list of supported mixer types.

{long} getWrittenSamples()
Get the number of written samples, which is the number of samples that have left this buffer and been given to the actual audio sub system (the Audio object in most cases). This does not include the samples remaining in this buffer, as they have NOT been passed to the audio sub system yet.
Returns:
{long} = The number of Samples written/passed to the audio sub system.

mix(iSamplesToFill, aSamples1, aSamples2, aSamples3, aSamples4, iCircularBufferOffset, bFilterOn)
Mix sound channels together.
Parameters:
{int} iSamplesToFill
= The number of samples to mix together (ignoring stereo).
{Array} aSamples1
= The rendered samples for channel 1.
{Array} aSamples2
= The rendered samples for channel 2.
{Array} aSamples3
= The rendered samples for channel 3.
{Array} aSamples4
= The rendered samples for channel 4.
{int} iCircularBufferOffset
= The position in the above sample circular buffers.
{bool} bFilterOn
= Mix using the Amiga filter.

mixIn(iSamplesToFill, aSamples, iCircularBufferOffset, iPanningPosition)
Mix sound a channel into the AudioBuffer.
Parameters:
{int} iSamplesToFill
= The number of samples to mix together (ignoring stereo).
{Array} aSamples
= The rendered samples for the channel.
{int} iCircularBufferOffset
= The position in the above sample circular buffers.
{int} iPanningPosition
= The panning position of the sample (0=left, 128 = middle, 255 = right).

{float} panningFT2Left(fPanning)
Fasttracker 2 Panning Law, which is (as far as I can tell) a logarithmic curve - or at least part of the curve with ~2.5db roll off for the center channel.
Parameters:
{float} fPanning
= The panning position -1 = full left, 0 = center, +1 = full right.
Returns:
{float} = The output volume modifier for the left channel (0-1).

{float} panningFT2Right(fPanning)
Fasttracker 2 Panning Law, which is (as far as I can tell) a logarithmic curve - or at least part of the curve with ~2.5db roll off for the center channel.
Parameters:
{float} fPanning
= The panning position -1 = full left, 0 = center, +1 = full right.
Returns:
{float} = The output volume modifier for the right channel (0-1).

{float} panningLawLeft(fPanning)
Panning Law for left channel, reduce the channels sound level the close it gets to the center (so that the sample volume stays approximately the same as it pans from left to right). Typical panning law values are: -3db (considered analogue mixing desk standard) -4.5db -6.0db.
Parameters:
{float} fPanning
= The panning position -1 = full left, 0 = center, +1 = full right.
Deprecated:
Remove upon further investigation for surround sound (5.1).
Returns:
{float} = The output volume modifier for the left channel (0-1).

{float} panningLawRight(fPanning)
Panning Law for right channel, reduce the channels sound level the close it gets to the center (so that the sample volume stays approximately the same as it pans from left to right). Typical panning law values are: -3db (considered analogue mixing desk standard) -4.5db -6.0db.
Parameters:
{float} fPanning
= The panning position -1 = full left, 0 = center, +1 = full right.
Deprecated:
Remove upon further investigation for surround sound (5.1).
Returns:
{float} = The output volume modifier for the right channel (0-1).

removeSamples(lSamplesToRemove)
Inform AudioBuffer that samples were added to the audio sub system and should be removed from this AudioBuffer object.
Parameters:
{long} lSamplesToRemove
= The number of samples passed to the audio sub system (that is the number of samples that can now be removed), this value is in mono (ignore stereo or multiple channels).

{int} samplesToFill()
Get the samples to fill, the number of sample slots available for use within this audio buffer (ignores the number of channels).
Returns:
{int} = Number of sample slots available.

setIgnoreCircularBuffer(bIgnore)
Set Ignore Circular Buffer, which records 1 seconds worth of output, only useful for oscilloscopes and (surprisingly) can be the difference between working and not on slow CPUs.
Parameters:
{bool} bIgnore
= true : Dont fill the circular buffer.

setMixerType(iMixerType)
Set the mixer type.
Parameters:
{int} iMixerType
= The ID of the mixer to use when mixing the 4 sound channels down to 2 stereo channels, 0 = Linear (quick), 1 = RLM D-Fat (slower).

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 05 2018 18:46:30 GMT-0000 (GMT)