Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: modgeulator on Wed 28/04/2004 03:15:15

Title: PLUGIN: DirectMusic plugin
Post by: modgeulator on Wed 28/04/2004 03:15:15
Hi, I've completed my DirectMusic plugin for AGS.

System requirements:
Used alone: DirectX 8.0 or higher and Windows 95 or higher
Used in conjunction with AGS audio engine: DirectX 8.0 or higher and Windows 2000 or higher

The demo consists of three bare rooms. A forest, a town and an interior building inside a town. The forest has a simple ambient soundscape consisting of a random bird call, some forest animal/woodpecker kinda sounds (intended to be very similar to many classic Sierra games), and periods of silence. The town is a simple ditty for guitar and flute, entering the house-room it transitions to a similarly arranged piece then back again when you re-enter the town. I've written this music with the intention of using it in KQ 2.5.

In the house-room try INTERACTING with the BLUE CUP, it should trigger a sound effect and a MIDI music of a drum intro - this is being played using the internal AGS engine. I also need to know if this works. It's hard to click on the blue cup, so please try a few times if needed. Thanks.
(I know this will only work with Windows 2000 and XP now.)

You can download the demo here: http://modgeulator.tripod.com/DirectMusic.html

EDIT: If you're using Windows 95 / 98 / ME you need to run winsetup first and turn off the digital sound completely.

Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Hollister Man on Wed 28/04/2004 03:53:20
It worked beautifully on my comp, running DX9 and XP.  

I had no problems with the blue cup, the sound overlayed very nicely.

What exactly is the plugin for, dynamic stereo fading or something?
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Joseph DiPerla on Wed 28/04/2004 04:28:54
WOW, nice job. But to repeat a question, what is this exactly for?


SIDENOTE:
If we could use DX9, then maybe we can use Revolution3d.net to make a 3D plugin... Just a thought.


JD
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Candle on Wed 28/04/2004 05:36:55
Everything worked on mine fine , here is my computer info .
------------------
System Information
------------------
Time of this report: 4/27/2004, 23:33:23
      Machine name: CANDLE
  Operating System: Windows XP Home Edition (5.1, Build 2600) Service Pack 1 (2600.xpsp2.030422-1633)
          Language: English (Regional Setting: English)
System Manufacturer: VIA Technologies, Inc.
      System Model: VT8601
              BIOS: Award Modular BIOS v6.00PG
         Processor: Intel Celeron, ~900MHz
            Memory: 512MB RAM
         Page File: 230MB used, 1020MB available
       Windows Dir: C:\WINDOWS
   DirectX Version: DirectX 9.0b (4.09.0000.0902)

Title: Re:DirectMusic plugin (TEST release - please look)
Post by: strazer on Wed 28/04/2004 08:29:06
All working as you described.
Win2kPro/DirectX9.0b/SBLive5.1
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Wed 28/04/2004 09:08:32
OK, here is a Win98SE report:

At game start there is a short cracking sound.
All rooms are quiet, so sound.
The sound for "use cup" is ok, though.

Checked with another game: There is no cracking sound at game start.

AMD K6-II 400 MHz
Creative SoundBlaster 128 PCI
Win98SE (german)
DirectX 9.0

Tried it on the other computer with Win98SE but only DirectX 6.1. Also the cracking sound at first, but then crash with an error message. So it is definately not for 6.1. Just wanted to tell you ;-)
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Wed 28/04/2004 09:12:50
Glad to hear it's been working for everyone so far. To answer the question, it's intended for playback of DirectMusic Producer soundtracks. You can create scripted interactive music in DMP and use this plug-in to load your project and call routines from within AGS.
If you've ever paid attention to the music in LucasArts games, from Monkey Island 2 onwards, you should of noticed how the music is constantly changing depending on what you do in the game. Think of the music in Woodtick, or at the swamp/voodoo lady. If you can learn DirectMusic Producer, you can now have music like that in an AGS game.
Another feature is DLS or Downloadble Sounds. This is a system similar to SoundFonts that can be used in DirectMusic Producer, so basically you can set up MIDI music playing back with customized sounds - the small filesize and flexibility of MIDI, but without the restrictions of normal "General MIDI" soundsets as well as music that will sound exactly the same on any computer.

So what this plugin does, exactly:
-Loads a DirectMusic Producer script and AudioPath upon initialization. The script filename currently must be "AGSGame.spt" and the AudioPath must be called "AGSGame.aud".
-Allows you to call routines within that script from an AGS game. You do this with a function:
DMRoutine(string routinename);

