Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Soundfile not working
Efendi Offline
Junior Member

Posts: 13
Threads: 7
Joined: Sep 2013
Reputation: 0
#1
Soundfile not working

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!
11-12-2013, 12:22 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Soundfile not working

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:
.../redist/MyCS/sounds/
   general_piano03.ogg
   general_piano03.snt

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 11-12-2013, 12:58 PM by Romulator.)
11-12-2013, 12:57 PM
Find
Efendi Offline
Junior Member

Posts: 13
Threads: 7
Joined: Sep 2013
Reputation: 0
#3
RE: Soundfile not working

(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:
.../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.
11-12-2013, 02:18 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Soundfile not working

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?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
11-12-2013, 03:08 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#5
RE: Soundfile not working

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
-
(This post was last modified: 11-12-2013, 03:28 PM by DnALANGE.)
11-12-2013, 03:21 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#6
RE: Soundfile not working

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)

11-12-2013, 04:18 PM
Find
Efendi Offline
Junior Member

Posts: 13
Threads: 7
Joined: Sep 2013
Reputation: 0
#7
[SOLVED] Soundfile not working

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.
(This post was last modified: 11-12-2013, 06:22 PM by Efendi.)
11-12-2013, 06:21 PM
Find




Users browsing this thread: 3 Guest(s)