The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
Loading...
Searching...
No Matches
SoundEffects Class Reference

Utility class for handling sound effects and music in the game. More...

#include <sound_effects.hpp>

Static Public Member Functions

static void change_music_track (Mix_Music *music_file, int fade_out_duration=500, int fade_in_duration=500, int volume=MIX_MAX_VOLUME/3)
 Changes background music with fade effect.
 

Detailed Description

Utility class for handling sound effects and music in the game.

This class provides static methods for controlling audio playback, including background music transitions with fade effects.

Member Function Documentation

◆ change_music_track()

void SoundEffects::change_music_track ( Mix_Music * music_file,
int fade_out_duration = 500,
int fade_in_duration = 500,
int volume = MIX_MAX_VOLUME / 3 )
static

Changes background music with fade effect.

Parameters
music_fileThe new music track to play
fade_out_durationDuration of fade out in milliseconds
fade_in_durationDuration of fade in in milliseconds
volumeVolume level (0-128)

This function smoothly transitions from the current music track to a new one by fading out the current track, then fading in the new one. It also sets the volume level of the new track.

Parameters
music_fileThe new music track to play
fade_out_durationDuration of fade out in milliseconds
fade_in_durationDuration of fade in in milliseconds
volumeVolume level (0-128)

The documentation for this class was generated from the following files: