*COMPLETED* MapTool b89 with Streaming Sound Functionality

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

*COMPLETED* MapTool b89 with Streaming Sound Functionality

Post by Lord.Ashes »

MapTool-1.3.b89s Rev 5
MapTool-1.3.b89 with Sound And Cache Support

EDIT: *** REVISED: 2013/08/07 ***

8) I have implemented a modification to MapTool version 1.3.b89 which adds Macro Functions for streaming sound from an external audio web server to MapTool clients (all connected players). Functionality also include ability to limit sound functions to GM, cache sound files for re-use, enable or disable sound functions on the client side, and more. 8)

Note: This is an implementation based on using an external audio server to stream the desired audio - not using MapTool assets - thus it does not increase the size of campaign files (as it would if it was implemented using MapTool assets) but it does require the use of an external web-server capable of streaming such as XAMPP or DropBox.

The modification is available both as a Eclipse patch file and a ZIP archive containing the new build. Along with "How To Use" documentation (which details all features) the modification files can all be found at the link below. In case someone is interested in following the code changes between revisions, I have included the files for each revision in their respective revision folder. Typically, if you just want to use the modification, get files from the highest revision.

http://www.mediafire.com/folder/ejadl2lz4drok/MapTool


Known Bugs:

* CacheCleaner is currently only compatible with Java7 because it relies on nio.
I am hoping to have a solution that works with Java6 by the end of next week.
If you currently are using Java 6.x then please use MapTool-1.3.b89s Rev 4
(the latest rev without CacheClearner) for the moment until I patched this in
Maptool-1.3.b89s Rev 6.


A Revision Log follows:

Rev 1.0:

* Two channels of audio capable of independently playing at the same time while MT is being used (allowing it to be used for sound effects while playing background music).
* Starting and stopping audio.
* Looping audio for any number of repetitions (including infinite).
* Ear Plugs for disabling the audio feature for either or both of the audio channels.

Rev 2.0:

* Visual cues in the Chat Window for users that are using Ear Plugs.
* Added distribution of audio cues to other players (i.e. all connected players play the requested audio)

Rev 3.0:

* Option to play sounds on local machine only (i.e. do not sent audio cues to other connected players)
* Functions for determining if all players can initiate audio or only the GM

Rev 4.0:

* Sounds are cached locally, if OS allows it, for faster reuse
* Sounds are played from local source if the requested sound had been cached locally
* Function for pre-loading (caching) sound files in advance
* Function for stopping sound now has options for an abrupt stop or a graceful stop
* Improved Looping

Rev 5.0:

* Added CacheCleaner Rev 3.0 (see http://forums.rptools.net/viewtopic.php?f=3&t=24102 for details)
* For compatibility with CacheCleaner, cached sounds are now stored in the MapTool assetCache directory (as opposed to the MapTool resource directory)
* Support for Server Side No-Cache Honorary system (which basically allows the server to tell MapTool not to cache certain files)
How To Use MapTool-1.3.b89s Rev5.txt
(16.22 KiB) Downloaded 120 times
MapTool-1.3.b89s_Patch Rev5.txt
(32.13 KiB) Downloaded 87 times
Last edited by Lord.Ashes on Thu Aug 15, 2013 5:35 am, edited 9 times in total.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by Lord.Ashes »

Bug Report:

* Visual cues are missing.
* Currently the sounds are not sent to the other players.

I apologize for this, I broke this functionality when migrating from Chat Commands to Macro Functions and somehow completely forgot to test that.
In the meantime you might be able to get similar functionality by using MapTool's MacroLink but I will have it fixed in a couple of days.
Again, I apologize for posting this solution with such a major bug.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by wolph42 »

can't you simply use dropbox for a repository function?

automatically sending to other players might not be the best idea. I prefer to use the autoexec function for that, but opinions may differ.... I have to admit that it makes sense to send the sounds to all clients.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by JamzTheMan »

Lord.Ashes wrote:Bug Report:

* Visual cues are missing.
* Currently the sounds are not sent to the other players.

I apologize for this, I broke this functionality when migrating from Chat Commands to Macro Functions and somehow completely forgot to test that.
In the meantime you might be able to get similar functionality by using MapTool's MacroLink but I will have it fixed in a couple of days.
Again, I apologize for posting this solution with such a major bug.
Ignore my other comment in the other thread. :) I personally (for MT) would say it should be used with macrolink only. I wouldn't want other players sending sounds to other players in a "Roleplaying" environment, that would be GM territory. Although I could be convinced to allow it, but only with proper "options" or "checks", like no autoexecution, player would have to click the links to play the sounds and/or be able to refuse them. Although, that could be said for GM sounds as well. Or at least check the system sounds on/off option first, I could see where players are playing late at night and not want to wake other people (or maybe they really just want to listen to their Pandora)

