/*  File:         prefs.c
 *  Created:      20-10-95
 *  Updated:      30-12-95
 *  Version:      1.0
 *  Project:      Clicker
 *  Owner:        Jeroen Vermeulen
 *  Requirements: KickStart V39+
 *  Legal:        PD
 *  Status:       Release
 */

#include <exec/types.h>

#include "prefs.h"

/* This global volatile variable enables asynchronous communication between
 * processes.  New settings for sample volume, click length and pitch will be
 * stored into this struct, so the key-click routine will feed the new data into
 * its audio request on the next key click.
 */
volatile struct SoundSettings ClickPrefs = { FALSE, TRUE, 400, 50, 5 };


/* CopySoundPrefs():
 * Copies a SoundSettings structure, like CopyMem() but slightly safer in every-
 * day use.  It is volatile-safe and const-friendly, and also sets the
 * destination's newsettings flag.  NULL arguments are *not* safe.
 */
void CopySoundPrefs(volatile const struct SoundSettings *const src,
                    volatile       struct SoundSettings *const dst)
{
  dst->period      = src->period;
  dst->volume      = src->volume;
  dst->cycles      = src->cycles;

#ifdef    NOCLICKMOUSE
  dst->ClickMouse  = FALSE;
#else  /* NOCLICKMOUSE */
  dst->ClickMouse  = src->ClickMouse;
#endif /* NOCLICKMOUSE */

  dst->newsettings = TRUE;
}

