c++播放音频( c++ play audio),为C++应用程序添加启动音效

c++播放音频

0、使用的IDE : CLion

1、CMAKE中

cmake_minimum_required(VERSION 3.21)
project(Cpp)

set(CMAKE_CXX_STANDARD 14)

set(CMAKE_EXE_LINKER_FLAGS "-static")

add_executable(cheatMain main.cpp)

# Link to GLFW, GLEW and OpenGL
target_link_libraries(cheatMain PUBLIC
        ${GLFW_LIBRARIES}
        ${GLEW_LIBRARIES}
        ${OPENGL_LIBRARIES}
        winMM.Lib
        )

2、main.cpp中

int main {
PlaySound(TEXT("C:\\Users\\x'x'xxx\\Documents\\GitHub\\xx\\Cpp\\go.wav"),NULL, SND_ASYNC);
}

===================DEBUG的新路历程===============================

 clion

clion 添加link -Winmm.lib

clion undefined reference to `__imp_PlaySoundA'

播放出来的声音是  叮咚,不是我的音频

我的天 

Instead of using relative path Use an absolute path

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Paperback: 116 pages Publisher: Packt Publishing; 1st New edition edition (August 26, 2013) Language: English ISBN-10: 1849699097 ISBN-13: 978-1849699099 Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD library and toolkit. Overview Add audio to your game using FMOD and wrap it in your own code Understand the core concepts of audio programming and work with audio at different levels of abstraction Work with a technology that is widely considered to be the industry standard in audio middleware In Detail Audio plays a fundamental role in video games. From music to sound effects or dialogue, it helps to reinforce the experience, convey the mood, and give feedback to the player. Presently, many games have achieved commercial success by incorporating game sounds that have enhanced the user experience. You can achieve this in your games with the help of the FMOD library. This book provides you with a practical guide to implementing the FMOD toolkit in your games. Getting Started with C++ Audio Programming for Game Developers is a quick and practical introduction to the most important audio programming topics that any game developer is expected to know. Whether you need to play only a few audio files or you intend to design a complex audio simulation, this book will help you get started enhancing your game with audio programs. Getting Started with C++ Audio Programming for Game Developers covers a broad range of topics – from loading and playing audio files to simulating sounds within a virtual environment and implementing interactive sounds that react to events in the game. The book starts off with an explanation of the fundamental audio concepts, after which it proceeds to explain how to use the FMOD Ex library, how to implement a 3D audio simulation, how to use the FMOD Designer toolkit, and how best to work with multi-layered sounds with complex behaviors attached to them. The final part of the book deals with working with audio at a much lower level by manipulating audio data directly. This book will provide you with a good foundation so that you can successfully implement audio into your games and begin pursuing other advanced topics in audio programming with confidence. What you will learn from this book Design complex generative /interactive sounds Simulate an environment with 3D audio and effects Load and play audio files in several formats Control audio playback and many sound parameters Adapt an audio API to fit the needs of a game Approach This book is a standard tutorial targeted at game developers which aims to help them incorporate audio programming techniques to enhance their gameplay experience. Who this book is written for This book is perfect for C++ game developers who have no experience with audio programming and who would like a quick introduction to the most important topics required to integrate audio into a game.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值