But for what you are doing, it makes sense.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by Lord.Ashes »

wolph42 wrote:can't you simply use dropbox for a repository function?

automatically sending to other players might not be the best idea. I prefer to use the autoexec function for that, but opinions may differ.... I have to admit that it makes sense to send the sounds to all clients.
Sorry I think I expressed myself incorrectly...

I am not actually sending the sound to the other players, I am sending the sound request which is resolved locally (i.e. each client streams it from the external audio repository). Originally I had implemented this as sort of chat commands and when I moved it to Macro Functions, as was suggested by others, I accidentally broke this link.

I have resolved it now and tested all functions using a remote client connected to the server.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by Lord.Ashes »

JamzTheMan wrote:
Lord.Ashes wrote:Bug Report:

* Visual cues are missing.
* Currently the sounds are not sent to the other players.

I apologize for this, I broke this functionality when migrating from Chat Commands to Macro Functions and somehow completely forgot to test that.
In the meantime you might be able to get similar functionality by using MapTool's MacroLink but I will have it fixed in a couple of days.
Again, I apologize for posting this solution with such a major bug.
Ignore my other comment in the other thread. :) I personally (for MT) would say it should be used with macrolink only. I wouldn't want other players sending sounds to other players in a "Roleplaying" environment, that would be GM territory. Although I could be convinced to allow it, but only with proper "options" or "checks", like no autoexecution, player would have to click the links to play the sounds and/or be able to refuse them. Although, that could be said for GM sounds as well. Or at least check the system sounds on/off option first, I could see where players are playing late at night and not want to wake other people (or maybe they really just want to listen to their Pandora)

But for what you are doing, it makes sense.
:) I knew I would get someone that would say this. In my documentation for these added Macro Functions, I actually talk briefly about this. There are generally 3 opinions on use of Sounds in MT: 1) Don't, 2) Yes From Assets and 3) Yes From External Repository. As I wrote in my Docs, if you are Type 1 then I say "Don't use my mods...no one is forcing you". If you are Type 2 then I say "Sorry that I not what I implemented - you'll have to wait for someone else to implement it". For Type 3, I say "Here you go!".

But to address this issue, I have Macro Functions for earPlugs. This is a Macro Function that sets a local setting to determine if audio will or will not be played. Since this is a local setting (which can be changed during play but not by others) a player can elect to get sounds or not. For those that choose not to, there is a visual cue in the Chat Window that indicates when players have triggered audio (since a player may be using audio to communicate).

You could also implement the sound functions on a Library Token to which only GM has access.
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
Lord.Ashes
Dragon
Posts: 350
Joined: Wed Jul 03, 2013 5:58 am

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by Lord.Ashes »

Lord.Ashes wrote:Bug Report:

* Visual cues are missing.
* Currently the sounds are not sent to the other players.
Done! Both these items have been fixed and tested with a remote client connecting to the server on a Windows machine.

Once again, my apologies for such a huge blunder.

The link in the initial post should still be valid and they have been replaced with corrected versions (hence the appended "Rev 2").
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by wolph42 »

Lord.Ashes wrote:
wolph42 wrote:can't you simply use dropbox for a repository function?

automatically sending to other players might not be the best idea. I prefer to use the autoexec function for that, but opinions may differ.... I have to admit that it makes sense to send the sounds to all clients.
Sorry I think I expressed myself incorrectly...

