0
0

Hi,

I’m putting together a little alarm clock program where users can select their own sounds for alarms. It consists of a main form that shows the current time and hosts a menu. A second form, call as ShowDialog from the main form, allows the user to select the media file. I have a preview button on the second form to let the user hear the file before saving the changes to the alarm.

The preview button does not work.

FMOD.System and FMOD.Channel are declared and initialized in my main form. How would you recommend playing a preview in the second form without passing the sound file path back to the maian form?

I had thought of passing the system and channel objects to the second form, but that seems… wrong. Seems like there should be a better way to do it.

Declaration and initialization of system…
[code:2dydpjos]
public partial class frmAlarm : Form
{

    ArrayList myAlarmList;
    private FMOD.System system = null;
    private FMOD.Sound sound = null;
    private FMOD.Channel channel = null;
    private int channelsPlaying = 0;

...

private void Form1_Load(object sender, EventArgs e)
{
uint version = 0;
FMOD.RESULT result;

        lblTime.Text = getTime();

        result = FMOD.Factory.System_Create(ref system);
        ERRCHECK(result);

        result = system.getVersion(ref version);
        ERRCHECK(result);

        if (version < FMOD.VERSION.number)
        {
            MessageBox.Show("Error!  You are using an old version of FMOD " + version.ToString("X") + ".  This program requires " + FMOD.VERSION.number.ToString("X") + ".");
            Application.Exit();
        }

        result = system.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)null);
        ERRCHECK(result);
    }

[/code:2dydpjos]

Any suggestions would be appreciated.

Thanks

  • You must to post comments
0
0

You could put the Fmod “stuff” in a separate class and then access the class from your forms. Or have it like you do but in both forms.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.