Jump to content
The simFlight Network Forums

Sound Playing Problem (C#)


Recommended Posts

Hi there,

i use C# to develope a simple Software for my FS2004.

I works very well, i can read and write anything i want, but i have a Problem with playing Sounds.

 

This is what i do:

 

I read one Byte (FSUIPC_Read, then FSUIPC_Get)  at 0x4200 and get the Information: "FREE".

Second i set (FSUIPC_Write) the filename 737LP at 0x4208 (through an Array of 248 Bytes).

The file 737LP exists in the Sound Directory of my FS2004 Installation.

The Array contains the following values: 55, 51, 55, 76, 80, 46, 87, 65, 86, and the rest of the Array contains only 0 values.

Third i set (FSUIPC_Write) the command PLAY_LOOP as a Byte with value 2 at 0x4200.

Fourth i use the command FSUIPC_Process (it returns 0 as result, so all should be ok)

 

But the sound does not play. After reading 0x4200 i get "PLAY_LOOP" ever and ever again.

I think i miss something, but i don't know what. Perhaps someone can help me, perhaps has a simple example for me that i can use to check if it works.

 

Thanks in advance,

Bodo

Link to comment
Share on other sites

Hi Bodo,

 

Reading the protocol it seems that the reference number at 4204 is also required:

 

4204 DWORD:  REFERENCE as 32-bit non-zero integer.
The application can use this how it likes, but it should be unique,
otherwise the same sound is referenced.

 

Try writing a number there as well (before 0x4200 of course).

 

Paul

Link to comment
Share on other sites

Hi Paul, hi Forum members.

 

Pauls answer is the the solution. I wrote a value to 0x4204 and the Sound Plays. I can now play it once as well as in a loop. I can also stop the sound by myself.

Indeed, as Paul already said, it's also written in the Manual and i found it today, too, on page 17 of the FSUIPC Programmers Manual:

"Then write data to 4204 (DWORD) and, for a new sound to Play,".

 

Thanks for the hint!

 

Bodo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.