android开机音乐

				版权声明:本文为博主原创文章,未经博主允许不得转载。					https://blog.csdn.net/kris_fei/article/details/70208202				</div>
							            <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-f57960eb32.css">
					<div class="htmledit_views" id="content_views">

Platform: ROCKCHIP

OS: Android 6.0

Kernel: 3.10.92


main ->    bootanimation_main.cpp

    new BootAnimation -> Bootanimation.cpp

        BootAnimation::threadLoop ->

            BootAnimation::playMusic ->

                property_set(“ctl.start”, “startup_rington”); ->    //音频文件存在才会调用.

  

音频文件路径:
/system/media/audio/startup.wav


init进程去启startup_rington service, service的定义如下
rk3288/device/rockchip/common/init.rk30board.rc

//默认禁止,参数表示音频文件隔多久之后开始播放,见后面脚本文件.

service startup_rington /system/bin/tinyplaywav /system/media/audio/startup.wav 3

    class core

    user system

    group graphics audio system

    disabled

    oneshot

    

编译生成:
rk3288/device/rockchip/common/device.mk

PRODUCT_COPY_FILES += <br>
    device/rockchip/common/tinyplaywav:system/bin/tinyplaywav


tinyplaywav其实是个脚本

rk3288/device/rockchip/common/tinyplaywav


[kris@:~/rk3288/device/rockchip/common]$ cat tinyplaywav

#!/system/bin/sh

#LOG_FILE=/data/tinyplaywave.log

# check input
if [ $# -lt 1 ] ; then
#echo “[tinyplaywav] not wav file to play!!” >> $LOG_FILE
exit 1
fi

//wav文件:/system/media/audio/startup.wav
# set parameter
WAV_FILE=$1

//休眠3秒后播放
if [ $# -eq 2 ] ; then
# sleep some time
#echo “[tinyplaywav] sleep $2 s” >> $LOG_FILE
sleep $2
fi

//最终调用的是tinyalsa工具
# play wav file
#echo “[tinyplaywav] start play, wav file is: $WAV_FILE” >> L O G F I L E &lt; / s p a n &gt; / / 先 切 换 到 s p e a k e r t i n y m i x − D 0 &lt; s p a n c l a s s = &quot; h l j s − s t r i n g &quot; &gt; &quot; P l a y b a c k P a t h &quot; &lt; / s p a n &gt; &lt; s p a n c l a s s = &quot; h l j s − s t r i n g &quot; &gt; &quot; S P K &quot; &lt; / s p a n &gt; / / 然 后 播 放 t i n y p l a y &lt; s p a n c l a s s = &quot; h l j s − v a r i a b l e &quot; &gt; LOG_FILE&lt;/span&gt; //先切换到speaker tinymix -D 0 &lt;span class=&quot;hljs-string&quot;&gt;&quot;Playback Path&quot;&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&quot;SPK&quot;&lt;/span&gt; //然后播放 tinyplay &lt;span class=&quot;hljs-variable&quot;&gt; LOGFILE</span>//speakertinymixD0<spanclass="hljsstring">"PlaybackPath"</span><spanclass="hljsstring">"SPK"</span>//tinyplay<spanclass="hljsvariable">WAV_FILE -D 0 -d 0wav文件播放时间可以根据开机动画来决定.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值