极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9287|回复: 0

【教程】Cubieboard变苹果无线airplay音响

[复制链接]
发表于 2014-7-24 21:25:50 | 显示全部楼层 |阅读模式
大家应该知道苹果的airplay技术吧,这个技术是把音乐或视频图像等东西传到和苹果有签约音响或者AppleTV上,今天的一次突发奇想,让我写出了这篇教程。今天我突然想到为什么不能把音响和Cubieboard连接在一起,变成苹果Airplay音响呢?果然,我真搜到了一个程序并且把它改编了一下做成了自己的air服务端程序,现在给大家安装和使用的教程
首先我们需要用到一个叫air的程序,安装方法:
[color=rgb(46, 166, 255) !important]复制代码

这个程序是airplay的第三方服务端程序,是sharport(airiTunes的一个接收软件)改编而成。
安装完后直接输入air命令来启动air程序
此时开苹果设备,你会发现后台的更改音量的那栏多了一个按钮,按下后有个airplay的名字叫TonyAIR,这就是咱们弄airplay的cb了

按下后跳出菜单,选择TonyAIR

然后我打开QQ音乐程序随便点了首歌,没几秒钟音乐就从cb里出来了。

如果觉得TonyAIR这个airplay的名字难听,可以在启动时输入: air (你想要的名字) 来用你自己想要的名字
改音乐输出可以用:http://cn.cubieboard.org/forum.php?mod=viewthread&tid=191里面的方法来调整为板载输出(音乐是上面那个,麦克风是背面的)
如果要真的弄airplay音响,那就必须开机启动这个程序,把air命令添加到/etc/rc.local里就好了(试过可用,不过结尾需要一个“&”号让他后台运行)
经测试,没有任何卡顿现象!另外说下,停止播放时会有几秒延迟。
以下是安装shell的代码,外加注解(文件里没有):
  • #!/bin/bash
  • #强制用bash开,默认的dash兼容上有点问题
  • if [ `whoami` == "root" ] ; then
  • #判断用户是不是root
  • if [ "$1"x == "--install"x ] || [ "$1"x == "-i"x ] ; then
  • #判断输入的第一个参数是不是--install or -i
  • echo "Try to install it"
  • echo ""
  • echo "REFREASHing APT"
  • #三个输出
  • apt-get update
  • apt-get upgrade -y
  • #更新软件源
  • echo "INSTALLing software from APT"
  • apt-get install wget build-essential libssl-dev libcrypt-openssl-rsa-perl libao-dev libio-socket-inet6-perl libwww-perl avahi-utils pkg-config git -y
  • #安装软件
  • echo "copy Perl Plugin from GIT"
  • git clone https://github.com/njh/perl-net-sdp.git /tmp/perlnet
  • #取得一个perl的联网插件
  • echo "Building"
  • cd /tmp/perlnet
  • perl /tmp/perlnet/Build.PL
  • /tmp/perlnet/Build
  • /tmp/perlnet/Build test
  • /tmp/perlnet/Build install
  • #Build和安装程序
  • mkdir /usr/air
  • echo "Downloading File.."
  • wget http://cb.tonylianlong.com/usr/uploads/2013/05/2971708022.zip -O /usr/air/air.zip
  • #从我的服务器下载文件,文件是我编译好的
  • echo "Unzipping"
  • unzip /usr/air/air.zip -d /usr/air
  • #解压文件
  • touch /bin/air
  • echo "#!/bin/bash" > /bin/air
  • echo "if [ \"\$1\"x == \"\"x ]; then" >> /bin/air
  • #判断有没有输入第一个参数
  • echo "/usr/air/start.pl -a TonyAIR" >> /bin/air
  • echo "else" >> /bin/air
  • echo "/usr/air/start.pl -a \$1" >> /bin/air
  • echo "fi" >> /bin/air
  • chmod +x /bin/air
  • #权限
  • echo "OK,filished!"
  • echo ""
  • #创建air程序
  • echo "RE-run this file (or just run \"air\") and not use --install or -i to run Air"
  • else
  • if [ ! -f "/bin/air" ]; then
  • #如果不存在
  • echo "Air is not installed,try to use --install or -i to install it"
  • else
  • /bin/air
  • #启动
  • echo "End!"
  • fi
  • fi
  • else
  • echo "You are not using \"root\" user!"
  • echo "You are using "`whoami`" user!"
  • #输出用户名,并且说不是root
  • fi




原文作者:tll
原文链接:http://forum.cubietech.com/forum ... y%E9%9F%B3%E5%93%8D
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-3-29 07:20 , Processed in 0.044344 second(s), 17 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表