本文整理汇总了C#中AudioTrack.write方法的典型用法代码示例。如果您正苦于以下问题:C# AudioTrack.write方法的具体用法?C# AudioTrack.write怎么用?C# AudioTrack.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioTrack
的用法示例。
在下文中一共展示了AudioTrack.write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createProgressTone
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static android.media.AudioTrack createProgressTone(android.content.Context context) throws java.io.IOException
private static AudioTrack createProgressTone(Context context)
{
AssetFileDescriptor fd = context.Resources.openRawResourceFd(R.raw.progress_tone);
int length = (int) fd.Length;
AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, SAMPLE_RATE, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, length, AudioTrack.MODE_STATIC);
sbyte[] data = new sbyte[length];
readFileToBytes(fd, data);
audioTrack.write(data, 0, data.Length);
audioTrack.setLoopPoints(0, data.Length / 2, 30);
return audioTrack;
}