5-7 ????? (1)???????? A. ?? - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

5-7 ????? (1)???????? A. ??

Description:

5 7 1 A. Android 1.6 – PowerPoint PPT presentation

Number of Views:56
Avg rating:3.0/5.0
Slides: 14
Provided by: shir145
Category:
Tags: java

less

Transcript and Presenter's Notes

Title: 5-7 ????? (1)???????? A. ??


1
5-7 ?????(1)???????? A. ??
  • ????????????
  • Android 1.6 ?????????
  • Android 2.3.3 ???????? ????????????????????
  • ??????????????????????????????Android????????????
    ????????????

???? ?????????????????????TextToSpeach
??????? ???????????ENGLISH? ?Edit Text
??????????????????????speak??????????
2
C. ??????(1)
  • package jp.yu.speech
  • import android.app.Activity
  • import android.os.Bundle
  • import java.util.
  • import android.speech.tts.
  • import android.speech.tts.TextToSpeech.
  • import android.view.
  • import android.view.View.
  • import android.widget.
  • public class SpeechActivity extends Activity
  • EditText text Button btn TextToSpeech tsp
  • / Called when the activity is first created.
    /
  • _at_Override
  • public void onCreate(Bundle
    savedInstanceState)
  • super.onCreate(savedInstanceState)
  • LinearLayout LL new LinearLayout(this)
  • LL.setOrientation(LinearLayout.VERTICAL)
  • setContentView(LL)
  • text new EditText(this)
    LL.addView(text)

3
??????(2)
  • tsp.setLanguage(Locale.ENGLISH)
  • btn.setOnClickListener(new
    SpeechClickListener())
  • class SpeechClickListener implements
    OnClickListener
  • _at_Override
  • public void onClick(View arg0)
  • String str text.getText().toString()
  • if(str ! null) tsp.speak(str,
    TextToSpeech.QUEUE_FLUSH, null)
  • class SpeechInitListener implements
    OnInitListener
  • _at_Override
  • public void onInit(int arg0)

4
D. ???
  • Edit Text???????
  • ???????
  • Start?????????
  • ??????????

5
(2)???????? A. ????????
  • ??????/????? ????? ???? ????????
  • AAC LC/LTPMP3 ? ? 3GPP(.3gp)
  • NE-AACv1(AAC) ? MPEG-4(.mp4, m4a)
  • HE-AACv2 ? ADTS raw AAC(.aac)
  • (enhanced AAC) ????(Android
    3.1??) ?????(Android 4.0??)
  • ADIF?????
  • MPEG-TS(.ts)Android 3.0??,?????
  • AMR-NB ? ? 3GPP(.3gp)
  • AMR-WB ? ? 3GPP(.3gp)
  • FLAC ? FLAC(.flac) Android 3.1??
  • MP3 ? MP3(.mp3)
  • MIDI ? Type and 1(.mid, .xmf, .mxmf)
  • RTTTL/RTX(.rtttl, .rtx), OTA(.ota),
    iMelody(.imy)
  • Vorbis ? Ogg(.ogg), Matroska(.mkv), Android
    4.0??
  • PCM/WAVE ? WAVE(.wav)

6
B. ??????
  • ??????/????? ??
  • AAC LC/LTPMP3 ????/????,
  • NE-AACv1(AAC) ??160 Kbps, ?????????848 kHz
  • HE-AACv2
  • AMR-NB 4.7512.2 Kbps, ????????? 8 kHz
  • AMR-WB 6.6023.85 Kbps, ????????? 16 kHz
  • FLAC ????/????(??????????), 16 bit ??,
  • ????????? 48kHz, 24 bit ???????????
  • MP3 ????/????, 8320 Kbps(CBR), ???VBR
  • MIDI MIDI Type 0 and 1, DLS Version 1 and 2, XMF,
    Mobile XMF,
  • RTTTL/RTX, OTA, iMelody
  • PCM/WAVE 8 and 16 bit linear PCM

7
C. ????
  • ?????????????4.0???????

???? ? ?res????????raw??????????? ? ???????raw????
?????????????music1.mp3???? ? ?????????????R.raw.?
?????????????R.raw.music???????
8
D. ????(??1)
  • Res??????raw????????

? ?res???????
? ???????????????????
9
????(??2)
  • ???????raw?????????????????

10
????(??3)
  • ?????????raw????????????

??????????????
????????????????? ????OK?????????
11
E. ?????
  • ?android.media.MediaPlayer ????
  • static MediaPlayer create ???????????????
  • (Content cn, int id) ????????
  • void prepare() ???????????
  • void start() ????
  • void pause() ??????
  • void stop() ????
  • void seekTo(int m) ????????
  • void release() ??????
  • void setOnCompletionListener ???????????????
  • (MediaPlayer.OnCompletionListener l) l
    ??????????
  • void onCompletion(MediaPlayer mp) ???????????????

??????????????????????,????????????????????????,??
???????????????? ??????????????????????????
12
C. ??????(1)
  • package jp.sound
  • import android.app.Activity
  • import android.content.Context
  • import android.graphics.Canvas
  • import android.graphics.Color
  • import android.graphics.Paint
  • import android.media.MediaPlayer
  • import android.os.Bundle
  • import android.view.MotionEvent
  • import android.view.View
  • import android.view.Window
  • public class SoundActivity extends Activity
  • private MediaPlayerView view private
    MediaPlayer player
  • / Called when the activity is first
    created. /
  • _at_Override
  • public void onCreate(Bundle
    savedInstanceState)
  • super.onCreate(savedInstanceState)
  • requestWindowFeature(Window.FEATURE_NO_TIT
    LE)
  • view new MediaPlayerView(this)

13
??????(2)
  • public boolean onTouchEvent(MotionEvent event)
  • if(event.getAction()MotionEvent.ACTION_DOWN)
  • if(playernull)playSound()
  • else stopSound()
  • return true
  • public void playSound()
  • try
  • stopSound()
  • playerMediaPlayer.create(getBaseContext(),
    R.raw.music1)
  • player.seekTo(0)
  • player.start()
  • player.setOnCompletionListener(this)
  • catch(Exception e)
  • public void stopSound()
  • try
  • if(player null) return
Write a Comment
User Comments (0)
About PowerShow.com