Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 8:48 pm

All times are UTC




Post new topic Reply to topic  [ 74 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Sun Apr 22, 2007 2:17 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Last edited by Robin on Tue Jul 10, 2007 1:16 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:20 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
ahh cool, i'll add this thanks robin :D

---------

Just wandering, do you have to replace the whole modSound with wat u have or add that to that code to 1 in it.


Last edited by Da Undead on Sun Apr 22, 2007 2:26 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:21 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
No problem :)

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:30 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
i edited my post above, please read :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:33 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
You don't need to delete anything, but you need to comment out any:

Code:
PlayMidi (w/e)


Calls.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:36 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
What about Sub PlayMidi


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:37 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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 :)

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 2:42 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
alright cool. How would this work if u have no play music anywhere inplace of the call playmidi


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 3:30 pm 
Offline
Knowledgeable
User avatar

Joined: Sun Nov 19, 2006 6:59 pm
Posts: 213
Good tutorial Robin :) Only thing is, not everyone is up to date with the Windows Media Player control. If I remember right (I had implemented this once), there are two different versions of the control with the same name, but the syntax for using them was different. Sorry if I'm wrong, just thought you should know.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 2:34 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
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?

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 3:42 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
JokeOfWeek2 wrote:
Good tutorial Robin :) Only thing is, not everyone is up to date with the Windows Media Player control. If I remember right (I had implemented this once), there are two different versions of the control with the same name, but the syntax for using them was different. Sorry if I'm wrong, just thought you should know.


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.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 9:39 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
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.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 10:04 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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 :(

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 23, 2007 10:23 pm 
Offline
Knowledgeable

Joined: Tue Apr 17, 2007 10:18 pm
Posts: 148
Location: USA, Texas
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 08, 2007 11:39 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Yay for laziness!

Anyway I could get a playing song to loop?

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 2:35 am 
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...


Top
  
 
 Post subject:
PostPosted: Wed May 09, 2007 3:14 am 
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.


Top
  
 
 Post subject:
PostPosted: Wed May 09, 2007 2:49 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Nope, it's for .mid as well.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 4:48 pm 
I meant that it's being used so *.mp3 and *.wav can be used instead of midi.


Top
  
 
 Post subject:
PostPosted: Thu May 10, 2007 8:02 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Well, I've been searching, but in vain.

Has anyone else attempted a search?

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 8:22 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
For what?

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 9:55 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
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. -.-

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
PostPosted: Tue Jul 10, 2007 1:15 am 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
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

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
PostPosted: Sun Jul 29, 2007 1:39 pm 
Offline
Knowledgeable
User avatar

Joined: Sat Jun 03, 2006 8:48 pm
Posts: 172
Location: Naiyo Region
Google Talk: matt.nwachukwu@gmail.com
Lol, you did what I did.

Cools. n.n

_________________
Image
みんな、見ていてくれ!


Top
 Profile  
 
PostPosted: Sun Jul 29, 2007 3:17 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
-stares at Matts signature-

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 74 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 18 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