Concurent Files Play?

Nov 3, 2011 at 7:58 AM

Is it possible to play some files concurently by means of that library?

i have a game and look for audio engine.

Nov 4, 2011 at 10:41 AM

SharpMod isn't an audio engine, but it is maked too be plugged on an audio engine (Naudio, the silverlight MediaPlayer, or the XNA sound engine).

Which part of the framework would you use for you game XNA or any other ? I can help you to adapt SharpMod to your need.



Nov 4, 2011 at 1:03 PM

o ! nice

i used only silverlight for my game engine.

no 3d party frameworks

my game will be play tracker music.

so the Q is how to make music play in background with playlist controller?

xna for sl5 only plays wav. its dont fit in my mind:)

and my game has some moments about using mediaelement.

so how can i start plug your code in mine? any ideas?

Nov 4, 2011 at 2:04 PM

Ok, I see.

The sound rendering of SharpMod for Silverlight is based on a MediaStreamSource class. The bind of the MediaStreamSource to the MediaElement is done by the line 

SharpMod.SoundRenderer.SilverlightDriver drv = new SharpMod.SoundRenderer.SilverlightDriver(MyMediaElement);


This driver simply bind the MediaStreamSource to the MediaElement and control it :


void IRenderer.Init()

void IRenderer.PlayStart()

void IRenderer.PlayStop()

The buffer of the MediaStreamSource is filled by a Thread which maintain a list of 6 queued buffer (arbitrary :o) ) to prevent glitches


So since SharpMod use the MediaElement, all the replay is doing in background. The only thing you have to do is the playlist system.

Nov 4, 2011 at 2:10 PM

how mediaelement must be initialized?

in xaml?

really i dont want to initialize it in xaml.

Nov 4, 2011 at 2:26 PM

In the demo I initialize it in the xaml, so it's only for the facilty. You can initialize it by code like this :


MediaElement mediaElement = new MediaElement();

Nov 5, 2011 at 6:23 AM

you know

it crashes when my song gone to the end. everytime crashes. i use sl5 rc plugin.

and my code:


Dim drv As SharpMod.SoundRenderer. 
Dim io As 
io =
Dim p As SharpMod.Player.SharpModPlayer, mp As SharpMod. 
drv =
New SharpMod.SoundRenderer.SilverlightDriver 
mp =
New SharpMod.ModulePlayer(SharpMod.ModuleLoader 



Nov 5, 2011 at 6:30 AM
{System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at SharpMod.Player.SharpModPlayer.MP_HandleTick()
   at SharpMod.Mixer.ChannelsMixer.TickHandler()
   at SharpMod.Mixer.ChannelsMixer.VC_WriteSamples(SByte[] buf, Int32 todo)
   at SharpMod.Mixer.ChannelsMixer.VC_WriteBytes(SByte[] buf, Int32 todo)
   at SharpMod.ModulePlayer.GetBytes(Byte[] buffer, Int32 count)
   at SharpMod.SoundRenderer.SilverlightDriver._fillBuffer()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()}
Nov 5, 2011 at 7:19 PM

I'm getting the exact same problem on the XNA plugin, in both my own game and the XNA demo in the latest source.

Nov 7, 2011 at 9:22 AM

Congratulations, you finds an isssue ! I'll see to fix it and make a newer release version with the XNA version.

Nov 13, 2011 at 11:05 AM

This problem is fixed in the SVN repository.

Nov 13, 2011 at 11:49 AM

nice! silverlight works!