| Mirage Source http://www.miragesource.net/forums/ |
|
| Media Player Sound Replacement http://www.miragesource.net/forums/viewtopic.php?f=210&t=1715 |
Page 1 of 4 |
| Author: | Robin [ Sun Apr 22, 2007 2:17 pm ] |
| Post subject: | Media Player Sound Replacement |
MediaPlayer Supported Sound Much shorter than FMod. Refrences Code: Windows Media Player Location: C:\WINDOWS\system32\msdxm.ocx modSound Code: Public MusicPlayer As New MediaPlayer.MediaPlayer Public CurrentSong As String Public Sub PlayMusic(ByVal Song As String) If Song <> CurrentSong Then MusicPlayer.Open App.Path & "\data\music\" & Song CurrentSong = Song End If End Sub Syntax Code: PlayMusic "Ripple.mp3" sub GameDestroy Code: MusicPlayer.Stop Set MusicPlayer = Nothing Sub HandleData (just after "Unload frmMapProperties") Code: PlayMusic SaveMap.Music & ".mid" OPTIONAL EXTRA: PREVIEW MAP MUSIC IN EDITOR frmMapProperties Code: Private Sub Command1_Click() PlayMusic scrlMusic.Value & ".mid" End Sub OPTIONAL EXTRA: LOOPING SONGS frmSound Code: Public Sub MidiLoop() If MusicPlayer.PlayState = mpStopped Then MusicPlayer.Play End If End Sub Sub GameLoop Code: midiloop
|
|
| Author: | Da Undead [ Sun Apr 22, 2007 2:20 pm ] |
| Post subject: | |
ahh cool, i'll add this thanks robin --------- Just wandering, do you have to replace the whole modSound with wat u have or add that to that code to 1 in it. |
|
| Author: | Robin [ Sun Apr 22, 2007 2:21 pm ] |
| Post subject: | |
No problem |
|
| Author: | Da Undead [ Sun Apr 22, 2007 2:30 pm ] |
| Post subject: | |
i edited my post above, please read |
|
| Author: | Robin [ Sun Apr 22, 2007 2:33 pm ] |
| Post subject: | |
You don't need to delete anything, but you need to comment out any: Code: PlayMidi (w/e)
Calls. |
|
| Author: | Da Undead [ Sun Apr 22, 2007 2:36 pm ] |
| Post subject: | |
What about Sub PlayMidi |
|
| Author: | Robin [ Sun Apr 22, 2007 2:37 pm ] |
| Post subject: | |
Da Undead wrote: What about Sub PlayMidi
Well, if it's never been called it's not doing any harm. Might as well keep it there |
|
| Author: | Da Undead [ Sun Apr 22, 2007 2:42 pm ] |
| Post subject: | |
alright cool. How would this work if u have no play music anywhere inplace of the call playmidi |
|
| Author: | JokeofWeek [ Sun Apr 22, 2007 3:30 pm ] |
| Post subject: | |
Good tutorial Robin |
|
| Author: | Lea [ Mon Apr 23, 2007 2:34 am ] |
| Post subject: | |
Cool. Does it work with old WMP versions, also does WMP (and other programs that use this control) still work while the music in the game is playing? |
|
| Author: | Robin [ Mon Apr 23, 2007 3:42 pm ] |
| Post subject: | |
JokeOfWeek2 wrote: Good tutorial Robin I'm pretty sure it will work no matter how old windows media player is, because all we are doing is using the very, very basic funtions (play mp3, mid, wav etc.) and stop them. I'm also pretty sure I used the correct version. I looked around and that was the reference people used when working with it. Please correct me if I'm wrong. Dave wrote: Cool. Does it work with old WMP versions, also does WMP (and other programs that use this control) still work while the music in the game is playing?
It does for me. You can have sound coming out of both the game and Windows Media Player at the same time, but make sure you give people to option to turn off sound As for older WMP versions, I'm 99% sure it does. |
|
| Author: | Da Undead [ Mon Apr 23, 2007 9:39 pm ] |
| Post subject: | |
I been wandering about a like built-in music player where plays music based off 'watever folder name' and can be anything xD. Like having ur own playlist :p. So u don't have to have like Musicmatch/Windows Media/Jukebox, etc... open xD. |
|
| Author: | Robin [ Mon Apr 23, 2007 10:04 pm ] |
| Post subject: | |
I had that for one of the Nr versions. I stole a code which searched through the PC for music files, and then allowed users to add these into playlists (or load existing WMP playlists) and play them accordingly. Don't have the source anymore though |
|
| Author: | Da Undead [ Mon Apr 23, 2007 10:23 pm ] |
| Post subject: | |
make another xD. How about make it check any type of .mp3 or .wav file in like 'music' folder. And then just add little pic box with stuff :p. |
|
| Author: | Matt2 [ Tue May 08, 2007 11:39 pm ] |
| Post subject: | |
Yay for laziness! Anyway I could get a playing song to loop? |
|
| Author: | Boo [ Wed May 09, 2007 2:35 am ] |
| Post subject: | |
Hmm, I know ShockWave has an .Loop command, but idk if you can use that for Sound :\ But I would thing it should loop on its own unless you got an stop midi or w-e... |
|
| Author: | Matt [ Wed May 09, 2007 3:14 am ] |
| Post subject: | |
This is for *.mp3 and *.wav files. Not midi. Windows media player has a loop (repeat) function. There has to be a way to call this using this method. I'm sure. |
|
| Author: | Robin [ Wed May 09, 2007 2:49 pm ] |
| Post subject: | |
Nope, it's for .mid as well. |
|
| Author: | Matt [ Wed May 09, 2007 4:48 pm ] |
| Post subject: | |
I meant that it's being used so *.mp3 and *.wav can be used instead of midi. |
|
| Author: | Matt2 [ Thu May 10, 2007 8:02 pm ] |
| Post subject: | |
Well, I've been searching, but in vain. Has anyone else attempted a search? |
|
| Author: | Robin [ Thu May 10, 2007 8:22 pm ] |
| Post subject: | |
For what? |
|
| Author: | Matt2 [ Thu May 10, 2007 9:55 pm ] |
| Post subject: | |
Advocate wrote: This is for *.mp3 and *.wav files. Not midi.
Windows media player has a loop (repeat) function. There has to be a way to call this using this method. I'm sure. ^This^ [edit] Lol, no one has either attempted, or found anything, have we? Well, I'm trying out all sorts of things. When I get it working, Robin, you can add it to your tut. -.- |
|
| Author: | Robin [ Tue Jul 10, 2007 1:15 am ] |
| Post subject: | Re: Media Player Sound Replacement |
For anyone who hasn't found it out yet and wants to know, here's how to make the song loop. add this sub to modSound and call it during gameloop. Code: Public Sub MidiLoop()
If MusicPlayer.PlayState = mpStopped Then MusicPlayer.Play End If End Sub |
|
| Author: | Matt2 [ Sun Jul 29, 2007 1:39 pm ] |
| Post subject: | Re: Media Player Sound Replacement |
Lol, you did what I did. Cools. n.n |
|
| Author: | Robin [ Sun Jul 29, 2007 3:17 pm ] |
| Post subject: | Re: Media Player Sound Replacement |
-stares at Matts signature- |
|
| Page 1 of 4 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|