Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Paul

Pages: 1 ... 10 11 [12]
166
Paul's Projects / OpenAL for Android
« on: August 09, 2011, 07:15:56 PM »
I decided to take a short breather from my N64 emulator project and finish another project I've been sitting on for a while.  This is my port of native OpenAL to Android with a simple Java interface.  It will basically allow you to add OpenAL to your Android projects without having to play around with c/c++ and JNI.  It should work on all versions of Android back to 1.5.

The Java interface for this port is probably closer to JOAL rather than LWJGL's interface.  There are a few differences from JOAL, however (mainly in the methods that take array/ buffer parameters, the way the context is created and destroyed, and the lack of a direct interface to ALC with device and context objects Java-side).  That being said, code written for JOAL or LWJGL is pretty simple to make work with my interface (it's all OpenAL when you get right down to the nuts and bolts, after all).

Everything is accessed statically through the class paulscode.android.sound.ALAN.  Before creating any sources and what-not, first connect with the Android audio device and create an AL context by calling:
Code: [Select]
ALAN.create();
From there, you can access whatever AL functions you need through ALAN.  For example:
Code: [Select]
        int[] ALBufferIDs = new int[BUFFER_COUNT];
        int[] source = new int[1];
        int[] state = new int[1];
        ALAN.alGenSources( 1, source );
        ALAN.alGenBuffers( BUFFER_COUNT, ALBufferIDs );
        ALAN.alBufferData( ALBufferIDs[i], format, buffer, buffer.length, rate );
        ALAN.alSourceQueueBuffers( source[0], c, ALBufferIDs );
        ALAN.alSourceQueueBuffers( source[0], c, ALBufferIDs );
        ALAN.alSourcePlay( source[0] );
        ALAN.alGetSourcei( source[0], ALAN.AL_SOURCE_STATE, state );
        if( state[0] != ALAN.AL_PLAYING )
            whatever();

And when you're finished, destroy the AL context and disconnect from the Android audio device by calling:
Code: [Select]
ALAN.destroy();
In case you haven't caught on, ALAN isn't a personal name like some AI alias - it's just an abbreviated form of  "OpenAL for Android" (fewer keystrokes than OpenALAndroid).  On a humorous note, I was actually forced to rename a hundred or so references to my project's original title "Android OpenAL", which I was horrified to realize became "ANAL" when abbreviated.  THAT was a real pain in the butt ;D

Anyway, here is a very basic app to demonstrate streaming an .ogg file:
ALAN Demo    (source code)

I normally drop in the source code to my projects, but you should be able to just unzip the above APK file, grab the contents of the "lib" folder, and paste them into your own project's "lib" folder.  If you prefer to compile the source code yourself, you can unzip the source code archive above and either run the following commands from the terminal/command prompt:
Code: [Select]
ndk-build
ant debug
ant install
Or you can "create a new project from source" in Eclipse (requires the Android SDK and NDK to be installed, as well as the ADT plug-in and Sequoyah Android Native Code plugin from the update site plug-ins).  Once you've created the Eclipse project, just right-click on it in the left panel and navigate to "Android Tools->Add Native Support".

The above demo utilizes the Tremolo library for decoding the .ogg file.  It is a popular library for use on Android because it is extra light-weight and optimized for the ARM archetecture, but there are plenty of other decoder libraries out there you could use if you have problems with that one.  In theory, you could even use any of a number of pure-Java audio decoders as well, including the ones included with my SoundSystem library.  I do not recommend copying the code from this demo - it very inefficient and meant only as a proof of concept.

