npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-bb-nativeaudio

v1.0.1

Published

BlackBerry 10 Community Contributed API to support Low Latency Audio for .WAV files using OpenAL

Downloads

4

Readme

PGLowLatencyAudio Plugin for BlackBerry10, using Cordova.

Plays audio .wav files using openAL, ALUT, Qdir, and QtCore libraries.

For a sample application demonstrating the use of this API, please see the LowLatencySequencer

Version History

1.0.0 Initial Release
1.0.1 Shutsdown audio channels when not in use

Installation

The plugin can be installed from source or NPM using one of the following commands in your Cordova project location:

NPM:

cordova plugin add cordova-plugin-bb-nativeaudio

Source:

cordova plugin add path-to-plugin/PGLowLatencyAudio

To start off, in the directory PGLowLatencyAudio/www contains the API. Every function is called using PGLowLatencyAudio, and we have the follow functions:

preloadAudio: function (data, path, voices, success, fail) {
    exec(success, fail, service, "preloadAudio", { data: data, path: path, voices: voices });
},
unload: function (data, success, fail) {
    exec(success, fail, service, "unload", { data: data });
},
play: function (data, success, fail) {
    exec(success, fail, service, "play", { data: data });
},
stop: function (data, success, fail) {
    exec(success, fail, service, "stop", { data: data });
},
getDuration: function (data, success, fail) {
    exec(success, fail, service, "getDuration", { data: data });
},
loop: function (data, success, fail) {
    exec(success, fail, service, "loop", { data: data });
}

Note: In the exampled below we use the success call back to display messages for debugging purposes. To remove these messages, simply remove 'alert(echoValue)' from the function call, however if you do run into troubles, these call backs should provide useful information to debug. If you wanted you could include a fail function to each of these, for example your fail function could be function(){alert("FAIL")};

Examples:

If in our Cordova Applications www application folder, we have the path assets/sounds, to our sound location we can do the following:


preloadAudio

Preloads an audio file into a buffer so it can be played automatically without loading. Takes in three parameters, the file name, the path to the sounds, and how many unique voices it can have. Voices are how many simultaneous sounds that can be played at once.

Example:

PGLowLatencyAudio.preloadAudio("bounce.wav", "assets/sounds/", 1, 	function(echoValue) {
	alert(echoValue);},
});

unload

Unloads an audio file from the current buffer it holds up. Used to free and allocate space in openAL. Takes in one parameter, file name.

Example:

PGLowLatencyAudio.unload("bounce.wav", function(echoValue) {
	alert(echoValue);
});

play

Plays an audio file using openAL. Takes in one parameter, file name.

Example:

PGLowLatencyAudio.play("bounce.wav", function(echoValue) {
	alert(echoValue);
});   

stop

Stops an audio file from playing or looping. Takes one parameter, file name.

Example:

PGLowLatencyAudio.stop("bounce.wav", function(echoValue) {
	alert(echoValue); 
});

getDuration

Get the duration of a file. Takes one parameter, file name.

Example:

PGLowLatencyAudio.getDuration("bounce.wav", function(duration) {
	if (duration > 6.0) {
		alert(“Greater than 6”);
	} else {
		alert(“Less than 6”);
	} 
});

loop

Loops an audio file indefinitely until either unloaded or stopped. Takes in one parameter, file name.

Example:

PGLowLatencyAudio.loop("background.wav", function(echoValue) {
	alert(echoValue);
});       

The Native portion of the plugin is called using JNEXT.invoke, and inputting either of the following strings, 'load', 'unload', 'play', 'stop', 'loop'.

For more information about how to run and build Cordova applications, refer to: https://github.com/blackberry/cordova-blackberry/tree/master/blackberry10

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.