Log in or register to post comments

Rendering with sound is possible?

October 29, 2010 - 10:25am #1

Hi, there.

I'm trying to use the sound file with redering objects in FrameMarkers.
For example, a snowman is rendering with carrol song.

switch (marker->getMarkerId())
{
case 0:
vertices = &QobjectVertices[0];
normals = &QobjectNormals[0];
indices = &QobjectIndices[0];
texCoords = &QobjectTexCoords[0];
numIndices = NUM_Q_OBJECT_INDEX;
break;
case 1:
vertices = &CobjectVertices[0];
normals = &CobjectNormals[0];
indices = &CobjectIndices[0];
texCoords = &CobjectTexCoords[0];
numIndices = NUM_C_OBJECT_INDEX;
break;
case 2:
vertices = &AobjectVertices[0];
normals = &AobjectNormals[0];
indices = &AobjectIndices[0];
texCoords = &AobjectTexCoords[0];
numIndices = NUM_A_OBJECT_INDEX;
break;
default:
vertices = &RobjectVertices[0];
normals = &RobjectNormals[0];
indices = &RobjectIndices[0];
texCoords = &RobjectTexCoords[0];
numIndices = NUM_R_OBJECT_INDEX;
break;
}

Do i have to add code in this section?
if it's possible, give me some tips, please. :)

Re: Rendering with sound is possible?

October 29, 2010 - 11:09am #3

That's correct, I believe sound must be handled by the Android SDK in Java, not native. You can use the JNI (Java Native Interface) to make calls from native back up to Java to play a sound. We should have a sample application that demonstrates this in the coming weeks.

The code you posted is the point where you could call up to Java to play a sound, depending on which frame marker is visible. It is also the right place to bind your own vertex arrays, etc. depending on what you want to render.

- Kim

Re: Rendering with sound is possible?

October 29, 2010 - 10:41am #2

I think for loading sounds it might be easier to go through the android library (some info here: http://developer.android.com/guide/topics/media/index.html). If you really really want to go through the native code, you could load up some external libraries for C++ that would handle sound but doing it in java would require much less code and be less complicated.

I'm fairly new to C++ and Android development so someone please correct me if my hunch is wrong. :)

--Kenner

Log in or register to post comments