Hi, I had tried to put sound in virtual button as the example given below.
I had no error but the app cannot be run.
This is my code in cpp:
if (strcmp(button.getName(), "red") == 0)
{
playSoundEffect(0);
// Assumptions:
textureIndex = 0;
const Texture* const thisTexture0 = textures[textureIndex];
// Scale 3D model
QCAR::Matrix44F modelViewScaled = modelViewMatrix;
SampleUtils::scalePoseMatrix(kTeapotScale, kTeapotScale, kTeapotScale,
&modelViewScaled.data[0]);
QCAR::Matrix44F modelViewProjectionScaled;
SampleUtils::multiplyMatrix(&projectionMatrix.data[0],
&modelViewScaled.data[0],
&modelViewProjectionScaled.data[0]);
// Render 3D model
glUseProgram(shaderProgramID);
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &teapotVertices[0]);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &teapotNormals[0]);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
(const GLvoid*) &teapotTexCoords[0]);
glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, thisTexture0->mTextureID);
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE,
(GLfloat*)&modelViewProjectionScaled.data[0] );
glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/);
glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT,
(const GLvoid*) &teapotIndices[0]);
break;
}
Hi, I tried the code by Muhammadgyan and it works fine in virtual button . .
When using this sound code, the sound just can play "6 second" of the sound . .
Is that possible to play more than 6 sec of sound? for example 30 second . . .
Thanks