Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Commit

Permalink
Simple Audio Player
Browse files Browse the repository at this point in the history
This sample shows the use of a dropdown to select custom sounds to play
in an application.
  • Loading branch information
BlackScorpion3 committed Jan 13, 2013
1 parent 2854708 commit fdd476c
Show file tree
Hide file tree
Showing 22 changed files with 681 additions and 0 deletions.
193 changes: 193 additions & 0 deletions AudioPlayer/.cproject

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions AudioPlayer/.project
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Template_Test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>Device-Debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>Device-Debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>com.rim.tad.tools.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.rim.tad.tools.qml.core.qmlFileBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.qnx.tools.bbt.xml.core.bbtXMLValidationBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.rim.tad.tools.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>com.qnx.tools.ide.bbt.core.bbtnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>com.rim.tad.tools.qml.core.qmlNature</nature>
</natures>
</projectDescription>
33 changes: 33 additions & 0 deletions AudioPlayer/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,33 @@
eclipse.preferences.version=1
environment/project/com.qnx.qcc.toolChain.153361029/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.153361029/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.153361029/CPULIST/value=x86
environment/project/com.qnx.qcc.toolChain.153361029/VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.153361029/VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.153361029/VARIANTLIST/value=g
environment/project/com.qnx.qcc.toolChain.153361029/append=true
environment/project/com.qnx.qcc.toolChain.153361029/appendContributed=true
environment/project/com.qnx.qcc.toolChain.222246400/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.222246400/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.222246400/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.222246400/EXCLUDE_VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.222246400/EXCLUDE_VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.222246400/EXCLUDE_VARIANTLIST/value=r
environment/project/com.qnx.qcc.toolChain.222246400/append=true
environment/project/com.qnx.qcc.toolChain.222246400/appendContributed=true
environment/project/com.qnx.qcc.toolChain.410036280/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.410036280/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.410036280/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.410036280/VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.410036280/VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.410036280/VARIANTLIST/value=g
environment/project/com.qnx.qcc.toolChain.410036280/append=true
environment/project/com.qnx.qcc.toolChain.410036280/appendContributed=true
environment/project/com.qnx.qcc.toolChain.482438370/CPULIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.482438370/CPULIST/operation=append
environment/project/com.qnx.qcc.toolChain.482438370/CPULIST/value=arm
environment/project/com.qnx.qcc.toolChain.482438370/EXCLUDE_VARIANTLIST/delimiter=,
environment/project/com.qnx.qcc.toolChain.482438370/EXCLUDE_VARIANTLIST/operation=append
environment/project/com.qnx.qcc.toolChain.482438370/EXCLUDE_VARIANTLIST/value=p
environment/project/com.qnx.qcc.toolChain.482438370/append=true
environment/project/com.qnx.qcc.toolChain.482438370/appendContributed=true
6 changes: 6 additions & 0 deletions AudioPlayer/Makefile
@@ -0,0 +1,6 @@
QMAKE_TARGET = Template_Test
PROJECT_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
I18N_DIR := $(PROJECT_DIR)/translations

include mk/cs-base.mk

37 changes: 37 additions & 0 deletions AudioPlayer/README.md
@@ -0,0 +1,37 @@
Audio Player
Create a dropdown list to play audio sounds from within your applications.

Sample Description:
This sample demonstrates how to use a dropdown to play your own custom sounds within a BlackBerry Cascades application.



Multiple dialogsRequirements:
BlackBerry Native SDK for BlackBerry 10.0.9 or later
One of the following:
BlackBerry Alpha Device
BlackBerry Alpha Device Simulator
Importing a project into the Native SDK:
From the the Sample apps page, download and extract the sample application.
Launch the Native SDK.
On the File menu, click Import.
Expand General, and select Existing Projects into Workspace. Click Next.
Browse to the location where you extracted the sample app, and click OK. The sample project should display in the the Projects section.
Click Finish to import the project into your workspace.
Requirements:

BlackBerry 10 Native SDK Beta

Running the example:

Download the sample from http://github.com/blackberry.
Launch BlackBerry 10 Native SDK Beta, and from the File menu, select Import.
Expand General, and select Existing Projects into Workspace. Click Next.
Browse to the location where you extracted the sample file, and then click OK.
The sample project should display in the the Projects section. Click Finish to import the project into your workspace.
In the Project Explorer pane, Right-click the the project (for example hellocascades) and select Build Project.
In the Project Explorer pane, Right-click the the project (for example hellocascades) and select Run As > BlackBerry C/C++ Application.
The application will now install and launch on your device if not you might have to set up your environment: http://developer.blackberry.com/cascades/documentation/getting_started/setting_up.html

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.

8 changes: 8 additions & 0 deletions AudioPlayer/Template_Test.pro
@@ -0,0 +1,8 @@
APP_NAME = Template_Test

CONFIG += qt warn_on cascades10


LIBS += -lbbmultimedia

