使用SCO通过蓝牙将音频从PC传输到手机(Android)

时间:2016-05-25 01:50:54

标签: android audio bluetooth

在我的手机上:

// Configure Audio:
BluetoothAudio = (AudioManager)this.GetSystemService(Context.AudioService);
BluetoothAudio.Mode = Mode.InCall;
BluetoothAudio.BluetoothScoOn = true;
BluetoothAudio.StartBluetoothSco();

在我的电脑上:

public byte[] AudioByteData
{
get;
set;
}

public int StreamStartPosition
{
get;
set;
}

public int StreamEndPosition
{
get;
set;
}

public StreamAudio(byte[] AudioData)
{
this.AudioByteData = AudioData;

AudioTimer.Elapsed += AudioTimer_Elapsed;
AudioTimer.Interval = 20;
AudioTimer.Enabled = true;
AudioTimer.Start();
}

private void AudioTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
throw new NotImplementedException();
}

根据我读过的文档,本文:Creating audio applications with Bluetooth作为一个例子,如果您喜欢蓝牙音频,那么在一段时间内发送Byte Chunks就是“流式传输”的方式:

  

在MP3应用程序中,假设设备正在以128 kbit / sec和48 kHz采样频率编码的文件发送MP3流。这意味着每24.0毫秒发送384字节长的MP3音频帧。因此,如果设备只是将周期性定时器设置为24.0毫秒并在定时器到期时发送数据包,则将保持恒定比特率。

我的问题是,有没有比这更好的方法?

0 个答案:

没有答案
相关问题