1 Star 4 Fork 0

pcd / StreamAudioPlayer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

StreamAudioPlayer

介绍

C#实现的超级简单的音频数据流播放库,基于winmm的封装,内置自定义大小的内存缓存。可按照输入采样率播放

支持框架

  • .NetFramework 4.0 以上

支持操作系统

  • WinXP
  • Win7
  • Win8
  • Win10
  • Win11

应用场景

  1. 网络音频实时播放;
  2. pcm原始音频播放。 (暂时不支持MP3等各种音频压缩算法)

如果帮助到你,稍微动动你的小手指,在右上角点个start吧!

软件目录说明

  1. Andwp.AudioPlayer 播放功能库
  • AudioPlayer.cs 播放接口类,外部调用。
  • WaveDeviceInfo.cs 音频播放信息数据体。
  • WinmmInterop.cs 调用winmm的接口封装。
  1. Test 测试程序
  • Main.cs 测试入口,内涵库的使用DEMO。

安装教程

  1. 引用Andwp.AudioPlayer项目(推荐)。
  2. 拷贝Andwp.AudioPlayer项目的代码文件。

使用说明

  1. 选择设备
  string error;
  var listDevice = AudioPlayer.GetDevices(out error); // 获取当前计算机的所有设备
  1. 初始
AudioPlayer player = new AudioPlayer();
const int maxAllowPacket = 1000;  // 传入缓存包数。
player.MaxAllowUnhandleData = maxAllowPacket;
bool initOk = player.Init(1, 9600, 8, (int)selectedId)); // 传入通道数,采样率和采样大小。初始成功返回true。
  1. 播放
player.Play(s, 0, s.Length); // 加入播放数据缓存。播放的数据可以是byte、short、float等类型转换的数组。
                               // 加入缓存失败会返回false。

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
MIT License Copyright (c) 2022 pcd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

C#基于winmm的封装实现的超级简单的音频数据流播放库。 展开 收起
C#
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/andwp/stream-audio-player.git
git@gitee.com:andwp/stream-audio-player.git
andwp
stream-audio-player
StreamAudioPlayer
master

搜索帮助