You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Added SoundContainer::Create that doesn't take any filepaths, to allow empty sound containers to be made. Useful for multiplayer and lua.
Added parameter to SoundContainer::AddSound and ContentFile::GetAsSample to allow it to send errors to console instead of aborting the game. Used this in AudioMan::PlaySound(filePath), since that's only ever called from lua (all internal stuff uses SoundContainer::Play)
/// Creates a SoundContainer and gives it a path to its first sound.
40
48
/// </summary>
41
49
/// <param name="soundPath">A path to the sound for this sound to have.</param>
42
50
/// <param name="loops">The number of times this SoundContainer's sounds will loop. 0 means play once. -1 means play infinitely until stopped.</param>
43
51
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch.</param>
44
52
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
45
-
intCreate(std::string soundPath, int loops = 0, bool affectedByGlobalPitch = true);
53
+
intCreate(std::string constsoundPath, int loops = 0, bool affectedByGlobalPitch = true) { int result = Create(loops, affectedByGlobalPitch); AddSound(soundPath); return result; }
46
54
47
55
/// <summary>
48
56
/// Adds a new Sound to this SoundContainer, loaded from a file.
49
57
/// </summary>
50
58
/// <param name="soundPath">A path to the new sound to add. This will be handled through PresetMan.</param>
51
-
voidAddSound(std::string soundPath);
59
+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error. Default true.</param>
RTEAbort("There was no object name following first pound sign in the ContentFile's datafile path, which means there was no actual object defined. The path was:\n\n" + m_DataPath);
228
+
errorMessage = "There was no object name following first pound sign in the sound ContentFile's datafile path, which means there was no actual object defined. The path was: ";
229
+
if (abortGameForInvalidSound) { RTEAbort(errorMessage + "\n\n" + m_DataPath); }
int bytesRead = pack_fread(pRawData, fileSize, pFile);
235
-
RTEAssert(bytesRead == fileSize, "Tried to read a file but couldn't read the same amount of data as the reported file size!");
246
+
RTEAssert(bytesRead == fileSize, "Tried to read a sound file but couldn't read the same amount of data as the reported file size! The path and name were: \n\n" +m_DataPath);
236
247
237
-
// Setup fmod info, and make sure to use mode OPENMEMORY_POINT since we're doing the loading ContentFile instead of fmod
248
+
// Setup fmod info, and make sure to use mode OPENMEMORY since we're doing the loading with ContentFile instead of fmod, and we're deleting the raw data after loading it
Copy file name to clipboardExpand all lines: System/ContentFile.h
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -190,8 +190,9 @@ namespace RTE {
190
190
/// <summary>
191
191
/// Loads and gets the data represented by this ContentFile object as an FMOD FSOUND_SAMPLE. Note that ownership of the SAMPLE IS NOT TRANSFERRED!
192
192
/// </summary>
193
+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error. Default true.</param>
193
194
/// <returns>The pointer to the beginning of the data object loaded from the file. Ownership is NOT transferred! If 0, the file could not be found/loaded.</returns>
0 commit comments