I am not actually sending the sound to the other players, I am sending the sound request which is resolved locally (i.e. each client streams it from the external audio repository). Originally I had implemented this as sort of chat commands and when I moved it to Macro Functions, as was suggested by others, I accidentally broke this link.

I have resolved it now and tested all functions using a remote client connected to the server.
you didn't answer my question. You reassured the fact that the sound needs to be retrieved from a 'common' server (aka repository), which confirms my idea that you can use dropbox for that (the public directory). So... is it or isn't it (usable as a repository for this function)?

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by jfrazierjr »

Lord.Ashes wrote: To the third group I say, "Voila! Your solution is here!".

........

I implemented my solution using an external audio web server on purpose. This allows the user to build a single audio web server repository which can then easily be re-used in multiple campaigns without the Campaign file having to include the audio file. I assume it may be possible to build MapTool assets which link to the sound file instead of including it in the Campaign file but in that case the purpose is somewhat lost. In any case, my implementation uses an external audio web server to stream the audio. If you don't have one, I use XAMPP Portable which is a free Apache based web server that does not need any "installation". This is what I have used for my testing.
IMHO, you only have half a solution with this approach. There are many non-technical people who have no idea how to set up any kind of server to actually implement this feature, so it's really not very useful for the casual user who want's to use sound. I do see that you point to XAMPP, but without some guidance, the non technical people would be quite confused and not really able to implement without some guidance. I have not used the above, so I have no idea how friendly it is or not. Where do the files go on the file system to make this work? or does XAMPP include an "import" ability to pull files from where ever and make them available at a specific URL? Also note that unless I am missing something, XAMPP could likely only be used for a local group and(likely) not for on scattered across the internet(with more configuration such as either a static IP address or dynamic DNS service).

I really am not trying to be negative or denigrate your efforts, just trying to point out some things that you may not have thought of. Being a technical person myself(developer), I often find that things I find painfully obvious are totally missed on "normal"(subhuman..heh... :twisted: ) people.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by wolph42 »

Well IF any repos like Dropbox also works, I think it's an overcome-able pain for non techies. Then again me being part über human might suffer the same affliction as you just pointed out. Overall, I guess the best solution is when sound files can be added and accessed as tokens. Eg image:door with the equivalent sound:door as its then accessible throughout the campaign file. But me guessing it's not a trivial implementationion.

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by jfrazierjr »

wolph42 wrote:Well IF any repos like Dropbox also works, I think it's an overcome-able pain for non techies. Then again me being part über human might suffer the same affliction as you just pointed out. Overall, I guess the best solution is when sound files can be added and accessed as tokens. Eg image:door with the equivalent sound:door as its then accessible throughout the campaign file. But me guessing it's not a trivial implementationion.
Well.. it could be for the simple case. There are a few people I have seen who have added sounds to their own personal build at a very basic level.

As for dropbox, I am actually wondering if that DOES work. For Dropbox, each file has a URL that is NOT the same name as filename, so I can't see how setting up a repository in dropbox would work.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by Full Bleed »

Kudos for taking a big step in the right direction!

I think having the Audio Server option is a really nice option to have and I am happy to see someone creating a working sound option, but I will wait until an asset method is integrated (either on a lib token or a table.)

In addition to this implementation introducing a technical hurdle to overcome (and I'm sure it's not all that difficult to setup XAMPP), it sounds like the streaming method doesn't cache repeated use of sounds. This could be taxing to some connections and I'd prefer to use the model currently used in MT where the client caches assets and calls them locally on repeated use.

Further, I'd like to see something like this submitted as a patch to the core MT software rather than see it as a custom build. I hope this build ultimately leads to an official patch/update.

Thanks for taking this on.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by JamzTheMan »

wolph42 wrote:Well IF any repos like Dropbox also works, I think it's an overcome-able pain for non techies. Then again me being part über human might suffer the same affliction as you just pointed out. Overall, I guess the best solution is when sound files can be added and accessed as tokens. Eg image:door with the equivalent sound:door as its then accessible throughout the campaign file. But me guessing it's not a trivial implementationion.
Wolf, if you want to play around with how that would work, it is actually in my version p jar. Just add any .mp3 to a repository and it'll show up as an asset. The macro command is playAudio([token id]) and can be played remotely via [macrolink("screamer","playAudio@lib:PlayAudio","all", "argsHere", id)]

