Skip to content

Commit

Permalink
Merge pull request blackberry#6 from jhoffmannrim/next
Browse files Browse the repository at this point in the history
update NDK-Samples next to NDK 2.0 Beta 3
  • Loading branch information
jhoffmannrim committed Jan 20, 2012
2 parents 92d8ab4 + bb08f07 commit 38b89ca
Show file tree
Hide file tree
Showing 25 changed files with 1,405 additions and 46 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ AudioControl/arm/o.le-v7-g/AudioControl
AudioControl/arm/o.le-v7/AudioControl
AudioControl/x86/o-g/AudioControl
AudioControl/x86/o/AudioControl
Channels/arm/o.le-v7-g/Channels
Channels/arm/o.le-v7/Channels
Channels/x86/o-g/Channels
CubeRotate/arm/o.le-v7-g/CubeRotate
CubeRotate/arm/o.le-v7/CubeRotate
CubeRotate/x86/o-g/CubeRotate
Expand Down Expand Up @@ -97,3 +100,6 @@ VideoPlayback/arm/o.le-v7-g/VideoPlayback
VideoPlayback/arm/o.le-v7/VideoPlayback
VideoPlayback/x86/o-g/VideoPlayback
VideoPlayback/x86/o/VideoPlayback
VideoWindow/arm/o.le-v7-g/VideoWindow
VideoWindow/arm/o.le-v7/VideoWindow
VideoWindow/x86/o-g/VideoWindow
92 changes: 53 additions & 39 deletions AudioControl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ main(int argc, char *argv[])
bps_initialize();

if (setup_screen() != EXIT_SUCCESS) {
printf("Unable to set up the screen. Exiting.");
fprintf(stderr, "Unable to set up the screen. Exiting.");
bps_shutdown();
return 0;
}

Expand All @@ -119,50 +120,63 @@ main(int argc, char *argv[])
* Navigator service manages and delivers application life cycle and
* visibility events.
* For this sample, we request Navigator events so that we can track when
* the system is terminating the application (NAVIGATOR_EXIT event) as well as
* Audio Mixer events so we can be notified when audio values is updated
* the system is terminating the application (NAVIGATOR_EXIT event) as well
* as Dialog events so we can show a dialog and Audio Mixer events so we can
* be notified when audio values are updated.
*/
navigator_request_events(0);
audiomixer_request_events(0);
dialog_request_events(0);

if (BPS_FAILURE == navigator_request_events(0)) {
fprintf(stderr, "Unable to request navigator events. Exiting.");
cleanup_screen();
bps_shutdown();
return 0;
}
if (BPS_FAILURE == dialog_request_events(0)) {
fprintf(stderr, "Unable to request dialog events. Exiting.");
cleanup_screen();
bps_shutdown();
return 0;
}
/*
* Create and display the dialog.
*/
create_dialog();

/*
* Retrieve and display the current audio mixer status
*/
float headphone_volume;
audiomixer_get_output_level(AUDIOMIXER_OUTPUT_HEADPHONE, &headphone_volume);
float speaker_volume;
audiomixer_get_output_level(AUDIOMIXER_OUTPUT_SPEAKER, &speaker_volume);
float input_gain;
audiomixer_get_input_level(AUDIOMIXER_INPUT, &input_gain);

bool is_headphone_muted;
audiomixer_get_output_mute(AUDIOMIXER_OUTPUT_HEADPHONE, &is_headphone_muted);
bool is_speaker_muted;
audiomixer_get_output_mute(AUDIOMIXER_OUTPUT_SPEAKER, &is_speaker_muted);
bool is_input_muted;
audiomixer_get_input_mute(AUDIOMIXER_INPUT, &is_input_muted);

char tmp[MSG_SIZE];
snprintf(msg, MSG_SIZE, "Audio Mixer Status\n");
snprintf(tmp, MSG_SIZE, "Headphone Volume: %f\n", headphone_volume);
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Speaker Volume: %f\n", speaker_volume);
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Input Gain: %f\n", input_gain);
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Headphone Muted: %s\n", bool_str(is_headphone_muted));
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Speaker Muted: %s\n", bool_str(is_speaker_muted));
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Input Muted: %s\n\n", bool_str(is_input_muted));
strlcat(msg, tmp, MSG_SIZE);
show_dialog_message(msg);
if (BPS_FAILURE == audiomixer_request_events(0)) {
show_dialog_message("Unable to request audio mixer events.");
} else {
/*
* Retrieve and display the current audio mixer status
*/
float headphone_volume;
audiomixer_get_output_level(AUDIOMIXER_OUTPUT_HEADPHONE, &headphone_volume);
float speaker_volume;
audiomixer_get_output_level(AUDIOMIXER_OUTPUT_SPEAKER, &speaker_volume);
float input_gain;
audiomixer_get_input_level(AUDIOMIXER_INPUT, &input_gain);

bool is_headphone_muted;
audiomixer_get_output_mute(AUDIOMIXER_OUTPUT_HEADPHONE, &is_headphone_muted);
bool is_speaker_muted;
audiomixer_get_output_mute(AUDIOMIXER_OUTPUT_SPEAKER, &is_speaker_muted);
bool is_input_muted;
audiomixer_get_input_mute(AUDIOMIXER_INPUT, &is_input_muted);

char tmp[MSG_SIZE];
snprintf(msg, MSG_SIZE, "Audio Mixer Status\n");
snprintf(tmp, MSG_SIZE, "Headphone Volume: %f\n", headphone_volume);
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Speaker Volume: %f\n", speaker_volume);
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Input Gain: %f\n", input_gain);
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Headphone Muted: %s\n", bool_str(is_headphone_muted));
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Speaker Muted: %s\n", bool_str(is_speaker_muted));
strlcat(msg, tmp, MSG_SIZE);
snprintf(tmp, MSG_SIZE, "Input Muted: %s\n\n", bool_str(is_input_muted));
strlcat(msg, tmp, MSG_SIZE);
show_dialog_message(msg);
}

