• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in motorola V600 sound

 
madan singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I am getting problem in motorola V600 sound.As for long sound file(6 Sec) it is working but for small size (1 or 2 sec) it not working .Sound formate is Midi-0.

Please help me to solve this issue.

thanks
madan
 
Ramender Mall
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well,
Try posting some portion of your code here for the reference of ranchers here. Your playSound and stopSound method, then it would be more easier for someone to answer that.


- Ramy..
 
madan singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanxs Ramy

Sample code is like

public void playSound(byte idx, boolean loop)
{
try
{
if (soundEnabled)
{
if ( idx == SND_START || idx == SND_SPIN1 || idx == SND_SPIN2 || idx == SND_SPIN3)
{
//play MIDI

if ( player[idx] == null)
initSound(idx);

try
{
if ( (player[idx].getState() != Player.STARTED) && (idx != SND_SPIN1 && idx != SND_SPIN2 && idx != SND_SPIN3))
player[idx].setMediaTime(0);
}
catch (Exception e)
{soundExceps++;}

if ( player[idx].getState() != Player.STARTED && player[idx].getState() != Player.CLOSED )
{
if ( Kernel.inst.canvas.pauseClicked || Kernel.inst.pause)
{
return;
}

player[idx].setLoopCount(loop ? -1 : 1);
player[idx].start();
}
}
else
{
//play WAV
if ( sounds[idx-SND_SPIN3-1] == null || currSoundIdx != idx)
initSound(idx);

if ( Kernel.inst.canvas.pauseClicked || Kernel.inst.pause )
return;

sounds[idx-SND_SPIN3-1].play(loop ? 0 : 1);
}
}
}
catch(Exception e)
{
soundExceps++;
//#ifdef QA
//# System.out.println("Error: playSound " + idx);
//#endif
}
}




and for release

public void releaseSound(byte idx,boolean destroy)
{
if (idx == SND_START || idx == SND_SPIN1 || idx == SND_SPIN2 || idx == SND_SPIN3)
{
//release MIDI
if ( player[idx] != null )
{
if (player[idx].getState() == Player.STARTED )
{
try
{
player[idx].stop();
}
catch (Exception e)
{
soundExceps++;
try{
if (player[idx].getState() != Player.CLOSED)
player[idx].deallocate();
}
catch (Exception e1){
}
player[idx].close();
player[idx] = null;
//#ifdef QA
//# System.out.println("Error: releaseSound");
//#endif
}
if (destroy)
{
try{
if (player[idx].getState() != Player.CLOSED)
player[idx].deallocate();
}
catch (Exception e1){
}
player[idx].close();
player[idx] = null;

}
}
}
}
else
{
if ( sounds[idx-SND_SPIN3-1] != null )
{
if (sounds[idx-SND_SPIN3-1].getState() == Sound.SOUND_PLAYING)
{
sounds[idx-SND_SPIN3-1].stop();
}
sounds[idx-SND_SPIN3-1].release();
sounds[idx-SND_SPIN3-1] = null;
}
}

currSoundIdx = -1;
}




And also what does player.setMediaTime(0)do
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic