0
0

Dear C# PocketPC Developers,

Below is a class that wraps some simple FMOD functions, which enable you to easily implement playing of MP3 etc into your application…

Note that you need a corresponding ‘fmodce.dll’.

For beginners wondering how to add a Reference for this DLL – you don’t! We are directly linking to this DLL using the command [DllImport(“fmodce.dll”)]. Just make sure it is in the same directory as your application…

Wrapper Class:

[code:mainvg68]
using System;
using System.Runtime;
using System.Runtime.InteropServices;

namespace FMOD
{
/// <summary>
/// FMOD Wrapper for Pocket PC – C#
/// See www.fmod.org for more information.
///
/// DLL Import by Dan Krusi (dan at brainwings dot com)
///
/// This code is written for FMOD 3.75CE, which is
/// available at www.fmod.com. To use FMOD, you need
/// the correct version of fmodce.dll that corresponds
/// to your emulator / Pocket PC.
/// </summary>
public class PPC
{
/// <summary>
/// Gets a stream handle for the given filename
/// </summary>
public static IntPtr GetStream(string filename)
{
// Get the filename in bytes
byte[] filenamebytes = System.Text.Encoding.Default.GetBytes(filename+null);

        // Get a handle depending on which framework we are using
        GCHandle hfile = GCHandle.Alloc(filenamebytes, GCHandleType.Pinned);
        if (Environment.Version.Major == 1) return new IntPtr(hfile.AddrOfPinnedObject().ToInt32()+4);
        else return hfile.AddrOfPinnedObject();
    }

    /// &lt;summary&gt;
    /// Initialize FMOD
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Init&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern bool Init(int mixrate, int maxsoftwarechannels, int flags);

    /// &lt;summary&gt;
    /// Get the length of a stream
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Stream_GetLength&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern int GetLength(IntPtr fstream);

    /// &lt;summary&gt;
    /// Get the current position of the stream
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Stream_GetPosition&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern UInt32 GetPosition(IntPtr fstream);

    /// &lt;summary&gt;
    /// Open a stream
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Stream_Open&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern IntPtr Open(IntPtr data, int mode, int offset, int length);

    /// &lt;summary&gt;
    /// Start playing from the stream
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Stream_Play&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern int Play(int channel, IntPtr fstream);

    /// &lt;summary&gt;
    /// Set the position of the stream
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Stream_SetPosition&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern bool SetPosition(IntPtr fstream, UInt32 position);

    /// &lt;summary&gt;
    /// Stop playing the stream
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Stream_Stop&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern bool Stop(IntPtr fstream);

    /// &lt;summary&gt;
    /// Close FMOD and release resources
    /// &lt;/summary&gt;
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint=&quot;FSOUND_Close&quot;, SetLastError=true, CharSet=CharSet.Unicode, CallingConvention=CallingConvention.Winapi)]
    public static extern void Close();
}

}
[/code:mainvg68]

Example Function:

[code:mainvg68]
/// <summary>
/// Example Code that Plays, Stops, and Closes an MP3 File
/// </summary>
private void PlayStopCloseMP3File()
{
// Declare our handles
IntPtr soundStream;
IntPtr soundHandle;

// Initialize fmod with mixrate equal to 44.1kHz
FMOD.PPC.Init(44100, 16, 0);

// Initialize the handle with the track file. 
// Note that you must provide the full Pocket PC path. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/ppc_io.asp for more info...
soundStream = FMOD.PPC.GetStream(&quot;\\Program Files\\MorningWake\\test.mp3&quot;);

// Open the stream in Normal mode, which is combination of Mono sound, 16 bits, Signed
soundHandle = FMOD.PPC.Open(soundStream, 0x100, 0, 0);

// Start playing
FMOD.PPC.Play(0, soundHandle);

// -----------------------------
// Do Something here...
// -----------------------------

// Stop playing
FMOD.PPC.Stop(soundHandle);

// Release the ressources
FMOD.PPC.Close();

}[/code:mainvg68]

-Dan Krusi (dan at brainwings dot com)

  • You must to post comments
0
0

[code:1nq21ji5]public static IntPtr GetStream(string filename)
{
// Get the filename in bytes
byte[] filenamebytes = System.Text.Encoding.Default.GetBytes(filename+null);

     // Get a handle depending on which framework we are using 
     GCHandle hfile = GCHandle.Alloc(filenamebytes, GCHandleType.Pinned); 
     if (Environment.Version.Major == 1) return new IntPtr(hfile.AddrOfPinnedObject().ToInt32()+4); 
     else return hfile.AddrOfPinnedObject(); 
  } [/code:1nq21ji5]

Thanks for the great start in creating a DotNet wrapper.

I’m no GCHandle expert, but the documentation for it states that Free must be called when the handle is no longer needed. Otherwise, there would be a memory leak each time this function was called.

Presumably FSOUND_Stream_Open only uses filename parameter ("name_or_data") temporarily (and doesn’t store the pointer away for later use by FMOD). Therefore it should be safe to call GCHandle.Free as soon as FSOUND_Stream_Open has returned.

I haven’t tried this yet, this is just theoretical.

Ronny

  • You must to post comments
0
0

