DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: Mindbender on November 20, 2005, 04:08:21 PM



Title: Playing a midi file
Post by: Mindbender on November 20, 2005, 04:08:21 PM
Hi all,

in 0.9.7 it was pretty easy to let a midi file play whenever something happened or the player reached something.
If I remember right and copied it correct ;)
It was something like this here:

Code:
output("<embed src=\"media/win.mid\" width=10 height=10 autostart=true loop=false hidden=true volume=100>",true);

Is this actually possible that easy?
Can you please point me to how I would achieve something like that in 1.0.+ ?

Thank you and cheers

Mindbender


Title: Re:Playing a midi file
Post by: Sichae on November 20, 2005, 04:09:31 PM
I recently did this actually. Use a rawoutput (for translation purposes) and it should work just fine. Make sure you have the directory setup correctly.

Code:
rawoutput("<embed src='dir/file.format' autostart='true'>");
// Add whatever arguments you want to it.


Title: Re:Playing a midi file
Post by: Dannic on November 20, 2005, 04:13:36 PM
this might help.

Not sure why you would want to translate a midi file.

Code:
$midicode = "<embed src=\"media/win.mid\" width=10 height=10 autostart=true loop=false hidden=true volume=100>";

if (!isset($args['headerad'])) {
         
               $args['headerad'] = array();
            
            } elseif (!is_array($args['headerad'])) {
                  
               $args['headerad'] = array($args['headerad']);
            }
            array_push($args['headerad'], $midicode);

You could make this a module and pull from a list of midi files to play on seperate pages even.


Title: Re:Playing a midi file
Post by: Sichae on November 20, 2005, 04:14:52 PM
Dannic, using output("...",true); creates a translation space that can't be translated, as HTML doesn't really change amongst languages.

The problem with doing this, is that the song (or short .wav file) will start over everytime you leave a page and start a new one. Perhaps using the fabled "popup" is in order or making a person have some text to read while they listen. ;)


Title: Re:Playing a midi file
Post by: Dannic on November 20, 2005, 04:17:35 PM
depends on where it is placed.  sure. every-footer will cause it to be played on every single page.  even all of the combat ones.  There are ways to make it play on only certain pages.  I didn't bother posting that.  

I just posted the easiest way to do it imho. :)

I hate popups.


Title: Re:Playing a midi file
Post by: Talisman on November 20, 2005, 05:14:02 PM
Another way of finding out whether or not something like this would work is to actually try it, in a test module, on your test server...then any speculation will end!

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines