0
0

Hello! Im a Newbie and I have the same prob like the most newbies in this forum.

I will play a MP3 file with the newest Version of FMOD and so i write my sourcecode but when i compile it (with VB.Net and the Standard .bas file wich i have convert VB.NET conform.) i get a Problem.

I have a Problem when i call the FMOD_SYSTEM_CREATESTRaEM Function i get any time an result 33 and the message: invalid Parameter…

i have no Idea how i can fix the problem. I have read every message to this topic in the forum and i have ask google to this but nothing help me.

I have checked that exinfo.cbsize = 76 all aothers are 0 and my Variables will be correct so i Think.

Here is my code for this :
[code:tv3f8u4l]
[size=7]
Dim sys As New Long()
Dim sou As New Long()
Dim exi As New Long()
Dim cha As New Long()
Dim Result As FMOD.FMOD_RESULT

'///////////////Check FMOD - Functions on Errors///////////////
Private Sub Errorcheck(ByVal Res As fmod.FMOD_RESULT)
    If (Res <> fmod.FMOD_RESULT.FMOD_OK) Then
        MsgBox("FMOD - Error! " + CStr(fmod_errors.FMOD_ErrorString(Res)) + "", MsgBoxStyle.Critical, "Error")
    End If
End Sub



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    sys = 0
    sou = 0
    cha = 0
    '///////////////FMOD - Create Main Object///////////////
    Result = FMOD.Factory.Create(sys)
    Errorcheck(Result)
    '/////////////// Set the output to Stereo.///////////////
    Result = FMOD.System.FMOD_System_SetSpeakerMode(sys, FMOD.FMOD_SPEAKERMODE.FMOD_SPEAKERMODE_STEREO)
    Errorcheck(Result)

    '///////////////Allow 100 software mixed voices to be audible at once.///////////////
    Result = FMOD.System.FMOD_System_SetSoftwareChannels(sys, 100)
    Errorcheck(Result)

    '///////////////Require the soundcard to have at least 32 2D and 3D hardware voices, and clamp it to using 64 if it has more than this.//////////////
    Result = FMOD.System.FMOD_System_SetHardwareChannels(sys, 32, 64, 32, 64)
    Errorcheck(Result)
    '///////////////Initialize FMOD with 200 virtual voices.///////////////
    Result = FMOD.System.FMOD_System_Init(sys, 200, FMOD.FMOD_INITFLAGS.FMOD_INIT_NORMAL, 0)
    Errorcheck(Result)

    Result = FMOD.System.FMOD_System_CreateStream(sys, "1.mp3", FMOD.FMOD_MODE.FMOD_LOOP_OFF, sou)
    Errorcheck(Result) /* here i get the negetive message.

    Result = FMOD.System.FMOD_System_PlaySound(sys, FMOD.FMOD_CHANNELINDEX.FMOD_CHANNEL_FREE, sou, False, cha)
    Errorcheck(Result)
End Sub[/size][/code:tv3f8u4l]

FMOD.xxxxxxxxx came from my convert and i have also the next classes like System and Sound for example in diffrent sub Classe pressed.

When you need my fmodex.bas and the other files then write a message i have now no Webspace and i dont find annything to upload this files and i wouldnt post it its a little nit big for this.

Plase try to help mee i have no Idea.

Sorry for my bad Engllish it’s not my motherlanguage.

  • You must to post comments
0
0

Kay, I see this topic is not very popular.

I think this is an problem witch only have VB because now i wtie in C# and i have no problem!

Witch

  • You must to post comments
0
0

I don’t think i have to open a new thread so i post my problem here..
I want to check each frame if my song is still playing or not.
Thatfore i have a method in my class:
inside the class as private:
[code:18n0fxhp]FMOD_SOUND *sample;
FMOD_CHANNEL *channel;
[/code:18n0fxhp]
playing the sound in a method with:
[code:18n0fxhp]MORK_Result = FMOD_System_PlaySound(MORK_System, FMOD_CHANNEL_FREE, this->sample, true, &(this->channel));
MORK_Errcheck_Msg(MORK_Result);
[/code:18n0fxhp]
checking if sound is playing:
(this is called before the FMOD_System_Update)
[code:18n0fxhp]bool MORK_SAMPLE::isPlaying(void)
{
FMOD_BOOL active = 0;
if(this->channel)
{
MORK_Result = FMOD_Channel_IsPlaying(this->channel, &active);
if ((MORK_Result != FMOD_OK) && (MORK_Result != FMOD_ERR_INVALID_HANDLE) && (MORK_Result != FMOD_ERR_CHANNEL_STOLEN))
MORK_Errcheck_Msg(MORK_Result);
}
return active;
}
[/code:18n0fxhp]
So the timeline is:
playsound
next frame (system update)
isplaying=true
until sound ends
isplaying=true
next frame (system update)
isplaying=false
isplaying throws FMOD Error (33) Invalid Parameters

if i do the system update before the isPlaying-method is called again, i get the error one call earlier…

what happens with my counter var when the song stops?
first its a 0, then i get an address and after the stop? it looks like it stays at the address.. and how do you check if the sound stopped?
can’t get behind this…

  • You must to post comments
0
0

Use a callback :)
It’s much simpler and it’s the way you should have done it

FMOD_Channel_SetCallback(channel, FMOD_CHANNEL_CALLBACKTYPE_END, &YourCallbackHere, 0);

  • You must to post comments
0
0

okay.. but how do i use this?
is this &YourCallbackHere a FMOD_CHANNEL_CALLBACK?
and where can i put my code for the program?

  • You must to post comments
0
0

Uhm, ok i think i got it..
define a function like in the .chm at Channel::setCallback
and &YourCallbackHere is the name of it..

  • You must to post comments
0
0

is there any way to implement the callback as method in my class?
i always get [quote:1c8mfd30]argument of type
FMOD_RESULT (MORK_SAMPLE::)(FMOD_CHANNEL*, FMOD_CHANNEL_CALLBACKTYPE, int, unsigned int, unsigned int)'
does not match
FMOD_RESULT ()(FMOD_CHANNEL, FMOD_CHANNEL_CALLBACKTYPE, int, unsigned int, unsigned int)’ [/quote:1c8mfd30]
but if i make it as global function i get[quote:1c8mfd30]invalid conversion from
FMOD_RESULT (*)(FMOD_CHANNEL, FMOD_CHANNEL_CALLBACKTYPE, int, unsigned int, unsigned int)'
to
FMOD_RESULT ()(FMOD_CHANNEL, FMOD_CHANNEL_CALLBACKTYPE, int, unsigned int, unsigned int)’
initializing argument 3 of
`FMOD_RESULT FMOD_Channel_SetCallback(FMOD_CHANNEL*, FMOD_CHANNEL_CALLBACKTYPE, FMOD_RESULT ()(FMOD_CHANNEL, FMOD_CHANNEL_CALLBACKTYPE, int, unsigned int, unsigned int), int)'[/quote:1c8mfd30]

so… where is my mistake?
[code:1c8mfd30]MORK_Result = FMOD_Channel_SetCallback(this->channel, FMOD_CHANNEL_CALLBACKTYPE_END, MORK_Callback, 0);
...
FMOD_RESULT F_CALLBACK MORK_Callback(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, int command, unsigned int commanddata1, unsigned int commanddata2)
{
return FMOD_OK;
}[/code:1c8mfd30]
[edit]
sometimes.. im just to stupid for this..
i got it all solved.. thx so far

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.