Here is part 3
[code:ukkzgv0d]
#region FMUSIC API Reference

    #region Callbacks - complete
    #region FMUSIC_CALLBACK
    /// &lt;summary&gt;
    /// FMUSIC_CALLBACK
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;mod&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;param&quot;&gt;&lt;/param&gt;
    public delegate void FMUSIC_CALLBACK
    (
        IntPtr mod,
        byte param
    );
    #endregion
    #endregion

    #region Functions

    #region MUSIC Control Functions - Complete
    #region FMUSIC_FreeSong
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_FreeSong&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_FreeSong
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_LoadSong
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_LoadSong&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FMUSIC_LoadSong
    (
        IntPtr name
    );
    #endregion
    #region FMUSIC_LoadSongEx
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_LoadSongEx&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FMUSIC_LoadSongEx
    (
        IntPtr name_or_data,
        int offset,
        int length,
        uint mode,
        IntPtr samplelist,
        int samplelistnum
    );
    #endregion        
    #region FMUSIC_OptimizeChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_OptimizeChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_OptimizeChannels
    (
        IntPtr mod,
        int maxchannels,
        int minvolume
    );
    #endregion        
    #region FMUSIC_PlaySong
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_PlaySong&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_PlaySong
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_SetInstCallback
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetInstCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetInstCallback
    (
        IntPtr mod,
        FMUSIC_CALLBACK callback,
        int instrument
    );
    #endregion        
    #region FMUSIC_SetLooping
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetLooping&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetLooping
    (
        IntPtr mod,
        bool looping
    );
    #endregion        
    #region FMUSIC_SetMasterSpeed
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetMasterSpeed&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetMasterSpeed
    (
        IntPtr mod,
        float speed
    );
    #endregion
    #region FMUSIC_SetMasterVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetMasterVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetMasterVolume
    (
        IntPtr mod,
        int volume
    );
    #endregion
    #region FMUSIC_SetOrder
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetOrder&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetOrder
    (
        IntPtr mod,
        int order
    );
    #endregion
    #region FMUSIC_SetOrderCallback
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetOrderCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetOrderCallback
    (
        IntPtr mod,
        FMUSIC_CALLBACK callback,
        int orderstep
    );
    #endregion        
    #region FMUSIC_SetPanSeperation
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetPanSeperation&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetPanSeperation
    (
        IntPtr mod,
        float panset
    );
    #endregion        
    #region FMUSIC_SetPaused
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetPaused&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetPaused
    (
        IntPtr mod,
        bool pause
    );
    #endregion
    #region FMUSIC_SetReverb
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetReverb&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetReverb
    (
        IntPtr mod,
        bool reverb
    );
    #endregion
    #region FMUSIC_SetRowCallback
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetRowCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetRowCallback
    (
        IntPtr mod,
        FMUSIC_CALLBACK callback,
        int rowstep
    );
    #endregion
    #region FMUSIC_SetSample
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetSample&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetSample
    (
        IntPtr mod,
        int sampno,
        IntPtr sptr
    );
    #endregion
    #region FMUSIC_SetUserData
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetUserData&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetUserData
    (
        IntPtr mod,
        IntPtr userdata
    );
    #endregion
    #region FMUSIC_SetZxxCallback
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_SetZxxCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_SetZxxCallback
    (
        IntPtr mod,
        FMUSIC_CALLBACK callback
    );
    #endregion
    #region FMUSIC_StopAllSongs
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_StopAllSongs&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FMUSIC_StopAllSongs
    (
    );
    #endregion
    #region FMUSIC_StopSong
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_StopSong&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_StopSong
    (
        IntPtr mod
    );
    #endregion        
    #endregion

    #region Information functions
    #region FMUSIC_GetBPM
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetBPM&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetBPM
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_GetGlobalVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetGlobalVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetGlobalVolume
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetMasterVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetMasterVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetMasterVolume
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetName
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetName&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FMUSIC_GetName
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetNumChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetNumChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetNumChannels
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetNumInstruments
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetNumInstruments&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetNumInstruments
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetNumOrders
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetNumOrders&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetNumOrders
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetNumPatterns
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetNumPatterns&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetNumPatterns
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetNumSamples
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetNumSamples&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetNumSamples
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetOpenState
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetOpenState&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetOpenState
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_GetOrder
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetOrder&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetOrder
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetPattern
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetPattern&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetPattern
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetPatternLength
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetPatternLength&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetPatternLength
    (
        IntPtr mod,
        int orderno
    );
    #endregion        
    #region FMUSIC_GetPaused
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetPaused&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_GetPaused
    (
        IntPtr mod
    );
    #endregion        
    #region FMUSIC_GetRealChannel
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetRealChannel&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetRealChannel
    (
        IntPtr mod,
        int modchannel
    );
    #endregion
    #region FMUSIC_GetRow
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetRow&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetRow
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_GetSample
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetSample&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FMUSIC_GetSample
    (
        IntPtr mod,
        int sampno
    );
    #endregion
    #region FMUSIC_GetSpeed
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetSpeed&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetSpeed
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_GetTime
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetTime&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FMUSIC_GetTime
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_GetType
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetType&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern FMUSIC_TYPES FMUSIC_GetType
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_GetUserData
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_GetUserData&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FMUSIC_GetUserData
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_IsFinished
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_IsFinished&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_IsFinished
    (
        IntPtr mod
    );
    #endregion
    #region FMUSIC_IsPlaying
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FMUSIC_IsPlaying&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_IsPlaying
    (
        IntPtr mod
    );
    #endregion
    #endregion

    #endregion

    #region Enums - complete
    public enum FMUSIC_TYPES
    {
        FMUSIC_TYPE_NONE,
        FMUSIC_TYPE_MOD,        /* Protracker / Fasttracker */
        FMUSIC_TYPE_S3M,        /* ScreamTracker 3 */
        FMUSIC_TYPE_XM,         /* FastTracker 2 */
        FMUSIC_TYPE_IT,         /* Impulse Tracker. */
        FMUSIC_TYPE_MIDI,       /* MIDI file */
        FMUSIC_TYPE_FSB         /* FMOD Sample Bank file */
    };
    #endregion

    #endregion // FMUSIC API Reference

    #region Helper Methods

    /// &lt;summary&gt;
    /// Allocate a IntPtr and copy a C# string into it
    /// MUST use FModFree when done!
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;theString&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    public static IntPtr StringToIntPtr(string theString)
    {
        IntPtr result = IntPtr.Zero;
        byte[] theBytes = new byte[theString.Length + 1];
        int i = 0;
        foreach (char ch in theString)
        {
            theBytes[i++] = (byte)ch;
        }
        theBytes[i++] = 0;
        IntPtr ptr = Marshal.AllocHGlobal(theBytes.Length);
        Marshal.Copy(theBytes, 0, ptr, theBytes.Length);
        return ptr;
    }
    /// &lt;summary&gt;
    /// Copy an unmanged pointer to a C# string
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;p&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    public static string IntPtrToString(IntPtr p)
    {
        string result = &quot;&quot;;
        int i = 0;
        byte b = 0;
        do
        {
            b = Marshal.ReadByte(p, i++);
            if (b != 0)
            {
                result += (char)b;
            }
        } while (b != 0);
        return result;
    }
    /// &lt;summary&gt;
    /// Copy an unmanged pointer to a C# string with a maximum length
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;p&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;length&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    public static string IntPtrToString(IntPtr p, int length)
    {
        string result = &quot;&quot;;
        int i = 0;
        byte b = 0;
        do
        {
            b = Marshal.ReadByte(p, i++);
            if (b != 0)
            {
                result += (char)b;
            }
        } while ((b != 0) &amp;&amp; (i &lt; length));
        return result;
    }
    /// &lt;summary&gt;
    /// Free an InPtr allocated from StringToIntPtr
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;p&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    public static void FMODFree(IntPtr p)
    {
        Marshal.FreeHGlobal(p);
    }
    #endregion
}

}
[/code:ukkzgv0d]

  • You must to post comments
0
0

[code:276bkd9q]byte[] filenamebytes = System.Text.Encoding.Default.GetBytes(filename+null);[/code:276bkd9q]

This only works sometimes. I presume that the intention of the construct "filename+null" is to add a null character to the end of the string. This is necessary as FSOUND_Stream_Open is expecting a null terminated filename. However, this construct does not do this. (The length of the string "filename+null" is identical to the length of filename itself)

The end result is that FSOUND_Stream_Open gets a file name that is only by chance null terminated. On my pocket PC with .NET version 2, the filename would happen to be null terminated depending on its length.

The correct code is:
[code:276bkd9q]byte[] filenameBytes = System.Text.Encoding.Default.GetBytes(filename + ‘\0’); [/code:276bkd9q]

(I’m not going to say how long it took me to track that down)

Cheers
Ronny

  • You must to post comments
0
0

Hi PaulB.

I’ve tested your code, but it does not play the mp3.

You can give an example, please.

I use C# in Visual Studio 2005 and a smartphone with WinCE_5.

Thanks

  • You must to post comments
0
0

Hi, does anyone knows what i should do to solve this problem:

A managed MissingMethodException
occurred at Application::Run+0x1a

Application::Run+0x1a
Form1::Main+0xa

  • You must to post comments
0
0

[quote="dankrusi":1ssqk62i]Dear C# PocketPC Developers…[/quote:1ssqk62i]
[b:1ssqk62i]dankrusi[/b:1ssqk62i] Hi, I do not speak English.
Use your code. Everything is working, but leaking memory. Help.

  • You must to post comments
0
0

The MissingMethodException probably means that a DLL specified in the interop declaration cannot be found. Or, the DLL can be found, but it does not contain the specified function.

Are you sure that the FMOD DLL is in a location where the system can find it? (I presume FMOD as this is a FMOD forum, but it could be any other DLL that you are trying to access using interop). One suggestion would be having the appropriate fmodce.dll file in the same directory as the application itself. Otherwise in the Windows system directory.

One problem, is that the error message you have given does not say what it was that the system was trying to find. This is perhaps because the interop functions that are trying to execute, are being executed in the form load routine. I would suggest taking it out of the form load routine, and explicitly calling each routine individually, until you find the one that causes the exception.

Cheers
Ronny

  • You must to post comments
0
0

Hi, to begin with I’m quite newbie with programming, so please forgive me if I sound stupid:)

Well I use visual studio 2005 and I created a FMOD.cs that holds the c# wrapper. Then in my form1.cs I create a button containing your run codes:

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
IntPtr soundStream;
IntPtr soundHandle;

        // Initialize fmod with mixrate equal to 44.1kHz
        FMOD.PPC.Init(44100, 16, 0);

        // Initialize the handle with the track file.
        // Note that you must provide the full Pocket PC path. See <!-- m --><a class="postlink" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/ppc_io.asp">http://msdn.microsoft.com/library/defau ... ppc_io.asp</a><!-- m --> for more info...
        soundStream = FMOD.PPC.GetStream("test.mp3");

        // Open the stream in Normal mode, which is combination of Mono sound, 16 bits, Signed
        soundHandle = FMOD.PPC.Open(soundStream, 0x100, 0, 0);

        // Start playing
        FMOD.PPC.Play(0, soundHandle);

        // -----------------------------
        // Do Something here...
        // -----------------------------

        // Stop playing
       FMOD.PPC.Stop(soundHandle);

        // Release the ressources
        FMOD.PPC.Close();

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

The point was to test whether it will run and playback the mp3 file. However to my great frustation i got this error:

  • $exception {“Can’t find PInvoke DLL ‘fmodce.dll’.”} System.Exception {System.MissingMethodException}

Yes, I have put the fmodce.dll both in th /bin and sourcecode folders.
Could anyone please help this newbie? Thank you so much.

BTW; Im using ncf 2.0.

  • You must to post comments
0
0

Could somebody please add to the wrapper the methods for FMUSIC for C# (WinCE)? I’m a newbie that doesn’t understand how to write a wrapper for an API.

Thank you for your help.
-Timothy

  • You must to post comments
0
0

Hi Nibbana,

Are you using the correct version of fmodce.dll? There are many versions, which include a build for emulators. Make sure that your bin direcotory includes the correct version – if you are using a emulator, place the emulator version in bin. If you are testing on your device, then make sure the device version is in bin.

Another thing you might want to check: make sure you are using a ‘Mobile Device’ project, not a regular Windows project…

  • You must to post comments
0
0

I’ve added this but I’m not sure if I’m doing this right still…as it doesn’t work.

Could someone please do a check on at least just my wrapper portion?