Hope that helped to explain things.

EDIT: a-v-o posted while I was posting. So it looks like it doesn't work with win98se then? I'll have to look into that.
a-v-o, could you try running winsetup.exe and disabling digital sound and MIDI music completely and seeing if it works then?

EDIT SOME MORE: Also, a-v-o, how much ram did that first machine have in it?

EDIT #3: I tested it myself on another machine running Windows 98SE, doesn't work with AGS audio system (no sound from DirectMusic and click sound as described by a-v-o). Works fine if i turn off the AGS audio output in winsetup. MIDI playback didn't cause any problems however.


I'm going to list these as the system requirements for now:

DirectMusic plugin, without AGS in-built audio: Direct X 8.1 or higher and Windows 98 or higher.
DirectMusic plugin *with* AGS in-built audio: Direct X 8.1 or higher and Windows 2000 or higher.
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Scorpiorus on Wed 28/04/2004 12:58:56
Nice work with the plugin :)

And yep, it works fine under Win2k/DX9b

~Cheers
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Wed 28/04/2004 21:34:50
I have 128 MB RAM in the computer.

More testing results:

SM|BGD|2
--|+--|-
-+|+-+|-
+-|-+-|+
++|-++|+


Settings (+ enabled  - disabled):
S: sound device
M: music device
Audible (+ ok  - silence):
B: Background music
G: broken glas
D: drum
game start (+ ok  - error):
2: start game for a second time after quit game

When the sound device was disabled then I could hear background music, but after I quit game I couldn't start neither winsetup nor the game again. I had to reboot the computer, then I could start the game again.

Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Thu 29/04/2004 04:21:36
Quote from: a-v-o on Wed 28/04/2004 21:34:50
When the sound device was disabled then I could hear background music, but after I quit game I couldn't start neither winsetup nor the game again. I had to reboot the computer, then I could start the game again.
Thanks a-v-o, you're really helping me a lot. I haven't been able to recreate this error on another computer running Windows 98 though. What happens if you start from a fresh boot with sound and music disabled, quit the game, then start it again? Without  testing it with any of the devices turned on in AGS in between.

Also, if anyone's using Windows 95 or Direct X 8.0, I'd be really interested to hear if it works or not (you'll need to run winsetup and disable sound and music first).
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Thu 29/04/2004 08:44:25
With sound and music disabled I can hear the bird in the forest room. Then I quit and start the game again and it doesn't start, but shows the windows error message saying someting like "This application was closed ...".
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Thu 29/04/2004 10:01:27
Damn, this really has me stumped.
a-v-o, if you've got time, could you try downloading this: http://www.lynnemusic.com/gamemusic/dmdemo1.zip (~500kb) and seeing if it causes similar problems on your machine?
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Ben on Thu 29/04/2004 20:47:29
Works perfectly on my computer.. Direcx 8 on Windows 2000.

By the way-- Does this support real-time effects plugins (DX Plugins like Freeverb, etc...)?
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Pumaman on Thu 29/04/2004 21:08:02
Sounds funky, good work :)
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Gregjazz on Thu 29/04/2004 21:57:07
This looks cool -- so what exactly does this plugin support and do? (downloading demo now)
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Thu 29/04/2004 22:33:53
Quote from: modgeulator on Thu 29/04/2004 10:01:27
Damn, this really has me stumped.
a-v-o, if you've got time, could you try downloading this: http://www.lynnemusic.com/gamemusic/dmdemo1.zip (~500kb) and seeing if it causes similar problems on your machine?
No problem with the demo. Level music and jingles, all working. Can start and quit the program for several times without an error message.

