- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

# JSoundSystem Class Reference

`#include <JSoundSystem.h>`

Collaboration diagram for JSoundSystem:

List of all members.

## Public Member Functions
JMusic * | LoadMusic (const char *fileName)
void | PlayMusic (JMusic *music, bool looping=false)
void | StopMusic (JMusic *music)
void | ResumeMusic (JMusic *music)
JSample * | LoadSample (const char *fileName)
void | PlaySample (JSample *sample)
void | SetVolume (int volume)
## Static Public Member Functions
static JSoundSystem * | GetInstance ()

## Detailed Description

Sound engine for playing sound effects (WAV) and background music (MP3).

## Member Function Documentation

static JSoundSystem* JSoundSystem::GetInstance | ( |  | ) | `[static]`

Get the singleton instance

JMusic* JSoundSystem::LoadMusic | ( | const char * | fileName | ) |

Load music.

Note:
  MP3 is the only supported format for the moment.

Parameters:

  | filename | - Name of the music file.

void JSoundSystem::PlayMusic | ( | JMusic * | music,
|  | bool | looping = `false` |
| ) |  |  |

Delete music from memory.

Parameters:

  | music | - Music to be deleted. Play music.
  | music | - Music to be played.
  | looping | - Play the music in a loop.

void JSoundSystem::StopMusic | ( | JMusic * | music | ) |

Stop playing.

Parameters:

  | music | - Music to be stopped.

void JSoundSystem::ResumeMusic | ( | JMusic * | music | ) |

Resume playing.

Parameters:

  | music | - Music to be resumed.

JSample* JSoundSystem::LoadSample | ( | const char * | fileName | ) |

Load sound effect.

Note:
  WAV sound effect only.

Parameters:

  | fileName | - Sound effect for loading.

void JSoundSystem::PlaySample | ( | JSample * | sample | ) |

Delete sound effect from memory.

Parameters:

  | sample | - Sound to be deleted. Play sound effect.
  | sample | - Sound for playing.

void JSoundSystem::SetVolume | ( | int | volume | ) |

Set volume for audio playback.

Parameters:

  | volume | - New volume.