Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MIDIs in Director 1

Status
Not open for further replies.

h09

IS-IT--Management
Mar 22, 2004
18
US
Hey, I'm just curious, is it possible via a plug-in or some other method to use MIDIs in Director? The background music that I have, as a Midi, is approximately 50KB, while it's about 1 meg as an MP3, which is well over the size limit that I have specified for the program. I appreciate your time and help, thanks.
 
You can play external MIDI file as QuickTime movie. Create #QuickTimeMedia member and assign fileName to the external MIDI file. Then you can control the playback as normal QuickTime movie.
 
Thanks Kenneth, but I'm a little unclear on how to do that. Can you perhaps provide steps? I may understand how to do it, but perhaps the terminology is just a bit confusing for me = / I'm still very much a novice in the Director area.

Also, by externally linking, are you referring to me linking to the path of my midi in my website directory? For instance, Are you able to import the mid and use it?
 
So you want (1) download a MIDI file from the Internet, and then (2) play that MIDI in Director.

Why not?

The strategy would be:
1. Start downloading the MIDI file.
2. Wait for the download operation finishes.
3. If download error occurs, do something about it.
4. If download is successful, create new #quickTimeMedia member.
5. Assign downloaded MIDI file as the QuickTime member just created.
6. Put the MIDI-QuickTime onto the Stage and play the music.

Here are two frame scripts. The frame script 1 starts downloading the MIDI file. The frame script 2 does the rest. (I am creating member(23) as QuickTime/MIDI member and placing it in Sprite(1) in this example.)

--
-- Frame script 1
on enterFrame me
global gNetID
gNetID = preloadNetThing("end

-- Frame script 2
global gNetID

on exitFrame me
if netDone(gNetID) then
tErrorCode = netError(gNetID)
if tErrorCode <> "OK" then
alert("Couldn't download the MIDI file. Error code:" && tErrorCode)
-- or do something upon netError.
else
new(#quickTimeMedia, member(23))
member(23).fileName = " puppetSprite(1, 1)
sprite(1).member = member(23)
sprite(1).movieRate = 1
end if
else
go the frame
end if
end
--

I separated two scripts in order to demonstrate the concepts but they could be in one script/script object.

If you're using a local MIDI file, obviously you won't need to download the file - just assign the fileName to the local MIDI file.
 
Cool Kenneth, thanks a lot man. You've been very helpful, you got my vote! :)
 
Ah crap, one more thing :( Is there a way that I can loop the playback of that midi?
 
Doh, I even knew that = / I just wasn't sure how to create it since it was QT-related. Cool, thanks a bunch man, that's definitely something that I coulda found if I was really thinking by looking on my own in Director help. I'm sorry to waste your time there Kenneth but thanks again for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top