FAQ Search Memberlist Usergroups
Jolt Country Forum Index
Register Profile Log in to check your private messages Log in
Log in Log in

Music!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors
View previous topic :: View next topic  
Author Message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Thu Aug 17, 2006 12:42 pm    Post subject: Music! Reply with quote

Is there code out there to play a random song and then, when it's finished, play a different song? I never figured out how to do it in Necrotic Drift, but I imagine that it's possible.

And if this is in the release Future Boy! source, I apologize. I'm checking that tonight.
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Merk



Joined: 22 Nov 2004
Posts: 192
Location: Wichita, KS

PostPosted: Thu Aug 17, 2006 1:23 pm    Post subject: Reply with quote

I'm not aware of a way do detect when a song ends, and assuming the player is at a prompt, there wouldn't be any way to code a new song to start until your Hugo code is called again. If I think of something, I'll post again. I'm doubtful, though.
Back to top
View user's profile Send private message Visit poster's website
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Thu Aug 17, 2006 8:18 pm    Post subject: Reply with quote

inky and ctate from the ifMud got me heading down the system timer path... basically, Hugo can access the system time, so if you know the length of a piece of music you can determine when the next one should play.

I don't think that Hugo keeps track of the number of seconds since the beginning of Unix time (or even the number of seconds since you started playing the game, which would be helpful) so I think one will have to make a call for the current time and then increment to a future time that you'll check against every turn.

There's no way to start up that next piece of music until the player types something in, but that's fine for my purposes. If they aren't typing something in fairly regularly they probably aren't at the game, so no biggie.

I wrote a similar function to all of this when I was coding in C several years ago, so I guess I can re-use some of that code. (Well, I wasn't playing music thereafter, but still.) I'll package it up and release it so everyone can implement it.

(If I implement the Spellcasting interface, which I won't for a WIP, but probably will for the sake of HUMAN KNOWLEDGE) there could be a nice little framework a new coder could hopefully use and do something with. Possibilities!)
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Merk



Joined: 22 Nov 2004
Posts: 192
Location: Wichita, KS

PostPosted: Fri Aug 18, 2006 2:07 pm    Post subject: Reply with quote

Yeah, but since the music suspends when the Hugo window loses focus, it's only going to be accurate if the user never switches windows during a game. Or is it only MIDI that gets halted until the window gets focus again? No, it's MP3's as well, I'm pretty sure, because that's what I had in Trading Punches.

A better solution would be a counter that only ticks while the window has focus, *or* a way to not pause the music when the window loses focus. I guess the worst that would happen, though, is that a song ends before it's supposed to, and a different one starts.
Back to top
View user's profile Send private message Visit poster's website
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Fri Aug 18, 2006 2:31 pm    Post subject: Reply with quote

That's right. You'd have the song ending early when you went back to the game and it checked the time. "Oh!" the game would say, right before the hard-rocking part of Stairway to Heaven, "It's time for a new song!"

And then the game randomly chooses a piece of screechtronica and everyone hisses. =(

But yeah, a timer ticking while the game is active is probably the best solution.
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Merk



Joined: 22 Nov 2004
Posts: 192
Location: Wichita, KS

PostPosted: Fri Aug 18, 2006 2:58 pm    Post subject: Reply with quote

Except that I don't think there is any way to do a timer that only runs while the window is active.

Still, you've got a better solution than no solution at all.
Back to top
View user's profile Send private message Visit poster's website
Kent



Joined: 27 Jun 2003
Posts: 119

PostPosted: Tue Nov 21, 2006 1:00 am    Post subject: Reply with quote

Yeah, there's really no way to explicitly tell when a song has finished playing. Call this a shortcoming of the current implementation, and call the implementation "The thing that was easiest to do across all platforms and disparate sound/media subsystems".

A system() call could probably be implemented to return the state of media playback, and this could be wrapped in a handy library call. Man, that's a good idea.
Back to top
View user's profile Send private message
Ice Cream Jonsey



Joined: 27 Apr 2002
Posts: 20088
Location: Colorado

PostPosted: Mon Feb 01, 2010 8:12 am    Post subject: Reply with quote

Bumping this because I implemented this on Sunday. I'll attach the code and eventually upload it all to the archive as a package.
_________________
the dark and gritty...Ice Cream Jonsey!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Jolt Country Forum Index -> Hugo's House of Horrors All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001 phpBB Group

Theme by Kage Musha - RPG Garden

Copyrights and trademarks are all of the belonging company. No copyright Infringement intended