0
0

Hi,

I’m using this code in fmod class but it doesn’t work :

    [DllImport("fmodce.dll", (...)]
    public static extern string FSOUND_TAGFIELD_TYPE();

    [DllImport("fmodce.dll", (...)]
    public static extern bool GetTagField(IntPtr fstream, int numTag, ref FMOD.PPC.FSOUND_TAGFIELD_TYPE typeTag, ref string name,IntPtr val,ref int length);

    [DllImport("fmodce.dll", (...)]
    public static extern bool FSOUND_Stream_GetNumTagFields(IntPtr fstream, ref int nomTag);

Can someone tell me how to declare the FSOUND_TAGFIELD_TYPE ? :roll: (sorry if this question sounds stupid, i’m a beginner in c#)

Thanks

  • You must to post comments
0
0

It should be defined in your C# fmod.cs wrapper somewhere, as this file didn’t come from us, I can’t tell you where.

  • You must to post comments
0
0

OK sorry

I used the fmod.cs I found in this forum and I add the 3 last declares at the end :

[code:11qpsl8s]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; 
    /// Get the current position of the stream
    /// &lt;/summary&gt; 
    [DllImport(&quot;fmodce.dll&quot;, EntryPoint = &quot;FSOUND_Stream_GetLengthMs&quot;, SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public static extern UInt32 GetLengthMs(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();

    [DllImport(&quot;fmodce.dll&quot;, EntryPoint = &quot;FSOUND_TAGFIELD_TYPE&quot;, SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public static extern string FSOUND_TAGFIELD_TYPE();

    [DllImport(&quot;fmodce.dll&quot;, EntryPoint = &quot;FSOUND_Stream_GetTagField&quot;, SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public static extern bool GetTagField(IntPtr fstream, int numTag, ref FSOUND_TAGFIELD_TYPE typeTag, ref string name,IntPtr val,ref int length);

    [DllImport(&quot;fmodce.dll&quot;, EntryPoint = &quot;FSOUND_Stream_GetNumTagFields&quot;, SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Winapi)]
    public static extern bool FSOUND_Stream_GetNumTagFields(IntPtr fstream, ref int nomTag);




}

}

and this in my "form1":

String val = "";
string name = "";
int length = 0;
IntPtr stream = new IntPtr(0);
FMOD.PPC.FSOUND_TAGFIELD_TYPE Ftype = new FMOD.PPC.FSOUND.FSOUND_TAGFIELD_TYPE();
int nombTag = 0;
FMOD.PPC.FSOUND_Stream_GetNumTagFields(soundHandle, ref nombTag);
label2.Text += "tag " + nombTag.ToString();
FMOD.PPC.GetTagField(soundHandle, 0, ref Ftype, ref name, ref val, ref length);

[/code:11qpsl8s]

I think it’s this one : public static extern string FSOUND_TAGFIELD_TYPE();
is it a string, int ?
can you help me ?

Thanks[code:11qpsl8s][/code:11qpsl8s][code:11qpsl8s][/code:11qpsl8s]

  • You must to post comments
0
0

Now it almost works, here’s what I modified :

[code:tjvkp4gh] string val = "";
string name = "";
int length = 0;
//FMOD.PPC.FSOUND_TAGFIELD_TYPE Ftype = new FMOD.PPC.FSOUND.FSOUND_TAGFIELD_TYPE();
int Ftype = 0;
FMOD.PPC.GetTagField(soundHandle, 1, ref Ftype, ref name, ref val, ref length);[/code:tjvkp4gh]

I thought that FSOUND_TAGFIELD_TYPE had to be declared as a fmod method, so I just delete this declaration in fmod.cs and declare :

[DllImport("fmod.dll"(…)]
public static extern bool GetTagField(IntPtr fstream, int numTag, ref int typeTag, ref string name, ref string val, ref int length);

Now I can read the tags but it’s only strange characters :
for name "剁䥔呓吀歩湥䨠桡䘠歡汯y"
This one is supposed to be Tiken Jah Fakoly (artist tag 1)
On FMOD.org name is a null-terminated ASCII string, I tried to convert chars in Byte array and use convert ascii to unicode but it doesn’t work.

Anyone has an idea please ?

  • You must to post comments
0
0

😕 Finaly I give it up : the code above for the tags works for fmod win32 but not for fmodce.

Does anyone ever make the tags work with fmodce (WM2003) (if yes could you give a code example) ?

thanks

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.