I gonna install Win95 on a 486 (100 MHz), then I can test it on that machine, too.
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Hollister Man on Fri 30/04/2004 01:57:27
An earlier thread mentioned that Modgeulator was having problems with the game sound failing to initialize and wanted to make a plugin that would avoid that issue, and probably make some neat stuff with it too.
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Fri 30/04/2004 02:21:49
Quote from: a-v-o on Thu 29/04/2004 22:33:53
No problem with the demo. Level music and jingles, all working. Can start and quit the program for several times without an error message.
Well, I really don't know what the problem is. I have to admit, I've gone a little out of my depth programming-wise on this project (that's the only way to learn though.) Are there any experienced VC++ programmers that wouldn't mind looking through the source code to see if there's any silly mistakes I've made?

Quote
I gonna install Win95 on a 486 (100 MHz), then I can test it on that machine, too.
Thanks, that should be interesting to see if it works - you'll also need to install DirectX 8.0.

Pumaman, would there be anyway to return the DirectSound interface object in a function call? If I could access that I might be able to make this plugin work perfectly with the DirectSound driver.

Ben, are you running DirctX 8.0 or 8.1? No, you can't use those DX plugins, but there are built-in DirectMusic effects you can use (Chorus, Compressor, Distortion, Echo, Flanger, Gargle, Reverbs and a parametric EQ.)

Geoffkhan, it lets you use a DirectMusic Producer project. I don't really know how to explain it better than that, you might want to check out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dmusprod/htm/overview.asp
If you're interested in working with it you should download DMP and work through the tutorial. Be warned, it isn't the most user-friendly program to work with - but it's not impossible to figure out either.
I'd say this plugin doesn't have a very wide appeal - probably has an interest group consisting of...umm... just me, and that's all at the moment. You have to learn DirectMusic Producer to use this plugin.

No, Hollister Man, it's not to fix a problem with game sound initiliazing. It's for the neat stuff making. I think I'm just managing to confuse people more and more  :-\

Title: Re:DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Fri 30/04/2004 10:46:35
I've tried to install DirectX 8, but it told me that it doesn't support this kind of CPU; must be a Pentium or K6 class processor.  

Perhaps CJ can help to get closer to the buggy part, because after first time run neither the game exe nor the winsetup exe can be started. So the problem must be in the common part of the startup code of winsetup and game exe.

Maybe you need some finalization code in your plugin to release reserved ressources. Writing this I got another idea. When I'm back home I test if I can start other AGS games after running your demo game. And I can also test if the demo program is running when AGS isn't.

I'll report the results later.
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Sat 01/05/2004 05:25:16
Quote from: a-v-o on Fri 30/04/2004 10:46:35
I've tried to install DirectX 8, but it told me that it doesn't support this kind of CPU; must be a Pentium or K6 class processor.  

Perhaps CJ can help to get closer to the buggy part, because after first time run neither the game exe nor the winsetup exe can be started. So the problem must be in the common part of the startup code of winsetup and game exe.

Maybe you need some finalization code in your plugin to release reserved ressources. Writing this I got another idea. When I'm back home I test if I can start other AGS games after running your demo game. And I can also test if the demo program is running when AGS isn't.

I'll report the results later.

Thanks again a-v-o. I've already got finalization code in there. The plugin should already be releasing everything  and deleting all the memory pointers when AGS shuts down (called from "void AGS_EngineShutdown()").

I had another idea, how are you quitting the game? Are you quitting thru the menu or are you pressing "alt-x"?
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Pet Terry on Sat 01/05/2004 07:55:26
Hmm, I got similar happenings as a-v-o. At the game starts short snap, then everything is quiet until I interact with bluecup.

300 mHz processor
160mb RAM
Creative SoundBlaster 128 PCI
Windows 98 (finnish)
DirectX 8.1
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Sat 01/05/2004 08:26:33
Quote from: Petteri on Sat 01/05/2004 07:55:26
Hmm, I got similar happenings as a-v-o. At the game starts short snap, then everything is quiet until I interact with bluecup.

300 mHz processor
160mb RAM
Creative SoundBlaster 128 PCI
Windows 98 (finnish)
DirectX 8.1

I should edit the first post in this thread. If you're running windows 98 you have to use winsetup and turn the digital sound off completely first. Please let me know if it works after that.
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Sat 01/05/2004 08:32:57
I think I used the menu and sometimes Alt-F4 to quit the game. It seems to me that it doesn't matter.

I tried it on a Pentium 166 with Win98SE and DirectX8a installed and the sound stuff worked like on the other Win98 Computer, the difference was that I could always start the game again. So maybe this is a special problem of the other Win98 computer.
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: Pet Terry on Sat 01/05/2004 08:55:57
Yep, it seems to be working now, but, of course, I can't hear any digital sound :P

Nice change of tune between town and shop btw!
Title: Re:DirectMusic plugin (TEST release - please look)
Post by: modgeulator on Sat 01/05/2004 14:03:22
Quote from: a-v-o on Sat 01/05/2004 08:32:57
So maybe this is a special problem of the other Win98 computer.
I think I figured out the problem. I was compiling the game using an outdated version of AGS, and the engine shutdown event is only called by the latest version - so my code to release everything wasn't being executed at all...
I've compiled a new exe using the latest version of AGS. Try extracting this over the current demo: http://members.iinet.net.au/~snderson/DMDemo_fixed_exe.zip
hopefully you should be able to quit and restart the game without problems now.
Title: Re: DirectMusic plugin (TEST release - please look)
Post by: a-v-o on Mon 03/05/2004 22:36:45
Yes, now it can be restarted without probems.
:D
Title: Re: DirectMusic plugin (TEST release - please look)
Post by: Gregjazz on Wed 04/08/2004 23:22:50
Okay, I'm interested. One question though: would I be able to use this plugin in conjunction with the AGS PlayMusic/PlaySound stuff?

(sorry for bringing this thread back up from the dead)

EDIT: Never mind about that question, I've figured it out. Great plugin, by the way!
Title: Re: DirectMusic plugin (need help here, C++ programmers?)
Post by: modgeulator on Thu 19/08/2004 07:42:07
Thanks. This thread might seem dead but this little project isn't.
Currently you can't use it with the AGS Allegro stuff. Well you sort of can, but it's a dodgy workaround and won't work on Win 95/98/ME computers.

Here's where I'm stuck at the moment:
CJ added a "GetDirectSound()" which hopefully should be able to be used to initialize the DirectMusic stuff inisde the AGS stuff and have everything working together. But unfortunately the newer code for "GetDirectSound()" in the updated "agsplugin.h" conflicts with an include file I need for the DirectMusic code. The LPDIRECTSOUND object in "agsplugin.h" causes a redefinition error with the LPDIRECTSOUND object in "dsound.h" (an include file the DirectMusic code requires.) I'm too crappy a programmer and haven't been able to figure out a way to fix this.

Changing the order of the include files only changes where the redefinition error is raised, the only way I can compile is by commenting out the DirectSound code in "agsplugin.h"

If anyone wants to have a look over the source code I've posted it here:

http://iinet.net.au/~snderson/DirectMusic_plugin_source.zip

It's a bit of a messy cut and paste job, I know. You'll need the DirectX 8.1 SDK to compile it.


EDIT: Thanks Pumaman, adding an include for ddraw.h fixed it.

Edit by strazer:

I've contacted Modgeulator about the status of this plugin. This is what he had to say:

"It's still being worked on occasionally. That said, I don't think it's ever going to have any sort of appeal to anyone other than myself, so I'm wasn't planning on releasing anything else publicly. If anyone wants to use DirectMusic for their game they can feel free to message or email me and I'll give them what I have and any other assistance I can provide."
Title: Re: DirectMusic plugin (need help here, C++ programmers?)
Post by: Pumaman on Thu 19/08/2004 19:34:12
My mistake, it kinda assumes that you're using DirectDraw when that's not necessarily the case.

The simplest workaround is simply to #include <ddraw.h> BEFORE #including the agsplugin.h
Title: Re: DirectMusic plugin (need help here, C++ programmers?)
Post by: Janik on Wed 26/10/2005 03:27:45
Quote from: modgeulator on Thu 19/08/2004 07:42:07
Here's where I'm stuck at the moment:
CJ added a "GetDirectSound()" which hopefully should be able to be used to initialize the DirectMusic stuff inisde the AGS stuff and have everything working together. But unfortunately the newer code for "GetDirectSound()" in the updated "agsplugin.h" conflicts with an include file I need for the DirectMusic code. The LPDIRECTSOUND object in "agsplugin.h" causes a redefinition error with the LPDIRECTSOUND object in "dsound.h" (an include file the DirectMusic code requires.) I'm too crappy a programmer and haven't been able to figure out a way to fix this.

Changing the order of the include files only changes where the redefinition error is raised, the only way I can compile is by commenting out the DirectSound code in "agsplugin.h"

If anyone wants to have a look over the source code I've posted it here:

http://iinet.net.au/~snderson/DirectMusic_plugin_source.zip

I know this is an ancient thread, but I'm very interested in seeing how you got direct music to work in the plugin. Unfortunately the link to the source seems to no longer be valid, could you possibly make it available again (or email it to me at jzikovsky at hotmail dot com)?

I have tried using "GetDirectSound" but for some reason it always returns NULL - even though the sound works. It does not matter if I set the game to use DirectSound, WaveOut, No sound, etc. And I don't know anything about initializing/using direct sound or directmusic myself - so your source would be great!

Thanks!
Title: Re: PLUGIN: DirectMusic plugin
Post by: modgeulator on Wed 26/10/2005 05:50:26
I re-uploaded the old file to the same location so the link should now work again.
http://iinet.net.au/~snderson/DirectMusic_plugin_source.zip


Not sure how much use it will be. It was some hacked about code I adapted specialised to loading DirectMusic Producer runtimes. It was never intended for playing back normal sound or music files.
Basically you put together all your sound and music resources in DirectMusic Producer and then call routines from AGS using DMRoutine("[routinename]");
The main intention is to be able to recreate the kind of music tricks they had in the old LucasArts iMUSE games. So for example, when you leave one room and go to another it would call up a routine in the DirectMusic Producer project that would cause the music to play a transition piece at the end of the next measure then continue into a new variation or tune, etc, etc.
But yeah, I never could get it to work properly alongside the AGS audio engine, and it's only good for playing back DirectMusic Producer runtimes, not normal audio/MIDI files.
There's plenty of great source code out on the web you should be able to find for that, though.
Title: Re: PLUGIN: DirectMusic plugin
Post by: strazer on Wed 26/10/2005 12:51:40
Since it seems to be of so little use, I'm removing this from the archive.
Title: Re: PLUGIN: DirectMusic plugin
Post by: modgeulator on Wed 26/10/2005 13:21:23
I'm sorry I ever posted about it in the first place then, Strazer.
Title: Re: PLUGIN: DirectMusic plugin
Post by: Pumaman on Wed 26/10/2005 18:40:53
Hehe I don't think he meant it like that -- rather just that since it's a very specialized piece of code, it's probably not appropriate to the Tech Archive :)
Title: Re: PLUGIN: DirectMusic plugin
Post by: strazer on Wed 26/10/2005 21:16:00
Exactly. Sorry for any misunderstandings.
Title: Re: PLUGIN: DirectMusic plugin
Post by: Janik on Thu 27/10/2005 03:25:08
Quote from: modgeulator on Wed 26/10/2005 05:50:26
I re-uploaded the old file to the same location so the link should now work again.

Not sure how much use it will be. It was some hacked about code I adapted specialised to loading DirectMusic Producer runtimes. It was never intended for playing back normal sound or music files.
Thank you for making it available again. From my quick reading of the DirectX documentation, it says that DirectMusic basically contains all the features of DirectSound, like playing back audio files. So I think that it might be expanded for more general use; but I don't know enough about it for now...
Title: About the old DirectMusic Plugin
Post by: TheMagician on Tue 11/12/2007 10:29:53
Hi everybody.

This thread is about the "DirectMusic Plugin" for AGS.
The plugin was created by 'modgeulator' in 2004 (the current AGS version back then was 2.62).
The original thread can be found here: Original Thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=13531.0)

