SDL_mixer | audio mixer that supports various file formats | Audio Utils library
kandi X-RAY | SDL_mixer Summary
kandi X-RAY | SDL_mixer Summary
the latest version of this library is available from: due to popular demand, here is a simple multi-channel audio mixer. it supports 8 channels of 16 bit stereo audio, plus a single channel of music. see the header file sdl_mixer.h and the examples playwave.c and playmus.c for documentation on this mixer library. the mixer can currently load microsoft wave files and creative labs voc files as audio samples, it can load flac files with libflac, it can load ogg vorbis files with ogg vorbis or tremor libraries, it can load mp3 files using mpg123 or libmad, and it can load midi files with timidity, fluidsynth, and natively on windows, mac osx, and linux, and finally it can load the following file formats via modplug or mikmod: .mod .s3m .it .xm. tremor decoding is disabled by default; you can enable it by passing --enable-music-ogg-tremor to configure, or by defining music_ogg and ogg_use_tremor. libmad decoding is disabled by default; you can enable it by passing --enable-music-mp3-mad to configure, or by defining music_mp3_mad vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv warning: the license for libmad is gpl,
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SDL_mixer
SDL_mixer Key Features
SDL_mixer Examples and Code Snippets
Community Discussions
Trending Discussions on SDL_mixer
QUESTION
I am trying to figure out how to use SDL2 on VSCODE. I've got basic code and windows working but when I add additional functions and files, it doesn't seem to want to compile. I'm new to this but I thought I included the necessary things in my headers and in my build.
For the main
...ANSWER
Answered 2022-Jan-02 at 22:08You can use g++
to build your program in two ways:
In two stages, first by compiling the individual
.cpp
files as translation units to object files.o
and then in another invocation ofg++
to link them together into an executableOr you can use a single invocation of
g++
to compile and link the executable.
You are currently trying to mix the two modes somehow. For the single-invocation build you should call g++
only once and add all .cpp
files to it:
QUESTION
There are a lot of libraries' packages which do not provide a CMake config file, and in order to find and use them with cmake, one would have to resort to using a FindPackage.cmake
script. Some scripts (i.e. SDL) are available within the cmake itself, so finding a package is relatively easy.
Though in my case, SDL-searching scripts (SDL, SDL_image, SDL_mixer) are available almost since the dawn of modern cmake (at least 3.1), they do not provide the means for the modern approach - they do not define imported cmake Targets. SDL as a target is available only since 3.19, and it does not define IMPORTED_LOCATION
property.
So, the logical thing is to define those targets and properties.
A naive approach would possibly be to just copy the contents of FindSDL.cmake
from a newer cmake bundle and paste it with modifications.
But I would like to keep those files from a cmake bundle (or another good enough script from external source) intact and just wrap them.
So, the main CMakeLists.txt
would be like:
ANSWER
Answered 2021-Nov-14 at 20:04The first thing that comes to mind is to delete the current path from CMAKE_MODULE_PATH
before calling find_package()
, and then restore it.
QUESTION
When running the code import pygame.mixer
(or anything else that refers to pygame.mixer) on a 2021 M1 MacBook Air after running the command python3
, I receive the error ModuleNotFoundError: No module named 'pygame.mixer'
.
What I've tried: reinstalling sdl_mixer, reinstalling sdl2_mixer after editing as per https://github.com/veandco/go-sdl2/issues/299#issuecomment-611681191, reinstalling Pygame after doing that, running the installation of Python at /usr/bin/python3
and trying the command there, and removing and reinstalling sdl2_mixer normally.
ANSWER
Answered 2021-Aug-21 at 22:16I believe the solution is to build pygame from source directly, using the latest pygame version from Github.
See this recent pull request: https://github.com/pygame/pygame/pull/2636
These steps should work (drawn from https://www.pygame.org/wiki/MacCompile)
- install homebrew if it isn't already installed
- brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf
- brew install Caskroom/cask/xquartz
- python3 -m pip install git+https://github.com/pygame/pygame.git
QUESTION
I'm writing some simple test audio code to make sure SDL_mixer works for my application, but in the code to change the volume when given certain characters from std::cin everything works except for subtracting 10 from the volume. Adding 10 works, subtracting 1 works, but subtracting 10 only subtracts 1 and not 10.
In the code below, the variable sound
is a struct containing 2 maps called mus
and eff
, indexed by strings and containing Mix_Music*
and Mix_Chunk
variables respectively. "Moon Patrol" is my music audio and "Pew" is my test effect audio. Also, sorry about the big if/else statement, I'm going to be using GLUT keys for input in the actual program.
Relevant Code:
...ANSWER
Answered 2021-Apr-23 at 19:59The ternary operator works like this:
variable = (condition) ? expressionTrue : expressionFalse;
QUESTION
I'm making some SDL2 wrappers in C++. Like this:
...ANSWER
Answered 2021-Jan-28 at 18:12It seems that Mix_Music
is an incomplete type and the correct way to free a Mix_Music
object is to call the Mix_FreeMusic
function. You cannot dispose of it the way you would a C++ object, namely by using delete
. delete
would attempt to call the destructor (which cannot be done in this context, since the type is incomplete here) and would assume that the object was allocated by new
and return the memory to the same pool where new
got it from. The way SDL allocates the object is an implementation detail, so you must let SDL deallocate the object itself as well, to ensure it is done properly.
std::unique_ptr
can be used for this purpose, but requires a custom deleter. The default deleter will call delete
, which should not be done here. The error you are seeing is because delete p;
is ill-formed (where p
has type Mix_Music*
) because of the incompleteness. You must ensure that the custom deleter calls Mix_FreeMusic
. You can see how to use custom deleters here: How do I use a custom deleter with a std::unique_ptr member?
QUESTION
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Eli Heist\AppData\Local\Temp\pip-install-fjf50xi9\pygame\
this is the full process
...ANSWER
Answered 2021-Jan-25 at 09:41I am not sure how this problem can be solved but I will try to help.
Try the following things:
- Don't install it for that specific project. Try to just go to cmd and install it for your whole python env.
- Make sure python is properly installed in the PATH variable.
- Try to use
py -m pip install -U pygame --user
instead. If that doesn't work, trypython3 -m pip install -U pygame --user
.
If you are using python 3.8 and/or none of the above methods work, you have two options: either revert to python 3.7 or wait for pygame to get updated. Pygame is known to function improperly in python 3.8. I had faced the same issue and I solved it by switching to python 3.7 for pygame projects and the latest version for other python projects.
QUESTION
I am trying to create an interface for my program using SDL2. The problem is that when I include my .h file, the compiler can't find the .cpp even tough I linked everything. None of the methods I found on the internet work and when compiling in visual studio, the code works perfectly fine. What is more strange is that when I try to make my classes inherit from others, I get the same error from the parent class. I am also using the latest version of Ubuntu. Furthermore, I installed all the libraries required for SDL2. This is the error:
...ANSWER
Answered 2020-Dec-17 at 10:54Because renderer
is static, you also need to declare it in the .cpp file.
Add it to interface.cpp, for example under #include "interface.h"
:
QUESTION
I've been working on my own lib for 3D audio using SDL2_Mixer and DSPFilters by Vinne Falco. Currently i'm at the stage where i need to create custom DSP to filter audio, while SDL_mixer takes care of the registering of the effects, the actual DSP is proving difficult.
SDL provides:
...ANSWER
Answered 2020-Jul-25 at 13:01I'm pretty sure len is in bytes, not in float elements. You could use len/sizeof(float). – keltar
This was the answer provided by keltar, which fixes the access violation. (It was provided on a seperate streamlined question)
QUESTION
I've coded a simple sequencer in C with SDL 1.2 and SDL_mixer(to play .wav file). It works well and I want to add some audio synthesis to this program. I've look up the and I found this sinewave code using SDL2(https://github.com/lundstroem/synth-samples-sdl2/blob/master/src/synth_samples_sdl2_2.c)
Here's how the sinewave is coded in the program:
...ANSWER
Answered 2020-Jun-09 at 21:03You’d replace the sin
function call with call to one of the following:
QUESTION
I'm trying to use sdl on ubuntu. According to this instruction(https://gist.github.com/BoredBored/3187339a99f7786c25075d4d9c80fad5) i installed sdl2, sdl image and sdl mixer. Now I have to link them while building. Example how should I do it below.
...ANSWER
Answered 2020-May-18 at 09:12EDIT added the full CMAKE
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SDL_mixer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page