Beispiel #1
0
        public bool Init <T>(String command) where T : IModDriver, new()
        {
            m_CommandLine = command;
            ModDriver.LoadDriver <T>();

            return(ModDriver.MikMod_Init(command));
        }
Beispiel #2
0
 /// <summary>
 /// Depending on the driver this might need to be called, it should be safe to call even if the driver is auto updating.
 /// </summary>
 public void Update()
 {
     if (ModDriver.Driver != null && !ModDriver.Driver.AutoUpdating)
     {
         ModDriver.MikMod_Update();
     }
 }
Beispiel #3
0
        public T Init <T>(String command, out bool result) where T : IModDriver, new()
        {
            m_CommandLine = command;
            T driver = ModDriver.LoadDriver <T>();

            result = ModDriver.MikMod_Init(command);

            return(driver);
        }
Beispiel #4
0
 // Fast forward will mute all the channels and mute the driver then update mikmod till it reaches the song position that is requested
 // then it will unmute and unpause the audio after.
 // this makes sure that no sound is heard while fast forwarding.
 // the bonus of fast forwarding over setting the position is that it will know the real state of the mod.
 public void FastForwardTo(int position)
 {
     ModPlayer.Player_Mute_Channel(SharpMik.SharpMikCommon.MuteOptions.MuteAll, null);
     ModDriver.Driver_Pause(true);
     while (ModPlayer.mod.sngpos != position)
     {
         ModDriver.MikMod_Update();
     }
     ModDriver.Driver_Pause(false);
     ModPlayer.Player_UnMute_Channel(SharpMik.SharpMikCommon.MuteOptions.MuteAll, null);
 }
Beispiel #5
0
 public void Exit()
 {
     ModDriver.MikMod_Exit();
 }
Beispiel #6
0
 public void Reset()
 {
     ModDriver.MikMod_Reset(m_CommandLine);
 }
Beispiel #7
0
 public bool Init <T>(Drivers.WavDriver.WavDriverOptions wavDriverOptions) where T : IModDriver, new()
 {
     loaded_Driver = ModDriver.LoadDriver <T>(wavDriverOptions);
     return(ModDriver.MikMod_Init(""));
 }
Beispiel #8
0
 public bool Init <T>(Drivers.NaudioDriverAdvanced.NaudioDriverAdvacedOptions naudioDriverOptions) where T : IModDriver, new()
 {
     loaded_Driver = ModDriver.LoadDriver <T>(naudioDriverOptions);
     return(ModDriver.MikMod_Init(""));
 }
Beispiel #9
0
        static bool DitherSamples(SAMPLOAD samplist, int type)
        {
            SAMPLOAD s;

            if (samplist == null)
            {
                return(false);
            }

#if DITHERSAMPLES // Not sure if we really ever do this on the software render.
            SAMPLOAD c2smp = null;
            uint     maxsize, speed;

            if ((maxsize = MD_SampleSpace(type) * 1024))
            {
                while (SampleTotal(samplist, type) > maxsize)
                {
                    /* First Pass - check for any 16 bit samples */
                    s = samplist;
                    while (s)
                    {
                        if (s->outfmt & SF_16BITS)
                        {
                            SL_Sample16to8(s);
                            break;
                        }
                        s = s->next;
                    }

                    /* Second pass (if no 16bits found above) is to take the sample with
                     * the highest speed and dither it by half. */
                    if (!s)
                    {
                        s     = samplist;
                        speed = 0;
                        while (s)
                        {
                            if ((s->sample->length) && (RealSpeed(s) > speed))
                            {
                                speed = RealSpeed(s);
                                c2smp = s;
                            }
                            s = s->next;
                        }
                        if (c2smp)
                        {
                            SL_HalveSample(c2smp, 2);
                        }
                    }
                }
            }
#endif
            s = samplist;

            while (s != null)
            {
                /* sample has to be loaded ? -> increase number of samples, allocate
                 *                 memory and load sample. */
                if (s.sample.length != 0)
                {
                    if (s.sample.seekpos != 0)
                    {
                        s.reader.Seek((int)s.sample.seekpos, SeekOrigin.Begin);
                    }

                    /* Call the sample load routine of the driver module. It has to
                     *                     return a 'handle' (>=0) that identifies the sample. */
                    s.sample.handle = ModDriver.MD_SampleLoad(s, type);
                    s.sample.flags  = (ushort)((ushort)(s.sample.flags & ~SharpMikCommon.SF_FORMATMASK) | s.outfmt);

                    if (s.sample.handle < 0)
                    {
                        FreeSampleList(samplist);
                        return(false);
                    }
                }
                s = s.next;
            }

            return(true);
        }