In the middle of the second page of this original thread modgeulator fixed an issue where the plugin would only work when "No DirectSound" was checked in WinSetup. CJ gave him an advice how to workaround the problem and modgeulator uploaded a new version of the plugin here:

Latest source code of the plugin (http://iinet.net.au/~snderson/DirectMusic_plugin_source.zip)

However, as you can see this upload contains the source code which has to be compiled.

So here is my first question: can anybody please compile this source code and upload the .dll file? modgeulator mentions that you need the DirectX 8.1 SDK to compile the files but that's beyond my programming knowledge.

And secondly I would be very glad if someone could have a look at the source code and tell me whether there is a simple answer to the following issue:
As I said, this plugin was created when AGS 2.62 was the current version. In the new AGS 3 RC 1 I get an error when I try to test my game using F5 and I think I tracked down the problem to the following:
When the game is started the plugin looks for two files:
'AGSGame.aud' and
'AGSGame.spt'
I created two identical test games with both  AGS 2.62 and AGS 3.
If one of the two files is missing in the games' main Compiled folder AGS 2.62 gives the same error as AGS 3 so I think the problem is that the plugin can't find the files.
However, if I include all the files in the Compiled folders AGS 2.62 tests the game without any problems while AGS 3 still gives the same error.

I can understand that this plugin is not of great use for many people so I would really appreciate it if one of you would be so generous and help me out (it's Christmas time after all  ;)  )
Stefan

P.S. I also contacted modgeulator about these issues but he hasn't been active on these forums for a while now.
Title: Re: About the old DirectMusic Plugin
Post by: Pumaman on Tue 11/12/2007 19:57:04
With AGS 3, try building the EXE file (F7) and the running it manually. If that works, then copy the files to the _Debug folder as well as the Compiled folder.
Title: Re: About the old DirectMusic Plugin
Post by: TheMagician on Tue 11/12/2007 20:44:58
Hi CJ,
the first part of your suggestion worked:
doing an F7 comile and then run the game manually from the Compiled folder works.

However, if I then copy all the files (including the plugin dll) into the _debug folder and do a F5 compile I get the old error again.

This is the error message, but I doubt it tell's you anything more than that the plugin causes the crash.

---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x014457A5 ; program pointer is -23, ACI version 3.00.960, gtags (0,0)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.



Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.

An error file CrashInfo.dmp has been created. You may be asked to upload this file when reporting this problem on the AGS Forums. (code 0)
---------------------------
OK   
---------------------------
Title: Re: About the old DirectMusic Plugin
Post by: Pumaman on Tue 11/12/2007 20:56:16
Try putting a copy of all the plugin files in the game folder as well.
Title: Re: About the old DirectMusic Plugin
Post by: TheMagician on Tue 11/12/2007 21:07:52
Ah, that's messy but it works.
So in order to use the F5 command I need the plugin and all associated files in the Compiled-, _debug- and Game-Folder?

And another short question:
The plugin uses only one function: DMRoutine(string);

If I type DMRoutine("PlayBackground");

I get an error: Type mismatch: cannot convert 'const string' to 'string'

What do I have to type instead?
Title: Re: About the old DirectMusic Plugin
Post by: monkey0506 on Tue 11/12/2007 21:38:35
That would be because as of AGS 2.71 any string-literals, i.e. the text "PlayBackground" (including quotes), are defined as const strings so-as to be compatible with the new String type. The only workarounds in this situation are to rebuild the plugin (changing string to const string where appropriate within the plugin) or to stick to AGS 2.7 or earlier. :-X
Title: Re: About the old DirectMusic Plugin
Post by: TheMagician on Tue 11/12/2007 21:59:20
Thanks monkey. I understand.
Sticking to <2.7 is not an option so I wonder: if I wanted to go through the plugin source code what would I need to do that? Does the DirectX SDK provide the necessary tools to view change and compile the code? Or do I need even more advanced stuff like Visual Studio or something?
Title: Re: About the old DirectMusic Plugin
Post by: Scorpiorus on Tue 11/12/2007 22:02:22
As SSH suggested in the past, another, quite messy yet working method would be to set up a temporary "string" variable and pass it instead:


string temp;
StrCopy( temp, "PlayBackground" );
DMRoutine( temp );


You can probably write a wrapper for each function that expects "string" as parameter.

Or write a converting function to return "string":


string buffer;
string to_string( const string text )
{
    StrCopy( buffer, text );
    return buffer;
}

...

DMRoutine( to_string("PlayBackground") );


Just avoid using the last method when passing to function defined in the script and not a plugin as it can potentially mess things up if not handled properly.
Title: Re: About the old DirectMusic Plugin
Post by: TheMagician on Tue 11/12/2007 23:51:45
Scorpiorus, your suggestion to write a converting function to return "string" works very well.
Just for the sake of completeness (if anybody is trying to use this code as well) you need to deactivate "Enforce new-style strings" in the general game settings to use the type string used in Scorpiorus' code.

The remaining question is:
what software do I need to have a look at the plugin's source code (http://iinet.net.au/~snderson/DirectMusic_plugin_source.zip) and to modify and recompile it? Does the DirectX SDK suffice or do I need Visual Studio?
Title: Re: About the old DirectMusic Plugin
Post by: scotch on Wed 12/12/2007 00:54:57
You can read and modify the c++ code in whatever text editor you prefer, but yes you'll need both VS and the DX SDK to compile it. The free Visual C++ Express is enough.
Title: Re: About the old DirectMusic Plugin
Post by: Scorpiorus on Wed 12/12/2007 16:57:08
Quote from: TheMagician on Tue 11/12/2007 23:51:45Just for the sake of completeness (if anybody is trying to use this code as well) you need to deactivate "Enforce new-style strings" in the general game settings to use the type string used in Scorpiorus' code.

Ah yeah indeed, sorry for not having mentioned that bit. I'm glad you got it compiled anyway :)