mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-22 23:33:04 +01:00
Move ride audio into own namespace
This commit is contained in:
@@ -1375,7 +1375,7 @@ static void window_options_audio_mouseup(rct_window* w, rct_widgetindex widgetIn
|
||||
gConfigSound.ride_music_enabled = !gConfigSound.ride_music_enabled;
|
||||
if (!gConfigSound.ride_music_enabled)
|
||||
{
|
||||
RideAudioStopAllChannels();
|
||||
OpenRCT2::RideAudio::StopAllChannels();
|
||||
}
|
||||
config_save_default();
|
||||
w->Invalidate();
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace OpenRCT2::Audio
|
||||
{
|
||||
StopTitleMusic();
|
||||
StopVehicleSounds();
|
||||
RideAudioStopAllChannels();
|
||||
RideAudio::StopAllChannels();
|
||||
peep_stop_crowd_noise();
|
||||
StopWeatherSound();
|
||||
}
|
||||
@@ -357,7 +357,7 @@ namespace OpenRCT2::Audio
|
||||
{
|
||||
peep_stop_crowd_noise();
|
||||
StopTitleMusic();
|
||||
RideAudioStopAllChannels();
|
||||
RideAudio::StopAllChannels();
|
||||
StopWeatherSound();
|
||||
_currentAudioDevice = -1;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ namespace OpenRCT2::Audio
|
||||
{
|
||||
gGameSoundsOff = true;
|
||||
StopVehicleSounds();
|
||||
RideAudioStopAllChannels();
|
||||
RideAudio::StopAllChannels();
|
||||
peep_stop_crowd_noise();
|
||||
StopWeatherSound();
|
||||
}
|
||||
|
||||
@@ -1785,7 +1785,7 @@ void window_close_construction_windows()
|
||||
*/
|
||||
void window_update_viewport_ride_music()
|
||||
{
|
||||
RideAudioClearAllViewportInstances();
|
||||
OpenRCT2::RideAudio::ClearAllViewportInstances();
|
||||
g_music_tracking_viewport = nullptr;
|
||||
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
|
||||
@@ -2038,7 +2038,7 @@ void Ride::UpdateAll()
|
||||
for (auto& ride : GetRideManager())
|
||||
ride.Update();
|
||||
|
||||
RideUpdateMusicChannels();
|
||||
OpenRCT2::RideAudio::UpdateMusicChannels();
|
||||
}
|
||||
|
||||
std::unique_ptr<TrackDesign> Ride::SaveToTrackDesign() const
|
||||
@@ -2923,7 +2923,7 @@ static void ride_music_update(Ride* ride)
|
||||
sampleRate += 22050;
|
||||
}
|
||||
|
||||
RideUpdateMusicInstance(*ride, rideCoords, sampleRate);
|
||||
OpenRCT2::RideAudio::UpdateMusicInstance(*ride, rideCoords, sampleRate);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Audio;
|
||||
|
||||
namespace OpenRCT2::RideAudio
|
||||
{
|
||||
constexpr uint8_t TUNE_ID_NULL = 0xFF;
|
||||
constexpr size_t MAX_RIDE_MUSIC_CHANNELS = 32;
|
||||
|
||||
/**
|
||||
@@ -160,12 +163,12 @@ struct RideMusicChannel
|
||||
static std::vector<ViewportRideMusicInstance> _musicInstances;
|
||||
static std::vector<RideMusicChannel> _musicChannels;
|
||||
|
||||
void RideAudioStopAllChannels()
|
||||
void StopAllChannels()
|
||||
{
|
||||
_musicChannels.clear();
|
||||
}
|
||||
|
||||
void RideAudioClearAllViewportInstances()
|
||||
void ClearAllViewportInstances()
|
||||
{
|
||||
_musicInstances.clear();
|
||||
}
|
||||
@@ -247,7 +250,7 @@ static void UpdateRideMusicChannelForMusicParams(const ViewportRideMusicInstance
|
||||
/**
|
||||
* Start, update and stop audio channels for each ride music instance that can be heard across all viewports.
|
||||
*/
|
||||
void RideUpdateMusicChannels()
|
||||
void UpdateMusicChannels()
|
||||
{
|
||||
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0)
|
||||
return;
|
||||
@@ -301,7 +304,8 @@ static void RideUpdateMusicPosition(Ride& ride)
|
||||
}
|
||||
}
|
||||
|
||||
static void RideUpdateMusicPosition(Ride& ride, size_t offset, size_t length, int16_t volume, int16_t pan, uint16_t sampleRate)
|
||||
static void RideUpdateMusicPosition(
|
||||
Ride& ride, size_t offset, size_t length, int16_t volume, int16_t pan, uint16_t sampleRate)
|
||||
{
|
||||
if (offset < length)
|
||||
{
|
||||
@@ -369,7 +373,7 @@ static uint8_t CalculateVolume(int32_t pan)
|
||||
/**
|
||||
* Register an instance of audible ride music for this frame at the given coordinates.
|
||||
*/
|
||||
void RideUpdateMusicInstance(Ride& ride, const CoordsXYZ& rideCoords, uint16_t sampleRate)
|
||||
void UpdateMusicInstance(Ride& ride, const CoordsXYZ& rideCoords, uint16_t sampleRate)
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && g_music_tracking_viewport != nullptr)
|
||||
{
|
||||
@@ -420,3 +424,4 @@ void RideUpdateMusicInstance(Ride& ride, const CoordsXYZ& rideCoords, uint16_t s
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace OpenRCT2::RideAudio
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
struct CoordsXYZ;
|
||||
struct Ride;
|
||||
|
||||
constexpr uint8_t TUNE_ID_NULL = 0xFF;
|
||||
|
||||
void RideAudioClearAllViewportInstances();
|
||||
void RideAudioStopAllChannels();
|
||||
void RideUpdateMusicChannels();
|
||||
void RideUpdateMusicInstance(Ride& ride, const CoordsXYZ& rideCoords, uint16_t sampleRate);
|
||||
namespace OpenRCT2::RideAudio
|
||||
{
|
||||
void ClearAllViewportInstances();
|
||||
void StopAllChannels();
|
||||
void UpdateMusicChannels();
|
||||
void UpdateMusicInstance(Ride& ride, const CoordsXYZ& rideCoords, uint16_t sampleRate);
|
||||
} // namespace OpenRCT2::RideAudio
|
||||
|
||||
Reference in New Issue
Block a user