音频播放:miniAudio 在QT框架使用, 数据源pcm

准备资料:

css 复制代码
1.官网下载对应的miniaudio.h 头文件
2.一段pcm数据数组

使用案例:

cpp 复制代码
#include "mainwindow.h"
#include "ui_mainwindow.h"
#define MINIAUDIO_IMPLEMENTATION
#include "./miniAudio.h"
#include <cstring>

static const unsigned char pcmArray[] = {
0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x00,
0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0xf7, 0xff, 0xfa, 0xff, 0x3d, 0x00, 0x59, 0xff, 0xd2, 0x00,
0x2d, 0xfb, 0xd8, 0xe9, 0x3c, 0xe7, 0x01, 0xcf, 0x72, 0xda, 0x41, 0x34, 0x88, 0x51, 0x08, 0x4e,
0xd2, 0x57, 0x27, 0x54, 0x1b, 0x54, 0x35, 0x54, 0x52, 0x53, 0x1e, 0x53, 0x5f, 0x52, 0xbd, 0x52,
0xf2, 0x50, 0x44, 0x51, 0x90, 0x53, 0x7d, 0x48, 0x23, 0x5f, 0xac, 0x34, 0x9f, 0xae, 0x81, 0x99,
0xc6, 0xac, 0xf8, 0xa1, 0xeb, 0xa6, 0xce, 0xa6, 0x85, 0xa6, 0x9c, 0xa7, 0xc1, 0xa7, 0x87, 0xa8,
0x43, 0xa8, 0xc7, 0xa9, 0x2a, 0xaa, 0xed, 0xa6, 0x89, 0xb2, 0xba, 0x9d, 0x0b, 0xbe, 0xfd, 0x44,
0xb3, 0x63, 0xe8, 0x4d, 0xc4, 0x58, 0x89, 0x54, 0x0a, 0x54, 0xa8, 0x54, 0x84, 0x53, 0x5e, 0x53,
0xa6, 0x52, 0xd8, 0x52, 0xa1, 0x51, 0xaa, 0x50, 0xab, 0x54, 0xfc, 0x48, 0x75, 0x5b, 0xe3, 0x44,
0xb1, 0xbe, 0x04, 0x96, 0xa1, 0xad, 0x24, 0xa3, 0x80, 0xa6, 0xaa, 0xa7, 0xc3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ab, 0xe8, 0xab, 0x41, 0xae, 0x63, 0xa9, 0xe3, 0xb2,
0x2b, 0xaa, 0x1c, 0xa7, 0x22, 0x20, 0xe1, 0x68, 0x01, 0x50, 0x66, 0x56, 0xf8, 0x56, 0xa0, 0x53,
0x52, 0x55, 0xff, 0x53, 0xc9, 0x53, 0x36, 0x53, 0xf2, 0x52, 0xdd, 0x52, 0x41, 0x50, 0x08, 0x55,
0xb9, 0x4c, 0x28, 0x52, 0x97, 0x5b, 0xce, 0xe8, 0xed, 0x95, 0xab, 0xad, 0x5b, 0xa9, 0x4b, 0xa7,
0x4f, 0xab, 0x75, 0xa9, 0xbe, 0xaa, 0x04, 0xab, 0x88, 0xab, 0xea, 0xab, 0xd8, 0xab, 0x92, 0xae,
0x1d, 0xaa, 0x04, 0xb1, 0xc5, 0xae, 0x4f, 0xa0, 0x63, 0x0b, 0x09, 0x68, 0xa7, 0x52, 0x53, 0x54,
0xf9, 0x57, 0x55, 0x53, 0x47, 0x55, 0x17, 0x54, 0xc0, 0x53, 0x49, 0x53, 0xcd, 0x52, 0x0f, 0x53,
0x45, 0x50, 0x4a, 0x54, 0xed, 0x4e, 0x21, 0x4e, 0x90, 0x60, 0x23, 0xfe, 0x6a, 0x98, 0x63, 0xaa,
0xb8, 0xab, 0x84, 0xa6, 0xaf, 0xab, 0xbe, 0xa9, 0xce, 0xaa, 0x40, 0xab, 0xa6, 0xab, 0x31, 0xac,
0xdc, 0xab, 0xa1, 0xae, 0x1f, 0xab, 0xf8, 0xae, 0x9c, 0xb2, 0xdf, 0x9c, 0x22, 0xf6, 0x47, 0x64,
0x79, 0x56, 0x2a, 0x52, 0xdb, 0x58, 0x40, 0x53, 0x25, 0x55, 0x36, 0x54, 0xb0, 0x53, 0x59, 0x53,
0xbb, 0x52, 0x26, 0x53, 0x7e, 0x50, 0x5b, 0x53, 0x04, 0x51, 0x26, 0x4b, 0x61, 0x62, 0x3f, 0x13,
0x7e, 0x9e, 0x74, 0xa6, 0xfa, 0xad, 0x04, 0xa6, 0xca, 0xab, 0x21, 0xaa, 0xda, 0xaa, 0x7d, 0xab,
0xc6, 0xab, 0x74, 0xac, 0x04, 0xac, 0x81, 0xae, 0x52, 0xac, 0x2d, 0xad, 0x3a, 0xb5, 0x9b, 0x9c,
0xab, 0xe1, 0xb1, 0x5c, 0xc4, 0x5a, 0x15, 0x50, 0x50, 0x59, 0x67, 0x53, 0xdd, 0x54, 0x5c, 0x54,
0x9c, 0x53, 0x60, 0x53, 0xa9, 0x52, 0x18, 0x53, 0xd9, 0x50, 0x5a, 0x52, 0xaf, 0x52, 0x63, 0x49,
0xa0, 0x61, 0x28, 0x26, 0x77, 0xa7, 0x44, 0xa2, 0xef, 0xaf, 0xfb, 0xa5, 0xab, 0xab, 0x9d, 0xaa,
0xdc, 0xaa, 0xb4, 0xab, 0xef, 0xab, 0xa8, 0xac, 0x45, 0xac, 0x50, 0xae, 0x60, 0xad, 0x15, 0xac,
0x54, 0xb6, 0xa6, 0x9e, 0x07, 0xd2, 0x66, 0x53, 0xdc, 0x5e, 0xb5, 0x4e, 0x2d, 0x59, 0xba, 0x53,
0x74, 0x54, 0x6e, 0x54, 0x7c, 0x53, 0x53, 0x53, 0x97, 0x52, 0xf1, 0x52, 0x1e, 0x51, 0x86, 0x51,
0xb1, 0x53, 0xc1, 0x48, 0x7b, 0x5f, 0x50, 0x34, 0x2e, 0xb1, 0xba, 0x9e, 0x1d, 0xb1, 0x63, 0xa6,
0x76, 0xab, 0x2d, 0xab, 0xf7, 0xaa, 0xfd, 0xab, 0x25, 0xac, 0xe2, 0xac, 0x9a, 0xac, 0x2f, 0xae,
0x4e, 0xae, 0x6e, 0xab, 0xb0, 0xb6, 0x8d, 0xa1, 0xb4, 0xc4, 0x48, 0x48, 0x3a, 0x62, 0x06, 0x4e,
0xbc, 0x58, 0x36, 0x54, 0x06, 0x54, 0x7c, 0x54, 0x66, 0x53, 0x41, 0x53, 0x85, 0x52, 0xc1, 0x52,
0x65, 0x51, 0xc9, 0x50, 0x57, 0x54, 0xca, 0x48, 0x61, 0x5c, 0x0d, 0x41, 0x5b, 0xbd, 0xe3, 0x9b,
0xd7, 0xb1, 0x22, 0xa7, 0x18, 0xab, 0xc1, 0xab, 0x11, 0xab, 0x3f, 0xac, 0x61, 0xac, 0x15, 0xad,
0xf2, 0xac, 0x10, 0xae, 0x1d, 0xaf, 0x21, 0xab, 0x86, 0xb6, 0xec, 0xa4, 0x54, 0xb9, 0xd4, 0x3b,
0xee, 0x64, 0xbc, 0x4d, 0xf0, 0x57, 0xc3, 0x54, 0x9a, 0x53, 0x81, 0x54, 0x48, 0x53, 0x2c, 0x53,
0x77, 0x52, 0x8d, 0x52, 0xaa, 0x51, 0x2e, 0x50, 0x95, 0x54, 0x75, 0x49, 0xd2, 0x58, 0x6f, 0x4b,
0x96, 0xca, 0x7a, 0x99, 0xdf, 0xb1, 0x4e, 0xa8, 0x9d, 0xaa, 0x57, 0xac, 0x31, 0xab, 0x76, 0xac,
0x96, 0xac, 0x45, 0xad, 0x4a, 0xad, 0xee, 0xad, 0xd1, 0xaf, 0x11, 0xab, 0xd7, 0xb5, 0xc1, 0xa8,
0x6a, 0xaf, 0x05, 0x2e, 0x3f, 0x67, 0x17, 0x4e, 0xdc, 0x56, 0x68, 0x55, 0x20, 0x53, 0x7f, 0x54,
0x30, 0x53, 0x0e, 0x53, 0x68, 0x52, 0x4f, 0x52, 0xda, 0x51, 0xb7, 0x4f, 0x84, 0x54, 0x86, 0x4a,
0x09, 0x55, 0x26, 0x54, 0x8d, 0xd9, 0x33, 0x98, 0x1d, 0xb1, 0xa8, 0xa9, 0x04, 0xaa, 0xe3, 0xac,
0x57, 0xab, 0xa5, 0xac, 0xd6, 0xac, 0x6f, 0xad, 0xa2, 0xad, 0xde, 0xad, 0x4a, 0xb0, 0x74, 0xab,
0xb6, 0xb4, 0xd1, 0xac, 0xf3, 0xa7, 0x58, 0x1e, 0xb2, 0x67, 0xf1, 0x4e, 0x2d, 0x55, 0xd7, 0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x6a, 0x01, 0x3b, 0x01, 0x2f, 0x01, 0x1f, 0x01, 0x0c, 0x01,
0xfa, 0x00, 0xeb, 0x00, 0xdf, 0x00, 0xcf, 0x00, 0xc2, 0x00, 0xb9, 0x00, 0x9d, 0x00, 0xb7, 0x00,
0x64, 0x00, 0x98, 0xff, 0x8c, 0xff, 0xae, 0xff, 0xa4, 0xff, 0xb4, 0xff, 0xba, 0xff, 0xbf, 0xff,
0xc6, 0xff, 0xcb, 0xff, 0xcf, 0xff, 0xd5, 0xff, 0xdb, 0xff, 0xe1, 0xff, 0xe6, 0xff, 0xed, 0xff,
0xed, 0xff,
};
struct AudioData {
    const char* data;
    size_t size;
    size_t currentIndex;
};

void dataCallback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount)
{

    AudioData* audioData = reinterpret_cast<AudioData*>(pDevice->pUserData);

       // 计算每帧的字节数
       size_t bytesPerFrame = pDevice->playback.channels * ma_get_bytes_per_sample(pDevice->playback.format);

       // 计算要拷贝的字节数
       size_t bytesToCopy = frameCount * bytesPerFrame;

       // 检查剩余的 PCM 数据是否足够
       if (audioData->currentIndex + bytesToCopy > audioData->size) {
           bytesToCopy = audioData->size - audioData->currentIndex;  // 不足时只拷贝剩余的部分
       }

       // 拷贝 PCM 数据到输出缓冲区
       std::memcpy(pOutput, audioData->data + audioData->currentIndex, bytesToCopy);

       // 如果 PCM 数据不够,填充剩余部分为0
       if (bytesToCopy < frameCount * bytesPerFrame) {
           std::memset(static_cast<char*>(pOutput) + bytesToCopy, 0, (frameCount * bytesPerFrame) - bytesToCopy);
       }

       // 更新当前读取位置
       audioData->currentIndex += bytesToCopy;
}
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QByteArray pcmData(reinterpret_cast<const char*>(pcmArray), sizeof(pcmArray));
    playPCM(pcmData);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::playPCM(const QByteArray& pcmData)
{
    AudioData audioData = { pcmData.constData(), static_cast<size_t>(pcmData.size()), 0 };
    ma_device_config config = ma_device_config_init(ma_device_type_playback);
    config.playback.format = ma_format_s16;
    config.playback.channels = 1;
    config.sampleRate =16000;
    config.dataCallback = dataCallback;
    config.pUserData = &audioData;

    ma_device device;
    if(ma_device_init(NULL,&config, &device) != MA_SUCCESS)
    {
        return;
    }
    if(ma_device_start(&device) != MA_SUCCESS)
    {
        ma_device_uninit(&device);
        return;
    }
    while (audioData.currentIndex < audioData.size)
    {//循环判断是否可以关闭 音频
        ma_sleep(100);
    }
    ma_device_uninit(&device);
}
相关推荐
测试界的酸菜鱼9 分钟前
Python 大数据展示屏实例
大数据·开发语言·python
晨曦_子画18 分钟前
编程语言之战:AI 之后的 Kotlin 与 Java
android·java·开发语言·人工智能·kotlin
Black_Friend26 分钟前
关于在VS中使用Qt不同版本报错的问题
开发语言·qt
CSUC35 分钟前
【Qt】QTreeView 和 QStandardItemModel的关系
qt
希言JY1 小时前
C字符串 | 字符串处理函数 | 使用 | 原理 | 实现
c语言·开发语言
残月只会敲键盘1 小时前
php代码审计--常见函数整理
开发语言·php
xianwu5431 小时前
反向代理模块
linux·开发语言·网络·git
ktkiko111 小时前
Java中的远程方法调用——RPC详解
java·开发语言·rpc
冷凝女子1 小时前
【QT】海康视频及openCv抓拍正脸接口
qt·opencv·音视频·海康
y5236482 小时前
Javascript监控元素样式变化
开发语言·javascript·ecmascript