/*
* Process Audio Mixer and Navigator events until we receive a NAVIGATOR_EXIT
Expand Down
179 changes: 179 additions & 0 deletions Channels/.cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>

<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="com.qnx.qcc.toolChain.2124598740">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.2124598740" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.2124598740" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.2124598740.352006086" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.297555076" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.76130292" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.1931122950" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.1326212100" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.726182661" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.1747223826" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder id="com.qnx.qcc.toolChain.2124598740.1639495028" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="com.qnx.qcc.tool.compiler.1461970417" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.includePath.278798242" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.536915679" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.1921399862" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.1321732829" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.351581766" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
<tool id="com.qnx.qcc.tool.archiver.869235712" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.qnx.qcc.toolChain.557690265">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.557690265" moduleId="org.eclipse.cdt.core.settings" name="Device-Debug">
<externalSettings/>
<extensions>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.557690265" name="Device-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.557690265.388570424" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.75998354" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.1874326858" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.1030458870" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.1030003814" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.1366270443" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.1559614187" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder id="com.qnx.qcc.toolChain.557690265.1674217891" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="com.qnx.qcc.tool.compiler.1094930453" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.includePath.1932489235" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1239363662" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.2068988498" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.36475887" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.1208745666" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
<tool id="com.qnx.qcc.tool.archiver.1568287025" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.qnx.qcc.toolChain.922493807">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.922493807" moduleId="org.eclipse.cdt.core.settings" name="Device-Release">
<externalSettings/>
<extensions>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.922493807" name="Device-Release" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.922493807.718680689" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.2117570715" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.1510141013" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.1576465665" name="Target CPU:" superClass="com.qnx.qcc.option.cpu" value="com.qnx.qcc.option.gen.cpu.armle-v7" valueType="enumerated"/>
<option id="com.qnx.qcc.option.compiler.1459101260" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.325341556" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.512607580" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder id="com.qnx.qcc.toolChain.922493807.1420686315" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="com.qnx.qcc.tool.compiler.581894373" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.includePath.854296484" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.902038706" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.1156350308" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.626072260" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.765707219" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
<tool id="com.qnx.qcc.tool.archiver.1656052272" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="com.qnx.qcc.toolChain.2065693308">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.qnx.qcc.toolChain.2065693308" moduleId="org.eclipse.cdt.core.settings" name="Simulator-Debug">
<externalSettings/>
<extensions>
<extension id="com.qnx.tools.ide.qde.core.QDEBynaryParser" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" id="com.qnx.qcc.toolChain.2065693308" name="Simulator-Debug" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="com.qnx.qcc.toolChain.2065693308.2120762762" name="/" resourcePath="">
<toolChain id="com.qnx.qcc.toolChain.1099183171" name="com.qnx.qcc.toolChain" superClass="com.qnx.qcc.toolChain">
<option id="com.qnx.qcc.option.os.1194097270" name="Target OS:" superClass="com.qnx.qcc.option.os"/>
<option id="com.qnx.qcc.option.cpu.1544969817" name="Target CPU:" superClass="com.qnx.qcc.option.cpu"/>
<option id="com.qnx.qcc.option.compiler.553751577" name="Compiler:" superClass="com.qnx.qcc.option.compiler"/>
<option id="com.qnx.qcc.option.runtime.1246873770" name="Runtime:" superClass="com.qnx.qcc.option.runtime"/>
<targetPlatform archList="all" binaryParser="com.qnx.tools.ide.qde.core.QDEBynaryParser" id="com.qnx.qcc.targetPlatform.1284120619" osList="all" superClass="com.qnx.qcc.targetPlatform"/>
<builder id="com.qnx.qcc.toolChain.2065693308.470583494" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="com.qnx.qcc.tool.compiler.1427699051" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
<option id="com.qnx.qcc.option.compiler.includePath.310709821" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
<listOptionValue builtIn="false" value="${QNX_TARGET}/usr/include/freetype2"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/usr/include"/>
</option>
<inputType id="com.qnx.qcc.inputType.compiler.1409512783" superClass="com.qnx.qcc.inputType.compiler"/>
</tool>
<tool id="com.qnx.qcc.tool.assembler.1907699789" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
<inputType id="com.qnx.qcc.inputType.assembler.1764433086" superClass="com.qnx.qcc.inputType.assembler"/>
</tool>
<tool id="com.qnx.qcc.tool.linker.2142192344" name="QCC Linker" superClass="com.qnx.qcc.tool.linker"/>
<tool id="com.qnx.qcc.tool.archiver.1538049504" name="QCC Archiver" superClass="com.qnx.qcc.tool.archiver"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="Channels.null.1533570678" name="Channels"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.2124598740">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.557690265">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.922493807">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="com.qnx.qcc.toolChain.2065693308">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.qnx.tools.ide.qde.managedbuilder.core.qccScannerInfo"/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="com.qnx.tools.ide.qde.core.QNXProjectProperties"/>
<storageModule moduleId="refreshScope"/>
</cproject>
Loading

0 comments on commit 38b89ca

Please sign in to comment.