So, I looked through the thread a bit and saw that this is indeed open source, and I was able to make some modifications and compile them. See below for DFFD links.
---1---
First off, a guide to compiling modifications without being able to build the whole ant thingy. Because...
Er, did that work? If not, hard link:
http://memegenerator.net/instance/32409495Go to build.xml in the source. Find the "classpath" line that has something like "./lib/jl1.0.1.jar;./lib/freetts-1.2/freetts.jar;./lib/commons-codec-1.4/commons-codec-1.4.jar;./lib/autoUpdater.jar;./lib/jansi-1.8.jar". Copy this.
Copy the folder soundsense/lib to [source folder]/lib. If you want, copy the existing soundSense.jar to it if you don't want to recompile all the parts but only the modified ones.
Open the command prompt. Go to the source folder. Enter (pasting [try right-click...] the path from build.xml):
>javac -classpath "./lib/jl1.0.1.jar;./lib/freetts-1.2/freetts.jar;./lib/commons-codec-1.4/commons-codec-1.4.jar;./lib/autoUpdater.jar;./lib/jansi-1.8.jar;[./lib/soundSense.jar]" ./src/cz/zweistein/df/soundsense/[paths/files you wish to compile, in order of dependency]"
If this doesn't work, you need to have a java compiler properly installed -- it's been so long since I set that up that I couldn't tell you how to do it... last I recall Java versions and compiler setup was a scarey place I don't feel like revisiting, but if all else fails and you're not already part of some Java project that would connect you with expertise in the matter, you can always uninstall everything Java you have and install the latest JDK and it ought to wind up right. (Sorry I can't be more helpful there.)
Anyway, repeat this last step as necessary to compile all changed parts, keeping in mind to do the ones that are dependent on others only after the ones on which they depend.
Open up soundSense.jar -- for those of you who don't know, a jar is just a zip by another name! Remove the existing class files for the part(s) you modified. Copy in the parts you just compiled in their place(s).
Make sure this modified jar gets back in the soundsense folder and you're good to go!!
I would recommend putting such instructions on the wiki. Possibly along with instructions in compiling the whole thing properly using ant or whatever so that it gets the build designation updated. Might want to put instructions in that as to how to tag it as a modified branch. I manually opened my jar and changed the version.properties inside it to list it as release 36-mod, increment the build number and update the date/time built.
---2---
While we're talking about that, more stuff that should go on the wiki:
The playing of a random seasonal music upon fortress load is not hardcoded! It's under system, and is triggered by fortress loading log messages. The start of a new fortress happens to trigger the same list of stuff as Spring, nicely. 8^) Furthermore, you can look through the list of seasonal messages, find the one for the current season, click it, and click the play button at the bottom, and Soundsense will behave correctly for that season for the remainder of the season! Sure it's a manual trigger, but it's handy to know.
(I had the idea to add some functionality to allow things like fortress loading to somehow redirect to a random one of the seasons. While it was feasible, it turned out to be more trouble than such a feature is worth. Just copy-paste all the seasonal listings into the fortress loading sound when you're creating/updating a pack, at least for now.)
---3---
I have uploaded some modifications to the DFFD [see below], both the source and the updated jar file.
One thing I did was allow an xml file to have an includeDirectory tag with a "path" attribute specifying another pack or part of another pack to include in this one. Basically this allows you to mix and match pack parts much more easily: you can leave the official pack alone (perhaps just move it to soundsense/packs/OfficialPack) and build your own, entirely separate packs and pack pieces, then you can point to a particular directory that just contains a list of pack pieces to combine!
Example of new format: let's say I have the official pack moved to soundsense/packs/OfficialPack, and my current pack path pointed at ./packs/FireflyPlusActionLines/, then...
soundsense/packs/FireflyPlusActionLines/combine.xml could contain:
<includeDirectory path="./packs/Firefly/"/>
<includeDirectory path="./packs/ActionLines"/>
This brings me to another point: I made the directory loading add a / if there is niether / nor \ at the end of it. So if you forget to end in / or \, no big deal!
Here's another example: let's say that the official pack separated seasons into seasons/music and seasons/announcements; then, I could have...
soundsense/packs/Bare/include.xml contain:
<includeDirectory path="./packs/OfficialPack/seasons/music/"/>
<includeDirectory path="./packs/OfficialPack/weather/"/>
[and maybe a few things like discovering vast caverns underground]
...and soundsense/BarePlusActionLines/combine.xml contain:
<includeDirectory path="./packs/Bare/"/>
<includeDirectory path="./packs/ActionLines/"/>
(By the way, I imagine this "action lines" custom pack would be made of clips from famous movies... but frankly, I'd like to hear Rainseeker record a martial trance announcement, "I came t' pulverise elves wi' their own pointy ears, an' to eat opposum cheese... Ach, an' I be all outta opposum cheese!")
I do recommend the official pack separate seasonal announcements and music into separate directories so things like this can be done without regard to threshold settings -- I might want to have my own seasonal announcements in ActionLines with normal threshold settings even if the seasonal announcements weren't on the same priority as the weather (which they are by default, so...).
Anyway, the point here is that you can mix and match packs and pack pieces without having to extensively modify the sound listing xmls in any given pack, especially the default.
I also made it prevent infinite loops by tracking the absolute paths of directories it's parsed and refusing to parse the same one twice. This is helpful even without the inclusion of packs and pack parts because a devious OS user could achieve similar effect with symbolic links (but this is difficult to do and comes with more problems/limitations, so). It's just a good safety feature.
ETA: Now in version 2.0 you can also use <includeListing filePathAndName="pathto/sounds.xml"/> if you don't want to deal with separating everything into directories; would still require, say, seasonal music and announcements be separated into two .xml files, but not the whole directory separated. One thing I'm using this for is to include adventurer/enviroment.xml without the rest of the adventure mode sounds.
---4---
Of course, what's mixing and matching packs good for unless you can easily switch which one or which combination you're playing with? So now, the configuration xml's soundpacks tag, instead of expecting "path", expects "defaultPath" and "allowOverride". Set allowOverride to false to always use the defaultPath. Set it to true and Soundsense will ask you to confirm or change the path when it loads or reloads. Handy, no?
ETA: I just noticed that it was still saying "Done loading [configuration directory]..." rather than "Done loading [chosen directory]..." if you selected a different directory than the default. I changed configuration.getSoundpacksPath() in that line to soundsXML.toString() and uploaded this last tweak to the DFFD file. This probably doesn't matter in the long run unless you're zwei and are planning on putting the allow-user-to-choose-pack-directory-on-load/reload feature into the... uh, "main branch"? ;^)
---5---
It's not source code, but I also fixed Achievements.xml to use the mining message log pattern for the mineral deposit achievements (had been using the cat butchering log pattern!), and fixed the two cmds to run Achievements and MissingMessages so they'd include ./lib/jansi-1.8.jar and would actually work. ;^)
---DFFD---
With JAR.Without JAR.---FIX FOR MUSIC NOT PLAYING---
This may or may not solve all everyone's music not playing issues, but it solved mine...
Go to
http://www.javazoom.net/mp3spi/sources.htmlGet version 1.9.5 of mp3spi.
Open up the zip.
Copy mp3spi1.9.5 to soundsense/lib/MP3SPI and delete mp3spi1.9.4 from that folder.
Go to "lib" in the zip.
Copy jl1.0.1 to soundsense/lib/MP3SPI and delete jl1.0 from that folder.
If you can figure out how to recompile the exe to use these, do so. I can't. But read on!
Edit soundSense.cmd: where it points classpath to mp3spi1.9.4, change that to mp3spi1.9.5, and where it points to jl1.0, change to jl1.0.1. You can now run Soundsense using soundSense.cmd and have everything work! I have added the updated soundSense.cmd to the zip downloads on DFFD, but it won't do you any good unless you replace the jars from
http://www.javazoom.net/mp3spi/sources.htmlThis upgrade should probably be incorporated into the main release at some point, obviously.
I am working on tracking down info for an error report on Soundsense (even before I modified it) not being able to play some of the official packs' music, and will likely be back with more info on that.
ETA: Back! I had to add some logging/stackprinting to the class where the exception occurs, but this is what I get now:
24/12/2012 05:55:49.243: Listening to ../gamelog.txt
24/12/2012 05:56:02.846: Setting 0.0 gain for manual playback
24/12/2012 05:56:02.846: Channel playing .\packs\OfficialPack\seasons/autumn/Skye Cuillin.mp3
24/12/2012 05:56:02.862: manual playback: .\packs\OfficialPack\seasons/autumn/Skye Cuillin.mp3
24/12/2012 05:56:02.862: Opening '.\packs\OfficialPack\seasons/autumn/Skye Cuillin.mp3'
24/12/2012 05:56:02.909: Failed to open .\packs\OfficialPack\seasons/autumn/Skye Cuillin.mp3 propably download error or configuration mistake.
24/12/2012 05:56:02.909: java.io.IOException: Resetting to invalid mark: Resetting to invalid mark
java.io.IOException: Resetting to invalid mark
at java.io.BufferedInputStream.reset(Unknown Source)
at org.tritonus.share.sampled.file.TAudioFileReader.getAudioInputStream(TAudioFileReader.java:324)
at javazoom.spi.mpeg.sampled.file.MpegAudioFileReader.getAudioInputStream(Unknown Source)
at javazoom.spi.mpeg.sampled.file.MpegAudioFileReader.getAudioInputStream(Unknown Source)
at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
at cz.zweistein.df.soundsense.output.sound.player.SPIPlayer.play(SPIPlayer.java:54)
at cz.zweistein.df.soundsense.output.sound.player.ChannelThread.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Googling this issue tells me to go here:
http://www.javazoom.net/mp3spi/sources.html to get version 1.9.5 of that library. Replacing the 1.9.4 in the lib folder of Soundsense now gets me this error instead:
24/12/2012 06:09:18.588: Exception with .\packs\OfficialPack\seasons/autumn/Skye Cuillin.mp3: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file: could not get audio input stream from input file
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
at cz.zweistein.df.soundsense.output.sound.player.SPIPlayer.play(SPIPlayer.java:54)
at cz.zweistein.df.soundsense.output.sound.player.ChannelThread.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Well, that's... interesting... I wonder if this is due to the encoding format being different, or some other corruption?
ETA2: Only thing Google has turned up for me on the matter is this:
http://stackoverflow.com/a/4672453 which I think would involve figuring out how to get javazoom.spi.mpeg.sampled.file.MpegAudioFileReader into the... project? Classpath? "What. Ev. Er." ~Dr. Horrible
Let me know if anybody else has good leads; it happens to some of the files from the official pack (as shown in the exceptions above) and to some, but not all, of my own music that runs fine in Windows Media Player as well as iTunes. If there's anything I can actually check to track down the problem...
ETA3: Holy magma, batdwarf! It just happened to system/Radakan - Moldan Chase over (success).mp3, a.k.a. what the official pack plays when you load DF and what used to play successfully for me until today. That means either A) there's an element of randomness involve or B) things are corrupting/breaking that were fine initially!! ETA3a: It's happening to flat out everything now, actually. I am going to double-check that nothing happened to my pack, possibly roll back the change I made to the sound player to get it to print the stack trace when this happens, double-check one or two other things and see if I can figure out what happened that suddenly broke everything. Will be back with results shortly.
ETA4: Soundpack was fine. Rolling back the loggy version of the player didn't help. Then it hit me: of course the EXE would be looking for version 1.9.4 of that library I upgraded to 1.9.5! So I went back to the zip it came in and made sure I also replaced jl1.0 with jl1.0.1 (which was in there too under "lib", which I hadn't looked at before) and then I set Soundsense.cmd to add 1.9.5 and jl1.0.1 to the classpath instead of 1.9.4 and jl1.0, and -- PRESTO! -- instant soundtracky working goodness!!! And my own tracks work too! Oh yes, yes, yes!
I think I will spoiler all these ETAs and write up a brief explanation of fixing this whole matter, in a moment -- first I want to take care of some unrelated stuff that's come up over here.