• Post Reply Bookmark Topic Watch Topic
  • New Topic

Beginning Android Games - Audio API

 
Tibor Nagy
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr Zechner,

Using audio in games is very important. Most of the systems handling multiple sounds at the same time (background music, different sound effects) is very hard. In Android it is also a difficult task or the API help to solve it?
 
Mario Zechner
author
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's actually very simple, the two main classes you want to use are called MediaPlayer and SoundPool. The later lets you playback multiple sound effects simultaniously. There are also classes to record audio from the microphone and playback PCM samples directly. Be warned however, Android has a big issue with audio latency (the time span from issueing the command to play a sound effect and the actual playback starting).
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!