intfiction.org

The Interactive Fiction Community Forum
It is currently Tue Jan 15, 2019 10:10 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Sounds after each other
PostPosted: Mon Dec 31, 2018 7:56 am 
Offline

Joined: Sat Aug 19, 2017 8:32 am
Posts: 10
I've been putting sound effects in my game and have so far got about 21 short effects working of a few seconds each. They are triggered in a variety of ways such as "every time when the player is in the room for the second time" and "after four turns" and "if the player is on the supporter" and "a random chance of 1 in 2 succeeds". They all work succesfully if they are the only sound activated for a turn, though only one sound plays when two are activated such as the player is in the room for the second time and after 4 turns. The typed words do appear
though so the text of the second sound is reacting.


Do I need to use the music extension. I'm probably pushing the boundries of Inform7 but can it play one sound and then a second sound after? on the same turn? I've looked at some music queries with crossfade but don't know how to do it. I seem to be going well with inform7 programming in word form but I can't programme in I6.

Thanks
Michelle


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 31, 2018 9:03 am 
Offline

Joined: Wed Nov 12, 2014 5:20 pm
Posts: 214
This seems to work:
Code:
"Sounds after each other" by Phosphate

Include version 10/160919 of Glulx Entry Points by Emily Short.

Use direct event handling.

The Sound Stage is a room. "You can hear two songs alternating in the background."

Sound 1 is the file "song1.ogg".
Sound 2 is the file "song2.ogg".

When play begins:
   unless glk sound notification is supported:
      say "This interpreter does not support sound notifications! Song alternation won't work!";
   play Sound 1 with notification.

To play (SFX - sound name) with notification:
   (- glk_schannel_play_ext(gg_foregroundchan, ResourceIDsOfSounds-->{SFX},1,1); -).

Glulx input handling rule for a sound-notify-event:
   let sound id be glk event value 1;
   if sound id is the Glulx resource ID of Sound 1:
      play Sound 2 with notification;
   otherwise:
      play Sound 1 with notification.
It requires version 10/160919 of Glulx Entry Points and three other extension dependencies, and an interpreter that supports sound notifications, which I guess currently means Windows Glulxe or Windows Git if you are on Windows. And two correctly named sound files, of course.

All the required extensions are collected in the extensions folder of my Soundtest Github repository.

EDIT: This forum seems to turn all tabs into spaces, so the sample above won't work. You can copy and paste from here instead.


Last edited by Angstsmurf on Mon Dec 31, 2018 12:06 pm, edited 1 time in total.

Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 31, 2018 11:29 am 
Online

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5522
Location: Burlington, VT
Another way to recover tabs is to hit the "quote" button at the bottom of the post, copy the text out of what you get from there, and cancel your reply. (This is a reversion to the way the forum worked a few years ago--I'm not sure what happened.)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 31, 2018 1:27 pm 
Offline

Joined: Sat Aug 19, 2017 8:32 am
Posts: 10
Thanks. I'll see if I can get it working.

Happy New Year

Michelle


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: matt w and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group