Two simple sound Engines

Source: Internet
Author: User

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

  Licensing


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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.