Lord.Ashes is much farther along though in functionality. I'm going to take a look at his and see if I can merge our efforts a little. I still have more work on the asset classes as if you change the image to a sound asset right now, it'll break it. If I were to do this for 2.0 I would treat this as a different sort of "asset", not a typical token. In fact, it probably shouldn't even be required as a token, just a list of sounds files globally available to a campaign?

On one side, I see the appeal of Lord.Ashes "sound server" so you don't have to repackage common sounds in a campaign over and over. But on the other hand, if you have a sound unique to a campaign, say a npc speech or such, the user should have an "easy" way to include it without needing a server setup.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by JamzTheMan »

jfrazierjr wrote:
wolph42 wrote:Well IF any repos like Dropbox also works, I think it's an overcome-able pain for non techies. Then again me being part über human might suffer the same affliction as you just pointed out. Overall, I guess the best solution is when sound files can be added and accessed as tokens. Eg image:door with the equivalent sound:door as its then accessible throughout the campaign file. But me guessing it's not a trivial implementationion.
Well.. it could be for the simple case. There are a few people I have seen who have added sounds to their own personal build at a very basic level.

As for dropbox, I am actually wondering if that DOES work. For Dropbox, each file has a URL that is NOT the same name as filename, so I can't see how setting up a repository in dropbox would work.
Jz, I was thinking more about this. In theory, MT knows about all files in a "repository", correct? Although a asset/token is generally not in "scope" until you drag it on a map. But I should be able to code a reference via md5 to any asset in a repository right? Although, you would have a "naming" problem I guess. In a macro you would have to reference it by name, not md5 and there could be the same name twice. Or am I way off base with how MT cache's assets?

Just thinking, if we could solve that, then you would just upload a "mt repository" of sound files like any other asset, which is standard practice more or less, and could then use drop box... I suppose if it were easy, it would be easy to fix/add the asset search function to search all folders which is another thing I'd love to have. But this is probably a big bite to take...

Sorry for the hijack, back to your patch. :) If I get anything solid with assets, I'll pass it along and you can use parts of it or not. More options are sometimes good (sometimes not).
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: *COMPLETED* MapTool b89 with Streaming Sound Functionali

Post by jfrazierjr »

JamzTheMan wrote: If I were to do this for 2.0 I would treat this as a different sort of "asset", not a typical token. In fact, it probably shouldn't even be required as a token, just a list of sounds files globally available to a campaign?
Agreed. from a logical perspective, there is no need to tie this to a token(but your trying to limit the required changes to the core maptool code, which I can understand!). One solution I would think for MT.next would be to do some slight changes to how assets are handled. Specifically, in the assetcache, I would consider doing something more like a structured folder grouping:

/assetcache/images
/assetcache/sounds
/assetcache/handouts

JamzTheMan wrote: On one side, I see the appeal of Lord.Ashes "sound server" so you don't have to repackage common sounds in a campaign over and over. But on the other hand, if you have a sound unique to a campaign, say a npc speech or such, the user should have an "easy" way to include it without needing a server setup.
Well.. there is a solution to that which gets you a good deal of the way there IF you have a server already setup locally(and know how to deal with one) OR have your own hosting solution: repositories. Right now, repositories are build from the assets within a specific campaign. But functionally, there is no reason for that for that distinction to remain in place OTHER than perhaps your web hosting size limit. One thought would be to allow you to pick resource libraries(one, multiple, or all) and build a repository out of the selected resources(which could take some time depending upon how much you have locally!!!)

Once that's done, you just follow the normal instructions for uploading a repository to your existing hosting location and then updating the campaign with the URL. We could even have a global(per user account) storage mechanism so that you could "save" one or more repositories to always be part of every campaign when the campaign is first created(and you could manually remove after the fact).
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

Post Reply

Return to “User Creations”