11class DynamicMusicLocationShape
27 vector min =
Vector(origin[0] - size, origin[1], origin[2] - size);
28 vector max =
Vector(origin[0] + size, origin[1], origin[2] + size);
34class DynamicMusicPlayerSettings
47 int m_Shape = DynamicMusicLocationShape.BOX;
61class DynamicMusicPlayerTrackHistoryLookupType
83 #ifdef DMP_DEBUG_SETTINGS
106 protected int m_ActualTimeOfDay
120 private int m_RequestedPlaybackMode
259 #ifdef DIAG_DEVELOPER
262 DisplayDebugStats(
true);
263 DisplayStaticLocations(
true);
291 int id = caller.GetID();
292 if (!m_LocationsDynamic.Contains(
id))
296 location.
m_Type = locationType;
297 location.
m_Min = minMax[0];
298 location.
m_Max = minMax[1];
299 m_LocationsDynamic.Insert(
id, location);
305 m_LocationsDynamic.Remove(caller.GetID());
389 m_RequestedPlaybackMode = value;
401 #ifdef ENABLE_LOGGING
402 DMPDebugPrint(
string.Format(
403 "OnCategorySet() - category: %1, forced: %2",
414 #ifdef ENABLE_LOGGING
416 DMPDebugPrint(
string.Format(
"Track END - %1",
m_CurrentTrack.m_SoundSet));
427 #ifdef ENABLE_LOGGING
429 DMPDebugPrint(
string.Format(
"Track STOP - %1",
m_CurrentTrack.m_SoundSet));
445 #ifdef ENABLE_LOGGING
446 DMPDebugPrint(
string.Format(
447 "WaitTime set to %1s, deferring playback of \"%2\"",
453 #ifdef DIAG_DEVELOPER
454 m_DebugWaitTime = waitTime;
462 #ifdef ENABLE_LOGGING
463 string messagePriority;
464 if (isPriorityLocation)
465 messagePriority =
"(with priority)";
466 DMPDebugPrint(
string.Format(
"Location matched %1", messagePriority));
472 if (isPriorityLocation)
474 playbackData.
m_Forced = isPriorityLocation;
514 if (soundParams.IsValid())
517 SoundObject soundObject = soundBuilder.BuildSoundObject();
565 #ifdef ENABLE_LOGGING
566 DMPDebugPrint(
string.Format(
"Stopping currently played track %1",
m_CurrentTrack.m_SoundSet));
567 DMPDebugPrint(
string.Format(
"-- Setting fadeout to %1", fadeoutSeconds));
587 if (locations.Count() > 0)
591 switch (track.m_Shape)
593 case DynamicMusicLocationShape.BOX:
594 foreach (
int locationId,
array<vector> bounds : track.locationBoundaries)
601 #ifdef ENABLE_LOGGING
602 DMPDebugPrint(
string.Format(
"Player inside location <%1, %2>", bounds[0], bounds[1]));
607 case DynamicMusicLocationShape.POLYGON:
613 #ifdef ENABLE_LOGGING
614 DMPDebugPrint(
string.Format(
"Player inside polygon location at <%1>",
m_PlayerPosition));
627 if (locations.Count() > 0)
633 #ifdef ENABLE_LOGGING
634 DMPDebugPrint(
string.Format(
"Player inside location <%1, %2>", location.m_Min, location.m_Max));
646 if (tracklist.Count() == 0)
653 filteredTracks.Insert(filteredTrack);
684 if (!track.m_HasPriority)
687 priorityFlagIndices.Insert(i);
690 if (priorityFlagIndices.Count() > 0)
691 return priorityFlagIndices[priorityFlagIndices.GetRandomIndex()];
694 return tracks.GetRandomIndex();
702 int count = tracks.Count();
709 case DynamicMusicPlayerTrackHistoryLookupType.ANY:
712 case DynamicMusicPlayerTrackHistoryLookupType.BUFFER:
732 m_ActualTimeOfDay =
mission.GetWorldData().GetDaytime();
748 #ifdef DIAG_DEVELOPER
749 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.DYNAMIC_MUSIC_PLAYER))
751 float timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
753 return waitTime / FeatureTimeAccel.GetFeatureTimeAccelValue();
762 #ifdef DIAG_DEVELOPER
763 if (FeatureTimeAccel.GetFeatureTimeAccelEnabled(ETimeAccelCategories.DYNAMIC_MUSIC_PLAYER))
765 float timeAccel = FeatureTimeAccel.GetFeatureTimeAccelValue();
767 return waitTime / FeatureTimeAccel.GetFeatureTimeAccelValue();
785 if (track.
m_Shape == DynamicMusicLocationShape.BOX)
800 if (trackPrio.
m_Shape == DynamicMusicLocationShape.BOX)
814 #ifdef DIAG_DEVELOPER
815 private ref array<Shape> m_DebugShapesLocations =
new array<Shape>();
816 private ref array<Shape> m_DebugShapesLocationsVertices =
new array<Shape>();
817 private float m_DebugWaitTime = 0;
819 private void DisplayDebugStats(
bool enabled)
828 DbgUI.Text(
string.Format(
"Day/Night: %1", DynamicMusicPlayerTimeOfDay.ToString(m_ActualTimeOfDay)));
829 DbgUI.Text(
"Playback:");
830 DbgUI.Text(
string.Format(
" active: %1", isPlaybackActive.
ToString()));
836 DbgUI.Text(
"Update timers:");
845 DbgUI.Text(
"Player:");
850 DbgUI.Text(
"Tracks counts:");
869 string isPlaying =
"waiting";
871 isPlaying =
"playing";
873 DbgUI.Text(
string.Format(
"State: %1", isPlaying));
887 if (DbgUI.Button(
"Stop"))
890 if (DbgUI.Button(
"Reset Waiting"))
893 DynamicMusicPlayerCategoryPlaybackData playbackData =
new DynamicMusicPlayerCategoryPlaybackData();
896 DbgUI.Text(
"Set Category:\n");
897 if (DbgUI.Button(
"Time"))
899 if (DbgUI.Button(
"Location"))
904 if (DbgUI.Button(
"Menu"))
909 if (DbgUI.Button(
"Credits"))
915 DbgUI.Text(
"Reset Timers\n");
916 if (DbgUI.Button(
"Timer ALL"))
923 if (DbgUI.Button(
"Timer Daytime"))
925 if (DbgUI.Button(
"Timer Location"))
927 if (DbgUI.Button(
"Timer Location(prio)"))
934 private void DisplayStaticLocations(
bool enabled)
944 foreach (array<vector> bounds : track.locationBoundaries)
946 locationMin = bounds[0];
947 locationMax = bounds[1];
949 if (vector.Distance(
position, Math.CenterOfRectangle(locationMin, locationMax)) > 2000)
952 Debug.CleanupDrawShapes(m_DebugShapesLocations);
954 locationMax[1] = locationMin[1] + 200.0;
955 locationMin[1] = locationMin[1] - 50.0;
959 Debug.CleanupDrawShapes(m_DebugShapesLocationsVertices);
960 DrawPolygonLocation(track);
965 foreach (array<vector> boundsPrio : trackPrio.locationBoundaries)
967 locationMin = boundsPrio[0];
968 locationMax = boundsPrio[1];
970 if (vector.Distance(
position, Math.CenterOfRectangle(locationMin, locationMax)) > 2000)
973 Debug.CleanupDrawShapes(m_DebugShapesLocations);
975 locationMax[1] = locationMin[1] + 200.0;
976 locationMin[1] = locationMin[1] - 50.0;
980 Debug.CleanupDrawShapes(m_DebugShapesLocationsVertices);
981 DrawPolygonLocation(trackPrio);
984 foreach (DynamicMusicLocationDynamicData locationDynamic : m_LocationsDynamic)
986 locationMin = locationDynamic.m_Min;
987 locationMax = locationDynamic.m_Max;
989 if (vector.Distance(
position, Math.CenterOfRectangle(locationMin, locationMax)) > 2000)
992 Debug.CleanupDrawShapes(m_DebugShapesLocations);
994 locationMax[1] = locationMin[1] + 200.0;
995 locationMin[1] = locationMin[1] - 50.0;
1001 Debug.CleanupDrawShapes(m_DebugShapesLocations);
1002 Debug.CleanupDrawShapes(m_DebugShapesLocationsVertices);
1006 private void DrawPolygonLocation(notnull DynamicMusicTrackData track)
1008 vector first, current, last;
1010 int count = track.vertices.Count();
1011 foreach (
int i, vector vertexPos : track.vertices)
1013 vertexPos[1] = vertexPos[1] + 0.5;
1014 current = vertexPos;
1028 #ifdef ENABLE_LOGGING
1029 private void DMPDebugPrint(
string message)
1031 #ifdef DMP_DEBUG_PRINT
const int TRACKS_BUFFER_HISTORY_SIZE
class DynamicMusicLocationDynamicData m_MinWaitTimeSeconds
float m_FadeoutTimeRequested
bool m_WaitingForPlayback
EDynamicMusicPlayerCategory m_CategorySelected
const float TICK_PRIORITY_LOCATION_UPDATE_SECONDS
float m_TickLocationCacheUpdateElapsed
const float LOCATION_DISTANCE_MAX
void SetCategory(DynamicMusicPlayerCategoryPlaybackData playbackData)
void CleanupDebugShapes(array< Shape > shapesArr)
DEPRECATED.
float GetWaitTimeForCategory(EDynamicMusicPlayerCategory category)
void OnCategorySet(EDynamicMusicPlayerCategory category, bool forced)
const float TICK_FADEOUT_PROCESSOR_SECONDS
int SelectRandomTrackIndexFromCategory(EDynamicMusicPlayerCategory category, int lookupType, notnull array< ref DynamicMusicTrackData > tracks)
AbstractWave m_SoundPlaying
float m_PreviousTrackFadeoutSeconds
float m_TickTimeOfDateElapsed
ref DynamicMusicPlayerRegistry m_DynamicMusicPlayerRegistry
float GetMinWaitTimePerCategory(EDynamicMusicPlayerCategory category)
bool IsPriotitizedCategorySelected()
void UnregisterDynamicLocation(notnull Entity caller)
ref map< EDynamicMusicPlayerCategory, ref SimpleCircularBuffer< int > > m_LastPlayedTrackBufferPerCategory
gets the playback mode as set in sounds menu; 0 - all; 1 - menu only
float GetPreviousTrackFadeoutSeconds(EDynamicMusicPlayerCategory category)
float m_TickFadeOutProcessingElapsed
void RegisterDynamicLocation(notnull Entity caller, int locationType, float locationSize)
void OnProfileOptionChanged(EDayZProfilesOptions option, int value)
void OnGameEvent(EventType eventTypeId, Param params)
bool PlayerInsideOfLocationFilter(array< ref DynamicMusicTrackData > locations)
void OnNextTrackSelected(DynamicMusicTrackData track, float waitTime)
void DetermineTrackByCategory(EDynamicMusicPlayerCategory category)
void OnLocationMatched(EDynamicMusicPlayerCategory category, bool isPriorityLocation)
void DynamicMusicPlayer(DynamicMusicPlayerRegistry configuration)
float GetMaxWaitTimePerCategory(EDynamicMusicPlayerCategory category)
float m_FadeoutTimeElapsed
const float TICK_LOCATION_CACHE_UPDATE_SECONDS
void RefreshTracksCache()
void FadeoutTrack(float fadeoutSeconds)
const float TICK_LOCATION_UPDATE_SECONDS
int SelectRandomTrackIndexFromCategoryPriorityFlagFirst(EDynamicMusicPlayerCategory category, notnull array< ref DynamicMusicTrackData > tracks)
ref array< ref DynamicMusicTrackData > m_TracksLocationStaticPrioritizedCached
static + filtered by the distance between player and center of zone
bool SetSelectedTrackFromCategory(EDynamicMusicPlayerCategory category, notnull array< ref DynamicMusicTrackData > tracklist, int historyLookupType=DynamicMusicPlayerTrackHistoryLookupType.ANY)
class DynamicMusicPlayerCategoryPlaybackData TICK_TIME_OF_DATE_UPDATE_SECONDS
DynamicMusicTrackData m_CurrentTrack
void PlayTrack(DynamicMusicTrackData track)
float m_TickPriorityLocationUpdateElapsed
ref array< ref DynamicMusicTrackData > m_TracksLocationMatchedPlayerInside
static prio + filtered by the distance between player and center of zone
void OnFadeoutFinished(EDynamicMusicPlayerCategory category)
ref array< ref DynamicMusicTrackData > m_TracksLocationStaticCached
map of dynamically registered locations during runtime
float m_TickLocationUpdateElapsed
float m_MaxWaitTimeSeconds
EDynamicMusicPlayerCategory
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
static ref ScriptInvoker m_OnIntOptionChanged
static void CleanupDrawShapes(array< Shape > shapes)
static array< vector > GetRectangularCoordsFromSize(vector origin, float size)
vector m_Min
rectangle coords (2d only)
const int CONTAMINATED_ZONE
EDynamicMusicPlayerCategory m_Category
ref array< ref DynamicMusicTrackData > m_TracksLocationDynamic
ref array< ref DynamicMusicTrackData > m_TracksCredits
ref array< ref DynamicMusicTrackData > m_TracksTime
ref array< ref DynamicMusicTrackData > m_TracksMenu
static int Translate(int value)
translates WorldDataDaytime -> DynamicMusicPlayerTimeOfDay
static override string ToString(int value)
simplified WorldDataDaytime
EDynamicMusicPlayerCategory m_Category
void InsertLocation(vector min, vector max)
ref array< vector > vertices
ref array< ref array< vector > > locationBoundaries
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto string ToString(bool beautify=true)
Vector to string.
const int INDEX_NOT_FOUND
const EventType MPSessionPlayerReadyEventTypeID
no params
enum WindingOrder Math2D()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static proto bool IsPointInRectangle(vector mi, vector ma, vector p)
Returns if point is inside rectangle.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static vector CenterOfRectangle(vector min, vector max)
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
class SoundObject SoundParams(string name)
proto native void SetKind(WaveKind kind)