One final note: OpenAL Android is licensed by the LGPL (since that is what OpenAL and Tremolo are licensed under).  While I normally shy away from this license, it actually meshes really well with Android apps, because the end user can use any of a number of free backup programs (such as ASTRO) to create a backup APK of your app.  From there, he can plug in a different version of the library into the APK, and simply reinstall it.  All you have to do is mention somewhere in your documentation where they can acquire the sourcecode for OpenAL Android (feel free to mention my website if you don't want to host the files yourself).  Please let me know if you encounter any bugs (logcat output is always helpful).

167
Announcements / Advertisers, you have been warned!
« on: May 12, 2011, 04:31:06 PM »
Advertising any product or website on this forum will result in immediate banning without notification, not only of the account which posted the ad, but also all other accounts belonging to the perpetrator.  I am very good at metadata analysis, so it will not take me long to discover a pattern and prevent you from ever returning to this forum.  You have been warned!

168
Announcements / I'm not the author of Minecraft
« on: March 01, 2011, 04:20:04 PM »
I've been getting a massive flood of emails asking for help related to a game called "Minecraft".  In case anyone happens to come to this website before sending an email, please note that I am not the author of Minecraft.  The author is using my 3D SoundSystem library for audio, which is why you see my name and email address in the log output.  If you look at the message more closely, you will notice the output actually says:
Quote
SoundSystem shutting down...
Author: Paul Lamb, www.paulscode.com

If you have questions about the SoundSystem, I am happy to help, otherwise please post your questions to the Minecraft forum.

If a developer of Minecraft happens to be reading this, might I suggest giving yourself credit for your work in the log output, and perhaps plug your own website when the program shuts down.  I am happy to receive credit for my own efforts, but I certainly don't want to take credit for other peoples hard work.

169
Paul's Projects / Arabic SATTS Keyboard for Windows XP/2000
« on: October 07, 2010, 07:32:00 PM »
Since there doesn't seem to be any Arabic SATTS keyboard layouts for Windows out on the web (that I can find), I decided to create one myself.  I used the Microsoft Keyboard Layout Creator from Microsoft's website.  I used version 1.3, which creates compatible keyboard layouts for Windows XP and 2000.  It is not as perfect as the real SATTS keyboard, because I didn't know how to type the Arabic numbers or some of the less-common symbols using the standard Arabic keyboard, but it works well enough for anything I would use it for.  If anyone wants to build a better SATTS keyboard, or create a version for Vista or Windows 7, feel free to download the above keyboard layout creator program above and give it a try.  If you need any help, post here and I'll assist if I can.

Download Paul Lambs SATTS keyboard v1

To install, simply unzip the file's contents and run the msi file.  NOTE: won't work on Vista or Windows 7

170
Miscellaneous / Superluminal Communication
« on: January 27, 2010, 07:48:47 PM »
I recently observed the fact that superluminal (faster than light) communication is theoretically possible according to the current laws of quantum mechanics.  It is well known that the laws prove that perfect quantum cloning is an impossibility.  At the same time, however, they also allow the possibility of "imperfect" quantum cloning.  In imperfect cloning, the copied quantum state will not be completely random - it will have some non-unit fidelity to the quantum state being cloned.  In other words there will be some rate of error when cloning a quantum state.  If this theory is true, then it would be possible to create a superluminal communication system.

First, let me define the word "qubit".  I use this term loosely to indicate some measurable quantum state that is either true (1) or false (0).  This could, for example, be "electron is/isn't rotating clockwise around axis A".  Or in the "macro entanglement" experiment I recently read about, it might mean "ion is/isn't oscillating".

Consider the following:  Bob has qubit A, and Bill has qubit B.  The qubits are entangled.  Bob wants to send one bit of information to Bill.  To send a 1, he measures his qubit, causing the states of both A and B to collapse.  To send a 0, he does not measure his qubit, and the states of both A and B remain undetermined.  Then, before measuring his qubit, Bill creates an imperfect clone Bc of quibit B, and then he measures both B and Bc.  If the states of A and B were collapsed by Bob, then the states of B and Bc would both be the same, and Bill would read "1".  If the states of A and B were not collapsed by Bob, then Bill will collapse the states of B and Bc seperately by measuring them, and their states may or may not be the same.  If they are not the same, Bill would read "0".  This could be done numerous times to send a bit stream of audio data, and you'd have a superluminal communication system.

Of course, the received data will be full of errors, because imperfect cloning was used.  But what would it sound like?  Would the message be at all discernible amid the chaos?  To find out, I wrote an applet that simulates the exact type of output that you would receive with a system like this, based on the specified rate of error:

http://www.paulscode.com/source/SuperluminalCom/

You can change the error rate and compare the effect on Morse code, classical music, and the human voice.  You will notice that Morse code really lends itself to this kind of high-error system.  Even at 95% error rate, the signal is still discernible by the human ear!

171
Paul's Projects / Animated GIFs
« on: June 20, 2009, 08:12:21 PM »
-- This slot is reserved for the most recent working releases --



Downloads:

GIFImage Source Code  Version date:  July 7, 2009
The base class for loading information from GIF files.  Supports most versions of the GIF format, including single frame (87a), animated (89a), interleaving, transparent color, LZW compression, and "clr" non-compressed data.

GIFLoader Source Code  Version date:  July 7, 2009
Library for using animated GIFs as textures in jPCT.  Provides methods for loading GIF files into "mosaic textures", animating, checking for current animation frame, and determining the UV coordinates of the current frame.  TODO: add methods for blitting.  This download includes the above GIFImage class.


Demos:

Animated GIF inside an applet  (download the Source Code)
Demonstrates loading and animating a multi-frame GIF image via the GIFImage class.

GIF Box  (download the Source Code)
Demonstrates using animated GIFs as textures in jPCT.


Documentation:

GIFImage and GIFLoader JavaDoc  Version date:  July 7, 2009

172
Paul's Projects / Universe Storage
« on: May 03, 2009, 06:22:13 PM »
-- This slot is reserved for resources, links, and screen shots --


173
Paul's Projects / Map Maker
« on: May 03, 2009, 06:06:59 PM »
-- This slot is reserved for resources, links, and screen shots --



http://www.paulscode.com/games/RobotBuilder/MapMaker/30NOV2008/

174
Paul's Projects / Robot Builder
« on: May 03, 2009, 06:01:37 PM »
-- This slot is reserved for resources, links, and screen shots --

 

Robot Builder 2D  (Unfinished)
My original 2D version of Robot Builder.

3D Robot Viewer
Applet I created to test my 3D robot.


Robot Odyssey  (Wikipedia)
The inspiration for Robot Builder

The Robot Odyssey Resource
AppleWin emulator and Robot Odyssey disk images

175
Paul's Projects / 3D Sound System
« on: May 01, 2009, 08:46:45 PM »
-- This slot is reserved for the most recent working releases --

Downloads:

Sound System  Version date:  January 7, 2012
The core SoundSystem library, independent from 3rd-party libraries.  It is stripped down to the bare essentials, and designed to be easily customizable with various sound library and codec plug-ins.  If memory is a concern (such as in an applet) this may be a good option, because it allows you to choose as many or as few plug-ins as you require for your project.  NOTE: The core SoundSystem library without any plug-ins is only capable of playing MIDI files.  Additional plug-ins should be added for more capabilities.  The source code and license are included in the .zip file.

Sound System jPCT  Version date:  January, 2012
The jPCT-friendly 3D sound library.  The SoundSystemJPCT class overrides the core SoundSystem libray, and provides a number of methods to make adding 3D sound to any jPCT project easy.  It includes methods for binding Listener to Camera and Sources to Object3Ds, as well as using SimpleVector parameters.  SoundSystemJPCT utilizes the LWJGL binding of OpenAL (with JavaSound as a backup option), and the J-Ogg library for .ogg support.  NOTE: The core SoundSystem library, source code, and all relevant licenses are included in the .zip file.

SoundSystem Utils  Version date:  August 9, 2009
Includes a SoundSystem loader, and an example XML file.


Plug-ins:

JavaSound library plug-in  Version date:  January 7, 2012
Interface to the Java Sound API.  More compatible than OpenAL, but not as high quality and fewer features.  This plug-in utilizes JavaSound's panning and volume control methods to simulate an reasonable-quality 3D sound system.  Known bug: quickPlaying sounds will begin playing them at full volume for a split second, before switching to the correct volume.  This is a bug with the Java Sound API itself, and therefore beyond my control to correct.  An easy workaround is to add 0.02 seconds of silence to the beginning of each sound effect (the free Audacity sound editor works well for this).

LWJGL OpenAL library plug-in  Version date:  April 17, 2013
Interface to the LWJGL binding of OpenAL.  The LWJGL library (http://www.lwjgl.org) is required for this plug-in to work.  This library sounds much better than Java Sound, but is not as compatible.  I recommend using the JavaSound library plug-in as a backup option.  NOTE: Please read the included LWJGL license.

JOAL library plug-in  Version date:  April 17, 2013
Interface to the JOAL binding of OpenAL.  The JOAL library (http://jogamp.org) is required for this plug-in to work.  As mentioned previously, this library sounds much better than Java Sound, but is not as compatible.  I recommend using the JavaSound library plug-in as a backup option.  NOTE: Please read the included JOAL license.

WAV codec plug-in  Version date:  October 23, 2010
Adds support for .wav files.

JOgg codec plug-in  Version date:  August 24, 2010
Adds support for .ogg files using the J-Ogg library.  This codec is less compatible than the JOrbis codec, but the license is less restrictive.  Sometimes running incompatable .ogg files through a converter will make them compatable.  NOTE: Please read the included JOgg license.

JOrbis codec plug-in  Version date:  November 23, 2010
Adds support for .ogg files using the JOrbis library.  More compatible than the JOgg codec, but reads data more slowly (it may not be possible to stream more than one file simultaneously when using this codec).  This plug-in is licensed by the LGPL.  NOTE: Please read the included LGPL document.

IBXM codec plug-in  Version date:  August 24, 2010
Adds support for Protracker, Fast Tracker 2, and Scream Tracker 3 (.s2m, .mod, and .xm) files using the IBXM library.  File sizes for these formats tend to be quite small, so this may be a good option for background music.  This plug-in is based on or using the IBXM library, which is bound by the BSD License.  NOTE: Please read the included license document.

JSpeex codec plug-in  Version date:  August 24, 2010
Adds support for .ogg or .wav files encoded with Speex (a compression optimized for human voice).  See http://www.speex.org/ for more information.


Documentation:

JavaDoc  Version date:  November 8, 2011
Also includes the JavaDocs for SoundSystemJPCT and all library and codec plug-ins, and the utils library.

3D Sound with SoundSystem  PDF (download the example programs)
A tutorial-style guide to using the core SoundSystem library (last updated: April 14, 2009).

Guide to SoundSystemJPCT  PDF (download the example programs)
Another tutorial-style guide to using SoundSystemJPCT. (last updated: April 14, 2009).


Demos:


Sound Effects Player  (download the Source Code)
Demonstrates library switching on the fly, streaming background music, playing MIDI, and playing multiple sources simultaneously.  Last updated August 21, 2010

Bullet / Target Collision  (download the Source Code)
Demonstrates the LibraryJavaSound plug-in.  Last updated March 30, 2009

Holy Bouncing Helicopter Balls!  (download the Source Code)
Demonstrates moving through a world with multiple sources.  Last updated August 21, 2010


What's new?

- Fixed raw data stream repeating bug in LibraryLWJGLOpenAL and LibraryJOAL
- Fixed raw data stream millisecond position bug in LibraryLWJGLOpenAL and LibraryJOAL

176
Modelling / How to convert Google Sketchup models to .3ds
« on: May 01, 2009, 08:33:40 PM »
If you have tried to create models for your 3D games, you probably know that many modeling programs out there (like Max) are quite expensive, and have so many features that using them feels like drinking out of a fire hose. One of the simplest modeling programs to use (in my opinion) is Google Sketchup (http://sketchup.google.com/). It doesn't have a lot of the features of some of the other modeling programs available, but it is more than sufficient for most models you will want to create. There is even a "3D Warehouse" full of Sketchup models available for download (http://sketchup.google.com/3dwarehouse/).

Only problem is, the free version does not export your model into a common format (like 3ds). So I figured out a way to do the conversion.

The first important piece of information I found, is that the .kmz file format is actually just a .zip file. If you export your sketchup model to "Google Earth 4 (*.kmz)", you can change the name of your file from filename.kmz to filename.zip and look inside. You will find a model file in there, of the Collada "Digital Asset Exchange" format. It has the extension ".dae".

Once you have your .dae file, you will, of course need a converter to change it to a .3ds file. I found a free converter that will do this for you. It is called the FBX converter tool, on the Autodesk website.

You can download the windows version of the FBX converter from:
http://images.autodesk.com/adsk/files/fbx200611_2_converter_win.exe
The program will install to the following location (unless you specify otherwise):
Program Files\Autodesk\FBX\FBXConverter\2006.11.2\FbxConverterUI.exe

I also saw Mac and Linux versions of the converter (I forgot to grab the links while I was there - you'll have to search the Autodesk site if you aren't running windows).

Now the FBX converter will convert your .dae file into a .fbx file. From there, the FBX converter will let you convert the .fbx file into a .3ds file.

This converter also supports a few other formats, so it could be pretty handy to have around.

Here is the process for converting from .skp to .3ds:

1) Download or create a .skp model in Sketchup
2) In Sketchup, export your model to "Google Earth 4 (*.kmz)
(note: be sure to choose version 4, because the other one is different)
3) Change the extention of the .kmz file to .zip
4) Pull out the .dae file
5) In FBX Converter, convert the .dae file to .fbx
6) In FBX Converter, convert the .fbx file to .3ds

The main problem with this conversion method is that the Autodesk FBX converter is often not able to convert many .dae files (possibly due to large poly counts) :'(.  Fortunately, I found another more complicated method which generally works for cases when the method above doesn't work.  I will outline this other method in my next post.

Another issue I sometimes have when converting models is the materials not being quite right.  When necessary, I use a free program called LithUnwrap (http://www.sharecg.com/v/5169/software-and-tools/LithUnwrap---Free-UV-Mapper-for-Windows) to edit the materials.  Lithunwrap works great for this, but it does have a maximum number or polys it will load, so there are probably better programs out there for editing materials.

I made an applet that loads a .skp model I converted:
http://www.paulscode.com/source/LegoCar/
(Use the mouse to rotate the object)

You can get the source code at:
http://www.paulscode.com/source/LegoCar/LegoCar.java
http://www.paulscode.com/source/LegoCar/LegoCar.3ds
(In this demo applet, the .3ds file needs to be compiled into the jar)

And to show that I actually converted that model, here is the original Sketchup file:
http://www.paulscode.com/source/LegoCar/LegoCar.skp  8)

Pages: 1 ... 10 11 [12]