include(config.pri)
Binary file added AudioPlayer/assets/images/pause_btn1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AudioPlayer/assets/images/play_btn1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AudioPlayer/assets/images/stop_btn1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions AudioPlayer/assets/main.qml
@@ -0,0 +1,85 @@
// Default empty project template
import bb.cascades 1.0
//Media Player control Import
import bb.multimedia 1.0

// creates one page with a label
Page {
//Attached Objects
attachedObjects: [

MediaPlayer {
//ID of media player
id: myPlayer
//Source of where your media is selected from
//We will use a drop down for this
sourceUrl: soundSelectorDropdown.selectedValue


}
]
//Main Container
Container {
//Container for dropdown
Container {
layout: StackLayout {
orientation: LayoutOrientation.TopToBottom
}
//Center all components on page
horizontalAlignment: HorizontalAlignment.Center
//Create our drop down to hold selections
DropDown {
id: soundSelectorDropdown //Id that goes in sourceURL
title: "Sounds"
//Next Create List of sounds
Option {
text : "Fan 1"
description : "" //This is optional component
value : "asset:///music/fan1.wav" //Where the file located
}
Option {
text : "Fan 2"
description : ""
value : "asset:///music/fan2.wav"
}
} //End Drop Down
}//End Drop Down Container

//Media Player Controls
Container {
//We want these side by side
//So we use a stacklayout orientation left to right
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
horizontalAlignment: HorizontalAlignment.Center
topPadding: 20.0 //Added to give some space
ImageButton {//Play Button
id: systemSoundPlayButton //
defaultImageSource: "images/play_btn1.png" //Source where image button is
onClicked: {
myPlayer.play() //Calls our media player and gives command of Play
}
minHeight: 100.0
} // End Play Button
ImageButton { //Pause Button
id: customSoundPlayButton2
defaultImageSource: "images/pause_btn1.png" //Source where image button is
onClicked: {
myPlayer.pause() //Calls our media player and gives command of Pause
}
minHeight: 100.0
}//End Pause Button
ImageButton {
id: customSoundPlayButton3
defaultImageSource: "images/stop_btn1.png" //Source where image button is
onClicked: {
myPlayer.stop() //Calls our media player and gives command of Pause
}
minHeight: 100.0
} //End Stop Button

}//End Media Player Controls Container
} //End Main Container
}

Binary file added AudioPlayer/assets/music/fan1.wav
Binary file not shown.
Binary file added AudioPlayer/assets/music/fan2.wav
Binary file not shown.
102 changes: 102 additions & 0 deletions AudioPlayer/bar-descriptor.xml
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--
Copyright (c) 2011, 2012 Research In Motion Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">

<!-- BlackBerry Tablet OS application descriptor file.
Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
-->

<!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.example.Template_Test</id>

<!-- The name that is displayed in the BlackBerry Tablet OS application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<name>Template_Test</name>

<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required. -->
<versionNumber>1.0.0</versionNumber>

<!-- Fourth digit segment of the package version. First three segments are taken from the
<versionNumber> element. Must be an integer from 0 to 2^16-1 -->
<buildId>1</buildId>

<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
<!-- <versionLabel></versionLabel> -->

<!-- Description, displayed in the BlackBerry Tablet OS application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
<description>The Template_Test application</description>

<!-- Copyright information. Optional. -->
<!-- <copyright></copyright> -->

<!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
<author>Example Inc.</author>

<!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
<!-- <authorId>ABC1234YjsnUk235h</authorId> -->

<initialWindow>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
</initialWindow>

<!-- The category where the application appears. Either core.games or core.media. -->
<category>core.games</category>
<configuration name="Device-Debug">
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm/o.le-v7-g/Template_Test" entry="true" type="Qnx/Elf">Template_Test</asset>
</configuration>
<configuration name="Device-Release">
<entryPointType>Qnx/Cascades</entryPointType>
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm/o.le-v7/Template_Test.so" entry="true" type="Qnx/Elf">Template_Test.so</asset>
</configuration>
<configuration name="Device-Profile">
<platformArchitecture>armle-v7</platformArchitecture>
<asset path="arm-p/o.le-v7-g/Template_Test" entry="true" type="Qnx/Elf">Template_Test</asset>
</configuration>
<configuration name="Simulator-Debug">
<platformArchitecture>x86</platformArchitecture>
<asset path="x86/o-g/Template_Test" entry="true" type="Qnx/Elf">Template_Test</asset>
</configuration>

<!-- The icon for the application, which should be 86x86. -->
<icon>
<image>icon.png</image>
</icon>

<asset path="icon.png">icon.png</asset>
<asset path="assets">assets</asset>

<!-- Locale support -->
<asset path="translations" dest="qm">
<include name="*.qm"/>
</asset>

<!-- Request permission to execute native code. Required for native applications. -->
<permission system="true">run_native</permission>
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>

</qnx>

0 comments on commit fdd476c

Please sign in to comment.