Frictional Games Forum (read-only)
Soundfile not working - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Soundfile not working (/thread-23840.html)



Soundfile not working - Efendi - 11-12-2013

Hello. I have a custom story, when entering a area, it will override the level music, and start a sound that is looping.

I have made a sounds folder in my custom story map. redist->custom_stories->My map name->sounds. I have in the sound folder general_piano03.ogg, and the general_piano03.snt file. This is the general_piano03.snt code:

Spoiler below!
<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="general_piano03" />
</Main>
</SOUNDS>
<PROPERTIES Volume="10" MinDistance="2" MaxDistance="40" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="True" Use3D="True" Blockable="False" BlockVolumeMul="0.8" Priority="2" />
</SOUNDENTITY>

I have tried rename the "general_piano03" to general_piano03.snt, with no results.

I have changed the Loop="True", and the Prioirity="2". When i enter the area, where i want the sound to begin, the sound will begin, but it wont override the level music, and it wont loop. I have the level music priority to 1.

Here is the script that is used in this event:

Spoiler below!

void OnStart()

{
AddEntityCollideCallback("Player", "livingroomarea", "music_livingroom", true, 1);

PlayMusic("02_amb_safe", true, 1, 0.1, 1, true);
}

void music_livingroom(string &in asParent, string &in asChild, int alState)

{
PlaySoundAtEntity("piano", "general_piano03.snt", "livingroomarea", 1, false);
}

I don't know if i have missed something, but any help would be highly appreciated!


RE: Soundfile not working - Romulator - 11-12-2013

Firstly, for future reference:
PlaySoundAtEntity() only works with .snt files
and
PlayMusic() only works with .ogg files

Have you got the Ogg File with the .snt file as well, so you have both a .snt and .ogg file?
They should have the same filename and be in the same folder, or the .snt should point to the .ogg file in the <Sound File="general_piano03" /> line of the .snt
Example:
Code:
.../redist/MyCS/sounds/
   general_piano03.ogg
   general_piano03.snt



RE: Soundfile not working - Efendi - 11-12-2013

(11-12-2013, 12:57 PM)Romulator Wrote: Firstly, for future reference:
PlaySoundAtEntity() only works with .snt files
and
PlayMusic() only works with .ogg files

Have you got the Ogg File with the .snt file as well, so you have both a .snt and .ogg file?
They should have the same filename and be in the same folder, or the .snt should point to the .ogg file in the <Sound File="general_piano03" /> line of the .snt
Example:
Code:
.../redist/MyCS/sounds/
   general_piano03.ogg
   general_piano03.snt

Thanks for the reply. I have both the .ogg and .snt file in the sounds folder. I have the same filename for them also.

I tried to change the .snt code like this:

Spoiler below!
<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="general_piano03.snt" />
<Sound File="general_piano03.ogg" />
</Main>
</SOUNDS>
<PROPERTIES Volume="10" MinDistance="2" MaxDistance="40" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="True" Use3D="True" Blockable="False" BlockVolumeMul="0.8" Priority="2" />
</SOUNDENTITY>

But that didn't change anything. I can still hear the music, when i collide with the area, but it wont override the level music, and it wont loop. I will inform i manage to figure something out.


RE: Soundfile not working - Romulator - 11-12-2013

I'll look over this in a bit, but I am pretty sure your first .snt was correct. Have you named your things appropriately in the Level Editor?


RE: Soundfile not working - DnALANGE - 11-12-2013

void OnStart()

{
AddEntityCollideCallback("Player", "livingroomarea", "music_livingroom", true, 1);

PlayMusic("02_amb_safe", true, 1, 0.1, 1, true);
}

void music_livingroom(string &in asParent, string &in asChild, int alState)
{
PlayMusic("general_piano03.ogg", true, 1, 0.1, 1, true);
StopMusic(3,1); //Stops the music with a fadeout of 3 seconds, and the PRIORITY is 1 like the music.ogg-file.
}

-------------------------
<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="general_piano03.ogg" />
</Main>
</SOUNDS>
<PROPERTIES Volume="1" MinDistance="2" MaxDistance="40" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="True" Use3D="True" Blockable="False" BlockVolumeMul="0.8" Priority="1" />
</SOUNDENTITY>

---
The SNT-file ONLY reads SOUND.OGG
Don't put any .snt in there won't work cause you already are INSIDE a snt-file.
ALSO make sure the priority is 1 in the MUSIC file and when your want to stop music, use 1 again.
so if you use priority 5 for music.ogg, use 5 to stop the music.ogg!
-
Extra info, do NOT make more VOLUME then 1, ONLY if nescasary, it will be EXTREMELY loud and probly "explode"the speakers Wink
-


RE: Soundfile not working - Daemian - 11-12-2013

I think your problem it's you are calling the first music with PlayMusic and the second with PlaySoundAtEntity, being the last one considered as sound. So it doesn't care if you have music on.

You should use PlayMusic again to make it override the first one depending on priority.
And it's not looping because it tries to random another file and it fails.
(I'm guessing, you should test)


[SOLVED] Soundfile not working - Efendi - 11-12-2013

Thanks you very much for your replys, all of you! The main issue was probably the playsoundatentity command, that didn't work at this special case. It worked when i changed it to Playmusic, still banging my brain when i didn't come up to test with playmusic Smile

I also changed in the .snt file just the .ogg sound file, and ignored the .snt.

But thanks again for helping me with this. This issue is solved, and can be locked.