[code:22kxzomk]/// <summary>
/// FMOD Music Load
/// </summary>
[DllImport("fmodce.dll", EntryPoint = "FMUSIC_LoadSong", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
public static extern int FMUSIC_LoadSong(string name);

    /// &lt;summary&gt; 
    /// FMOD Music Play
    /// &lt;/summary&gt; 
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint = &quot;FMUSIC_PlaySong&quot;, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_PlaySong(int fmodule);

    /// &lt;summary&gt; 
    /// FMOD Music Stop
    /// &lt;/summary&gt; 
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint = &quot;FMUSIC_StopSong&quot;, SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public static extern bool FMUSIC_StopSong(IntPtr fstream);[/code:22kxzomk]
  • You must to post comments
0
0

Sorry I’m Korean

I can’t English well.

Help Me ~ Kind Develop Friends..

===========================================

soundHandle = FMOD.PPC.Open(soundStream, 0x100, 0, 0);

debugging result
soundHandle = null

No Compile Error, Runtime Error

But After Open, soundHandle has not no value

so no sound…. –;

why ?

My Dev Env
1. VS 2003 .NET CF (c#)
2. EMUL : PPC2002
3. USE FMOD DLL : FMOD 3.75 wce3/x86/fmodce.dll -> 293 kb
4. Use Mp3 Spec
File Size – 3,301,376
Play Time : 3 min 26 sec
Type : Mpeg 1.0 Layer 3 128 kbs 7913 Frame 44100Hz, Stereo

Please help me…..

  • You must to post comments
0
0

Thanks heaps!!! Damn… how long time have I spent on this shit thing! =P

  • You must to post comments
0
0

test VS 2005 ppc 2003

soundHandle is not null

so correctly operate….

why In dev2003 .net CF soundhandle is null…

My souce code below…..

private void PlayStopCloseMP3File()
{
// Declare our handles
IntPtr soundStream;
IntPtr soundHandle;

// Initialize fmod with mixrate equal to 44.1kHz

try
{
Init(44100, 16, 0);
}
catch(MissingMethodException ex)
{
// Error Processing
MessageBox.Show(ex.Message.ToString());
}

// Initialize the handle with the track file. 
// Note that you must provide the full Pocket PC path. See     <!-- m --><a class="postlink" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/ppc_io.asp">http://msdn.microsoft.com/library/defau ... ppc_io.asp</a><!-- m --> for more info... 
soundStream = GetStream(@"\Program Files\RunMp3_ARM4\test.mp3"); 

// Open the stream in Normal mode, which is combination of Mono sound, 16 bits, Signed          
soundHandle = Open(soundStream, (int)FSOUND_MODE.FSOUND_MONO | (int)FSOUND_MODE.FSOUND_16BITS | (int)FSOUND_MODE.FSOUND_SIGNED, 0, 0);

// Start playing 
Play(0, soundHandle); 

// ----------------------------- 
// Do Something here... 
// ----------------------------- 

// Stop playing 
Stop(soundHandle); 

// Release the ressources 
Close_Fmod(); 

}

  • You must to post comments
0
0

Hi ,

Any one tell me how to import fmodce.dll

Regards,
venkat.

  • You must to post comments
0
0

Thanks for Fast Reply ^^;

check return value of FSOUND_Stream_Open : value is 0

check FSOUND_GetError : value is 2

In My PC

VS 2003 PPC 2002 Emulator can not play MP3 by media player

I Think only wav sound is possible….IN EMUL PPC 2002..

Because VS 2005 PPC 2003 Emulator can play mp3 by media player…

Brett.

In VS 2003 .net CF / PPC 2002 Emulator, Can I play MP3 ?

It’s Possible or Impissible…

I Want to Know originally possibility.

Bye Brett. THanks FMOD

  • You must to post comments
0
0

[quote="venkat":1eiss3gj]Hi ,

Any one tell me how to import fmodce.dll

Regards,
venkat.[/quote:1eiss3gj]

You don’t need to import fmodce.dll to use it. Just follow the instructions and it should work. For more help have a look at http://52.88.2.202/forum/viewtopic.php?t=4877

Hope it helps

  • You must to post comments
0
0

Works great, but i have a problem. I have Wave Files on SD-Card.
1.wav
2.wav
3.wav
….
45.wav
46.wav

The Routine plays perfekt until File 11.wav. After that, there will be no Sound. Before File 11.wav it works great. 10.wav works perfekt.

If i rename 11.wav to sf11.wav it works. but then 10.wav did not work.

The Filenames are static, so i could not do the mistake in this code-section. It seems, that in this routine must be an error:

public static IntPtr GetStream(string filename)
{
// Get the filename in bytes
byte[] filenamebytes = System.Text.Encoding.Default.GetBytes(filename+null);

        // Get a handle depending on which framework we are using 
        GCHandle hfile = GCHandle.Alloc(filenamebytes, GCHandleType.Pinned); 
        if (Environment.Version.Major == 1) return new IntPtr(hfile.AddrOfPinnedObject().ToInt32()+4); 
        else return hfile.AddrOfPinnedObject(); 
    } 

Who could help?

Thanks

  • You must to post comments
0
0

If anyone is still using this I am creating the entire C# wrapper

[b:2ib0b0tb]
Here is the complete FSOUND and FMUSIC wrapper!!!!
[/b:2ib0b0tb]

I added a few helper methods for converting strings to IntPtr and vice versa. chars in C# are unicode meaning 2 bytes. FMOD wants single bytes for a string. You should use the conversions in any function where an IntPtr is a string.

For example opening a file:

[code:2ib0b0tb]
IntPtr name = FMOD.StringToIntPtr(sFileName);
IntPtr SoundHandle = FMOD.FSOUND_Stream_Open(name, FMOD.FSOUND_NORMAL, 0, 0);
FMOD.FMODFree(name);
[/code:2ib0b0tb]

I have tested most but not all of this. If there are questions feel free to ask.

The big thing to remember is that you must Marshal fmods unmanaged memory to C# mananged memory.

You will also need to set VS to allow unsafe code. The reason for this is FMOD uses an array 512 floats in one of its structs. The only way to do that is using the fixed key word in C# which requires unsafe.

here is 3365 lines of wrapper

😆

Paul

[code:2ib0b0tb]
using System;
using System.Collections;
using System.Runtime.InteropServices;

namespace FMOD3
{
public class FMOD
{

if PocketPC

    private const string FMOD_DLL = &quot;fmodce.dll&quot;;

endif

    #region FSOUND API Reference

    #region CallBacks - complete
    #region FSOUND_DSPCALLBACK
    /// &lt;summary&gt;
    /// FSOUND_DSPCALLBACK
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;originalbuffer&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;newbuffer&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;length&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;userdata&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    public delegate IntPtr FSOUND_DSPCALLBACK
    (
        IntPtr originalbuffer,
        IntPtr newbuffer,
        int length,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_STREAMCALLBACK
    /// &lt;summary&gt;
    /// FSOUND_STREAMCALLBACK
    /// &lt;/summary&gt;
    /// &lt;param name=&quot;stream&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;buffer&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;length&quot;&gt;&lt;/param&gt;
    /// &lt;param name=&quot;userdata&quot;&gt;&lt;/param&gt;
    /// &lt;returns&gt;&lt;/returns&gt;
    public delegate IntPtr FSOUND_STREAMCALLBACK
    (
        IntPtr stream,
        IntPtr buffer,
        int length,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_ALLOCCALLBACK
    public delegate IntPtr FSOUND_ALLOCCALLBACK
    (
        uint size
    );
    #endregion
    #region FSOUND_REALLOCCALLBACK
    public delegate IntPtr FSOUND_REALLOCCALLBACK
    (
        IntPtr ptr,
        uint size
    );
    #endregion
    #region FSOUND_FREECALLBACK
    public delegate void FSOUND_FREECALLBACK
    (
        IntPtr ptr
    );
    #endregion
    #region FSOUND_OPENCALLBACK
    public delegate IntPtr FSOUND_OPENCALLBACK
    (
        IntPtr name
    );
    #endregion
    #region FSOUND_CLOSECALLBACK
    public delegate void FSOUND_CLOSECALLBACK
    (
        IntPtr handle
    );
    #endregion
    #region FSOUND_METADATACALLBACK
    public delegate bool FSOUND_METADATACALLBACK
    (
        IntPtr name,
        IntPtr value,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_READCALLBACK
    public delegate bool FSOUND_READCALLBACK
    (
        IntPtr buffer,
        int size,
        IntPtr handle
    );
    #endregion
    #region FSOUND_SEEKCALLBACK
    public delegate bool FSOUND_SEEKCALLBACK
    (
        IntPtr handle,
        int pos,
        char mode
    );
    #endregion
    #region FSOUND_TELLCALLBACK
    public delegate int FSOUND_TELLCALLBACK
    (
        IntPtr fileHandle
    );
    #endregion
    #endregion

    #region Functions

    #region Pre Initialization / Initialization / Enumeration Functions - complete
    #region FSOUND_Close
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Close&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_Close
    (
    );
    #endregion
    #region FSOUND_File_SetCallbacks
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_File_SetCallbacks&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_File_SetCallbacks
    (
        FSOUND_OPENCALLBACK useropen,
        FSOUND_CLOSECALLBACK userclose,
        FSOUND_READCALLBACK userread,
        FSOUND_SEEKCALLBACK userseek,
        FSOUND_TELLCALLBACK usertell
    );
    #endregion
    #region FSOUND_Init
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Init&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern Boolean FSOUND_Init
    (
        int mixrate,
        int maxsoftwarechannels,
        uint flags
    );
    #endregion
    #region FSOUND_SetBufferSize
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetBufferSize&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_SetBufferSize
    (
        int len_ms
    );
    #endregion
    #region FSOUND_SetDriver
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetDriver&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_SetDriver
    (
        int driver
    );
    #endregion
    #region FSOUND_SetHWND
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetHWND&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_SetHWND
    (
        IntPtr hwnd
    );
    #endregion
    #region FSOUND_SetMaxHardwareChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetMaxHardwareChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetMaxHardwareChannels
    (
        int max
    );
    #endregion
    #region FSOUND_SetMemorySystem
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetMemorySystem&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetMemorySystem
    (
        IntPtr poolmem,
        int poollen,
        FSOUND_ALLOCCALLBACK useralloc,
        FSOUND_REALLOCCALLBACK userrealloc,
        FSOUND_FREECALLBACK userfree
    );
    #endregion
    #region FSOUND_SetMinHardwareChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetMinHardwareChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetMinHardwareChannels
    (
        int min
    );
    #endregion
    #region FSOUND_SetMixer
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetMixer&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_SetMixer
    (
        FSOUND_MIXERTYPES mixer
    );
    #endregion
    #region FSOUND_SetOutput
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetOutput&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_SetOutput
    (
        FSOUND_OUTPUTTYPES outputtype
    );
    #endregion
    #endregion

    #region Global run-time update functions - complete
    #region FSOUND_SetPanSeperation
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetMaxHardwareChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetPanSeperation
    (
        float pansep
    );
    #endregion
    #region FSOUND_SetSFXMasterVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetSFXMasterVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetSFXMasterVolume
    (
        int volume
    );
    #endregion
    #region FSOUND_SetSpeakerMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetSpeakerMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetSpeakerMode
    (
        FSOUND_SPEAKERMODES mode
    );
    #endregion
    #region FSOUND_Update
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Update&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Update
    (
    );
    #endregion
    #endregion

    #region Global run-time Information Functions - complete
    #region FSOUND_GetCPUUsage
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetCPUUsage&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern float FSOUND_GetCPUUsage
    (
    );
    #endregion
    #region FSOUND_GetChannelsPlaying
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetChannelsPlaying&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetChannelsPlaying
    (
    );
    #endregion
    #region FSOUND_GetDriver
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetDriver&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetDriver
    (
    );
    #endregion
    #region FSOUND_GetDriverCaps
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetDriverCaps&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetDriverCaps
    (
        int id,
        out int caps
    );
    #endregion
    #region FSOUND_GetDriverName
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetDriverName&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_GetDriverName
    (
        int id
    );
    #endregion
    #region FSOUND_GetError
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetError&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern FMOD_ERRORS FSOUND_GetError
    (
    );
    #endregion
    #region FSOUND_GetMaxSamples
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetMaxSamples&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetMaxSamples
    (
    );
    #endregion
    #region FSOUND_GetMaxChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetMaxChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetMaxChannels
    (
    );
    #endregion
    #region FSOUND_GetMemoryStats
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetMemoryStats&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_GetMemoryStats
    (
        out uint currentalloced,
        out uint maxalloced
    );
    #endregion
    #region FSOUND_GetNumDrivers
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetNumDrivers&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetNumDrivers
    (
    );
    #endregion
    #region FSOUND_GetNumHWChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetNumHWChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_GetNumHWChannels
    (
        out int num2d,
        out int num3d,
        out int totaal
    );
    #endregion
    #region FSOUND_GetOutput
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetOutput&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern FSOUND_OUTPUTTYPES FSOUND_GetOutput
    (
    );
    #endregion
    #region FSOUND_GetOutputHandle
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetOutputHandle&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_GetOutputHandle
    (
    );
    #endregion
    #region FSOUND_GetOutputRate
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetOutputRate&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetOutputRate
    (
    );
    #endregion
    #region FSOUND_GetSFXMasterVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetSFXMasterVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetSFXMasterVolume
    (
    );
    #endregion
    #region FSOUND_GetVersion
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetVersion&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern float FSOUND_GetVersion
    (
    );
    #endregion
    #endregion

    #region Sample Functions - complete
    #region FSOUND_Sample_Alloc
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Alloc&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Sample_Alloc
    (
        int index,
        int length,
        uint mode,
        int deffreq,
        int defvol,
        int defpan,
        int defpri
    );
    #endregion
    #region FSOUND_Sample_Free
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Free&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_Sample_Free
    (
        IntPtr sptr
    );
    #endregion
    #region FSOUND_Sample_Get
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Get&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Sample_Get
    (
        int nampno
    );
    #endregion
    #region FSOUND_Sample_GetDefaults
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetDefaults&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_GetDefaults
    (
        IntPtr sptr,
        out int deffreq,
        out int defvol,
        out int defpan,
        out int defpri
    );
    #endregion
    #region FSOUND_Sample_GetDefaultsEx
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetDefaultsEx&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_GetDefaultsEx
    (
        IntPtr sptr,
        out int deffreq,
        out int defvol,
        out int defpan,
        out int defpri,
        out int varfreq,
        out int varvol,
        out int varpan
    );
    #endregion
    #region FSOUND_Sample_GetLength
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetLength&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern uint FSOUND_Sample_GetLength
    (
        IntPtr sptr
    );
    #endregion
    #region FSOUND_Sample_GetLoopPoints
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetLoopPoints&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_GetLoopPoints
    (
        IntPtr sptr,
        out int loopstart,
        out int loopend
    );
    #endregion
    #region FSOUND_Sample_GetMinMaxDistance
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetMinMaxDistance&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_GetMinMaxDistance
    (
        IntPtr sptr,
        out float min,
        out int max
    );
    #endregion
    #region FSOUND_Sample_GetMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern uint FSOUND_Sample_GetMode
    (
        IntPtr sptr
    );
    #endregion
    #region FSOUND_Sample_GetName
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_GetName&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Sample_GetName
    (
        IntPtr sptr
    );
    #endregion
    #region FSOUND_Sample_Load
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Load&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Sample_Load
    (
        int index,
        IntPtr name_or_data,
        uint inputmode,
        int offset,
        int length
    );
    #endregion
    #region FSOUND_Sample_Lock
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Lock&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Sample_Lock
    (
        IntPtr sptr,
        int offset,
        int length,
        out IntPtr ptr1,
        out IntPtr ptr2,
        out uint len1,
        out uint len2
    );
    #endregion
    #region FSOUND_Sample_SetDefaults
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_SetDefaults&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_SetDefaults
    (
        IntPtr sptr,
        int deffreq,
        int defvol,
        int defpan,
        int defpri
    );
    #endregion
    #region FSOUND_Sample_SetDefaultsEx
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_SetDefaultsEx&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_SetDefaultsEx
    (
        IntPtr sptr,
        int deffreq,
        int defvol,
        int defpan,
        int defpri,
        int varfreq,
        int varvol,
        int varpan
    );
    #endregion
    #region FSOUND_Sample_SetMaxPlaybacks
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_SetMaxPlaybacks&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_SetMaxPlaybacks
    (
        IntPtr sptr,
        int max
    );
    #endregion
    #region FSOUND_Sample_SetMinMaxDistance
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_SetMinMaxDistance&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_SetMinMaxDistance
    (
        IntPtr sptr,
        float min,
        float max
    );
    #endregion
    #region FSOUND_Sample_SetMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_SetMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_SetMode
    (
        IntPtr sptr,
        uint mode
    );
    #endregion
    #region FSOUND_Sample_SetLoopPoints
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_SetLoopPoints&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_SetLoopPoints
    (
        IntPtr sptr,
        int loopstart,
        int loopend
    );
    #endregion
    #region FSOUND_Sample_Unlock
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Unlock&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_Unlock
    (
        IntPtr sptr,
        int offset,
        int length,
        IntPtr ptr1,
        IntPtr ptr2,
        uint len1,
        uint len2
    );
    #endregion
    #region FSOUND_Sample_Upload
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Sample_Upload&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Sample_Upload
    (
        IntPtr sptr,
        IntPtr srcdata,
        uint mode_in
    );
    #endregion
    #endregion

    #region Channel Functions -- complete
    #region FSOUND_PlaySound
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_PlaySound&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_PlaySound
    (
        int channel,
        IntPtr sptr
    );
    #endregion
    #region FSOUND_PlaySoundEx
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_PlaySoundEx&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_PlaySoundEx
    (
        int channel,
        IntPtr sptr,
        IntPtr dspunit,
        bool startpaused
    );
    #endregion
    #region FSOUND_StopSound
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_StopSound&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_StopSound
    (
        int channel
    );
    #endregion
    #region FSOUND_SetFrequency
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetFrequency&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetFrequency
    (
        int channel,
        int freq
    );
    #endregion
    #region FSOUND_SetLevels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetLevels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetLevels
    (
        int channel,
        int frontleft,
        int center,
        int frontright,
        int backleft,
        int backright,
        int lfe
    );
    #endregion
    #region FSOUND_SetLoopMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetLoopMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetLoopMode
    (
        int channel,
        uint loopmode
    );
    #endregion
    #region FSOUND_SetMute
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetMute&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetMute
    (
        int channel,
        bool mute
    );
    #endregion
    #region FSOUND_SetPan
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetPan&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetPan
    (
        int channel,
        int pan
    );
    #endregion
    #region FSOUND_SetPaused
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetPaused&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetPaused
    (
        int channel,
        bool paused
    );
    #endregion
    #region FSOUND_SetPriority
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetPriority&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetPriority
    (
        int channel,
        int priority
    );
    #endregion
    #region FSOUND_SetReserved
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetReserved&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetReserved
    (
        int channel,
        bool reserved
    );
    #endregion
    #region FSOUND_SetSurround
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetSurround&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetSurround
    (
        int channel,
        bool surround
    );
    #endregion
    #region FSOUND_SetVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetVolume
    (
        int channel,
        int vol
    );
    #endregion
    #region FSOUND_SetVolumeAbsolute
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetVolumeAbsolute&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetVolumeAbsolute
    (
        int channel,
        int vol
    );
    #endregion
    #region FSOUND_GetVolume
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetVolume&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetVolume
    (
        int channel
    );
    #endregion
    #region FSOUND_GetAmplitude
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetAmplitude&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetAmplitude
    (
        int channel
    );
    #endregion
    #region FSOUND_3D_SetAttributes
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_SetAttributes&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_3D_SetAttributes
    (
        int channel,
        ref VECTOR pos,
        ref VECTOR vel
    );
    #endregion
    #region FSOUND_3D_SetMinMaxDistance
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_SetMinMaxDistance&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_3D_SetMinMaxDistance
    (
        int channel,
        out float min,
        out float max
    );
    #endregion
    #region FSOUND_SetCurrentPosition
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_SetCurrentPosition&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_SetCurrentPosition
    (
        int channel,
        uint pos
    );
    #endregion
    #region FSOUND_GetCurrentPosition
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetCurrentPosition&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetCurrentPosition
    (
        int channel
    );
    #endregion
    #region FSOUND_GetCurrentSample
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetCurrentSample&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_GetCurrentSample
    (
        int channel
    );
    #endregion
    #region FSOUND_GetCurrentLevels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetCurrentLevels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_GetCurrentLevels
    (
        int channel,
        out float l,
        out float r
    );
    #endregion
    #region FSOUND_GetFrequency
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetFrequency&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetFrequency
    (
        int channel
    );
    #endregion
    #region FSOUND_GetLoopMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetLoopMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern uint FSOUND_GetLoopMode
    (
        int channel
    );
    #endregion
    #region FSOUND_GetMixer
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetMixer&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetMixer
    (
        int channel
    );
    #endregion
    #region FSOUND_GetMute
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetMute&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_GetMute
    (
        int channel
    );
    #endregion
    #region FSOUND_GetNumSubChannels
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetNumSubChannels&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetNumSubChannels
    (
        int channel
    );
    #endregion
    #region FSOUND_GetPan
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetPan&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetPan
    (
        int channel
    );
    #endregion
    #region FSOUND_GetPaused
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetPaused&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_GetPaused
    (
        int channel
    );
    #endregion
    #region FSOUND_GetPriority
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetPriority&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetPriority
    (
        int channel
    );
    #endregion
    #region FSOUND_GetReserved
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetReserved&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_GetReserved
    (
        int channel
    );
    #endregion
    #region FSOUND_GetSubChannel
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetSubChannel&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_GetSubChannel
    (
        int channel,
        int subchanel
    );
    #endregion
    #region FSOUND_GetSurround
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_GetSurround&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_GetSurround
    (
        int channel
    );
    #endregion
    #region FSOUND_IsPlaying
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_IsPlaying&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_IsPlaying
    (
        int channel
    );
    #endregion
    #region FSOUND_3D_GetAttributes
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_GetAttributes&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_3D_GetAttributes
    (
        int channel,
        out VECTOR pos,
        out VECTOR vel
    );
    #endregion
    #region FSOUND_3D_GetMinMaxDistance
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_GetMinMaxDistance&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_3D_GetMinMaxDistance
    (
        int channel,
        out float min,
        out float max
    );
    #endregion
    #endregion

    #region 3D Sound functions - complete
    #region FSOUND_3D_Listener_GetAttributes
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_Listener_GetAttributes&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_3D_Listener_GetAttributes
    (
        out float pos,
        out float vel,
        out float fx,
        out float fy,
        out float fz,
        out float tx,
        out float ty,
        out float tz
    );
    #endregion
    #region FSOUND_3D_Listener_SetAttributes
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_Listener_SetAttributes&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_3D_Listener_SetAttributes
    (
        float pos,
        float vel,
        float fx,
        float fy,
        float fz,
        float tx,
        float ty,
        float tz
    );
    #endregion
    #region FSOUND_3D_Listener_SetCurrent
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_Listener_SetCurrent&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_3D_Listener_SetCurrent
    (
        int current,
        int numlisteners
    );
    #endregion
    #region FSOUND_3D_SetDistanceFactor
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_SetDistanceFactor&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_3D_SetDistanceFactor
    (
        float factor
    );
    #endregion
    #region FSOUND_3D_SetDopplerFactor
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_SetDopplerFactor&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_3D_SetDopplerFactor
    (
        float scale
    );
    #endregion
    #region FSOUND_3D_SetRolloffFactor
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_3D_SetRolloffFactor&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_3D_SetRolloffFactor
    (
        float factor
    );
    #endregion
    #endregion

    #region Stream Functions - Complete
    #region FSOUND_Stream_AddSyncPoint
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_AddSyncPoint&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_AddSyncPoint
    (
        IntPtr fstream,
        uint pcmoffset,
        IntPtr name
    );
    #endregion
    #region FSOUND_Stream_Close
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Close&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern void FSOUND_Stream_Close
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_Create
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Create&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_Create
    (
        FSOUND_STREAMCALLBACK callback,
        int lenbytes,
        uint mode,
        int samplerate,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_Stream_CreateDSP
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_CreateDSP&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_CreateDSP
    (
        IntPtr stream,
        FSOUND_DSPCALLBACK callback,
        int priority,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_Stream_DeleteSyncPoint
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_DeleteSyncPoint&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_DeleteSyncPoint
    (
        IntPtr point
    );
    #endregion
    #region FSOUND_Stream_FindTagField
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_FindTagField&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_FindTagField
    (
        IntPtr stream,
        FSOUND_TAG_FIELD_TYPE type,
        IntPtr name,
        out IntPtr value,
        out int length
    );
    #endregion
    #region FSOUND_Stream_GetLength
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetLength&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_GetLength
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetLengthMs
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetLengthMs&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_GetLengthMs
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern uint FSOUND_Stream_GetMode
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetNumSubStreams
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetNumSubStreams&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_GetNumSubStreams
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetNumSyncPoints
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetNumSyncPoints&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_GetNumSyncPoints
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetNumTagFields
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetNumTagFields&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_GetNumTagFields
    (
        IntPtr fstream,
        out int num
    );
    #endregion
    #region FSOUND_Stream_GetOpenState
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetOpenState&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_GetOpenState
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetPosition
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetPosition&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern UInt32 FSOUND_Stream_GetPosition
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetSample
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetSample&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_GetSample
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_GetSyncPoint
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetSyncPoint&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_GetSyncPoint
    (
        IntPtr fstream,
        int index
    );
    #endregion
    #region FSOUND_Stream_GetSyncPointInfo
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetSyncPointInfo&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_GetSyncPointInfo
    (
        IntPtr point,
        out uint pcmoffset
    );
    #endregion
    #region FSOUND_Stream_GetTagField
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetTagField&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_GetTagField
    (
        IntPtr fstream,
        int num,
        out FSOUND_TAG_FIELD_TYPE type,
        out IntPtr name,
        out IntPtr value,
        out int length
    );
    #endregion
    #region FSOUND_Stream_GetTime
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_GetTime&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_GetTime
    (
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_Net_GetBufferProperties
    [Obsolete]
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Net_GetBufferProperties&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_Net_GetBufferProperties
    (
        out int buffersize,
        out int prebuffer_percent,
        out int rebuffer_percent
    );
    #endregion
    #region FSOUND_Stream_Net_GetLastServerStatus
    [Obsolete]
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Net_GetLastServerStatus&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_Net_GetLastServerStatus
    (
    );
    #endregion
    #region FSOUND_Stream_Net_GetStatus
    [Obsolete]
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Net_GetStatus&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_Net_GetStatus
    (
        IntPtr stream,
        out int status,
        out int bufferused,
        out int bitrate,
        out uint flags
    );
    #endregion
    #region FSOUND_Stream_Net_SetBufferProperties
    [Obsolete]
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Net_SetBufferProperties&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_Net_SetBufferProperties
    (
        int buffersize,
        int prebuffer_percent,
        int rebuffer_percent
    );
    #endregion
    #region FSOUND_Stream_Net_SetMetadataCallback
    [Obsolete]
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Net_SetMetadataCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_Net_SetMetadataCallback
    (
        IntPtr stream,
        FSOUND_METADATACALLBACK callback,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_Stream_Net_SetProxy
    [Obsolete]
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Net_SetProxy&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_Net_SetProxy
    (
        IntPtr proxy
    );
    #endregion
    #region FSOUND_Stream_Open
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Open&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern IntPtr FSOUND_Stream_Open
    (
        IntPtr data,
        uint mode,
        int offset,
        int length
    );
    #endregion
    #region FSOUND_Stream_Play
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Play&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_Play
    (
        int channel,
        IntPtr fstream
    );
    #endregion
    #region FSOUND_Stream_PlayEx
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Play&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern int FSOUND_Stream_Play
    (
        int channel,
        IntPtr fstream,
        IntPtr dspunit,
        bool paused
    );
    #endregion
    #region FSOUND_Stream_SetBufferSize
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetBufferSize&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetBufferSize
    (
        int ms
    );
    #endregion
    #region FSOUND_Stream_SetEndCallback
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetEndCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetEndCallback
    (
        IntPtr stream,
        FSOUND_STREAMCALLBACK callback,
        IntPtr userdata
    );
    #endregion
    #region FSOUND_Stream_SetLoopCount
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetLoopCount&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetLoopCount
    (
        IntPtr stream,
        int count
    );
    #endregion
    #region FSOUND_Stream_SetLoopPoints
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetLoopPoints&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetLoopPoints
    (
        IntPtr stream,
        uint loopstart,
        uint loopend
    );
    #endregion
    #region FSOUND_Stream_SetMode
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetMode&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_Setmode
    (
        IntPtr stream,
        uint mode
    );
    #endregion
    #region FSOUND_Stream_SetPosition
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetPosition&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetPosition
    (
        IntPtr fstream,
        UInt32 position
    );
    #endregion
    #region FSOUND_Stream_SetSubStream
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetSubStream&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetSubStream
    (
        IntPtr fstream,
        int index
    );
    #endregion
    #region FSOUND_Stream_SetSubStreamSentence
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetSubStreamSentence&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetSubStreamSentence
    (
        IntPtr fstream,
        IntPtr sentencelist,
        int numitems
    );
    #endregion
    #region FSOUND_Stream_SetSyncCallback
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetSyncCallback&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetSyncCallback
    (
        IntPtr fstream,
        FSOUND_STREAMCALLBACK callback,
        IntPtr userData
    );
    #endregion
    #region FSOUND_Stream_SetTime
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_SetTime&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_SetTime
    (
        IntPtr fstream,
        int ms
    );
    #endregion
    #region FSOUND_Stream_Stop
    [DllImport(FMOD_DLL,
    EntryPoint = &quot;FSOUND_Stream_Stop&quot;,
    SetLastError = true,
    CharSet = CharSet.Unicode,
    CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_Stop
    (
        IntPtr fstream
    );
    #endregion
    #endregion

[/code:2ib0b0tb]

  • You must to post comments
0
0

Doesn’t work for me at all, I’m getting FMOD_ERR_FILE_FORMAT from FMOD.PPC.GetError() after having called

soundHandle = FMOD.PPC.Open(soundStream, 0x100, 0, 0);

Appears that the call to FMOD.PPC.GetStream(file) succeeds because soundStream is set to a non 0 value. The mp3 file I’m trying to play can be played fine with any other play on the pocket pc …

Any idea how I can further debug the cause of this ?

thx,
Gringo

  • You must to post comments
Showing 1 - 20 of 21 results
Your Answer

Please first to submit.