Absolutely lightweight sound engine, Audiere, supports cross-platform, can go
Http://sourceforge.net/projects/audiere/Download and give a small example, ^_^
Use VC6 or another project to configure. just create a console program.
# Include <iostream>
Using namespace std;
# Include "audiere. h"
Audiere: AudioDevicePtr device (audiere: OpenDevice ());
Audiere: OutputStreamPtr stream (audiere: OpenSound (device, "music.wav", false ));
Int main ()
{
Stream-> setRepeat (true );
Stream-> setVolume (0.5f); // 50% volume
Stream-> play ();
Int;
Cin>;
Return 0;
}
Simple and efficient cross-platform sound library Bass!
Platform: Win32, OSX
Current version: 2.4.6
The last time I introduced you to a very small audio database audiere, I will introduce you to a very useful sound database Bass;
The Bass Library is a cross-platform audio library. Currently, there are two versions: Windows and Mac. You can download the corresponding version on his official website.
The usage of this library is very simple. The following is a console code. From setting to calling an implementation, you can not only use it to add sound effects to your game, you can also use it as your own Mp3 player.
# Include
Using namespace std;
# Include "bass. h"
# Pragma comment (lib, "bass. lib ")
Int main ()
{
HSTREAM TestSound [4] = {0 };
// BASS_Init (enable device-1 to indicate default, sampling rate, effect parameter, window handle, 0 to use default data to initialize DirectSound)
: BASS_Init (-1, 44100, 0, 0, 0 );
// BASS_StreamCreateFile (whether to load from memory, file path, start position, end position, and flag position)
TestSound [0] =: BASS_StreamCreateFile (FALSE, "If Alibaba Cloud Explorer", 0, 0, BASS_SAMPLE_LOOP );
TestSound [1] =: BASS_StreamCreateFile (FALSE, "Battle .wav", 0, 0, BASS_SAMPLE_LOOP );
: BASS_SetVolume (0.3f );
If (NULL = TestSound [0]) // specify if the cloud explorer is"
: BASS_ChannelPlay (TestSound [0], true );
Getchar ();
: BASS_Free ();
Return 0;
}
You can use: BASS_ChannelStop (TestSound [I]); to pause the function.