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.

Coordinator
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?

Coordinator
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()
{
    _mediaElement.SetSource(_synth);
}

void IRenderer.PlayStart()
{
    _mediaElement.Play();
}

void IRenderer.PlayStop()
{
    _mediaElement.Stop();
}

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.

Coordinator
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. 
SilverlightDriver
 
Dim io As 
Stream
io =
Assembly.GetExecutingAssembly().GetManifestResourceStream("mymir2.HUIPPE.S3M" 
) 
med.SetSource(io)
 
Dim p As SharpMod.Player.SharpModPlayer, mp As SharpMod. 
ModulePlayer
drv =
New SharpMod.SoundRenderer.SilverlightDriver 
(med) 
mp =
New SharpMod.ModulePlayer(SharpMod.ModuleLoader 
.Instance.LoadModule(io)) 
mp.RegisterRenderer(drv)
mp.Start()

 

 

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.

Coordinator
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.

Coordinator
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!