linux/include/sound/wavefront.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __SOUND_WAVEFRONT_H__
#define __SOUND_WAVEFRONT_H__

/*
 *  Driver for Turtle Beach Wavefront cards (Maui,Tropez,Tropez+)
 *
 *  Copyright (c) by Paul Barton-Davis <[email protected]>
 */

#ifndef NUM_MIDIKEYS 
#define NUM_MIDIKEYS
#endif  /* NUM_MIDIKEYS */

#ifndef NUM_MIDICHANNELS
#define NUM_MIDICHANNELS
#endif  /* NUM_MIDICHANNELS */

/* Pseudo-commands not part of the WaveFront command set.
   These are used for various driver controls and direct
   hardware control.
 */

#define WFC_DEBUG_DRIVER
#define WFC_FX_IOCTL
#define WFC_PATCH_STATUS
#define WFC_PROGRAM_STATUS
#define WFC_SAMPLE_STATUS
#define WFC_DISABLE_INTERRUPTS
#define WFC_ENABLE_INTERRUPTS
#define WFC_INTERRUPT_STATUS
#define WFC_ROMSAMPLES_RDONLY
#define WFC_IDENTIFY_SLOT_TYPE

/* Wavefront synth commands
 */

#define WFC_DOWNLOAD_SAMPLE
#define WFC_DOWNLOAD_BLOCK
#define WFC_DOWNLOAD_MULTISAMPLE
#define WFC_DOWNLOAD_SAMPLE_ALIAS
#define WFC_DELETE_SAMPLE
#define WFC_REPORT_FREE_MEMORY
#define WFC_DOWNLOAD_PATCH
#define WFC_DOWNLOAD_PROGRAM
#define WFC_SET_SYNTHVOL
#define WFC_SET_NVOICES
#define WFC_DOWNLOAD_DRUM
#define WFC_GET_SYNTHVOL
#define WFC_GET_NVOICES
#define WFC_DISABLE_CHANNEL
#define WFC_ENABLE_CHANNEL
#define WFC_MISYNTH_OFF
#define WFC_MISYNTH_ON
#define WFC_FIRMWARE_VERSION
#define WFC_GET_NSAMPLES
#define WFC_DISABLE_DRUM_PROGRAM
#define WFC_UPLOAD_PATCH
#define WFC_UPLOAD_PROGRAM
#define WFC_SET_TUNING
#define WFC_GET_TUNING
#define WFC_VMIDI_ON
#define WFC_VMIDI_OFF
#define WFC_MIDI_STATUS
#define WFC_GET_CHANNEL_STATUS
#define WFC_DOWNLOAD_SAMPLE_HEADER
#define WFC_UPLOAD_SAMPLE_HEADER
#define WFC_UPLOAD_MULTISAMPLE
#define WFC_UPLOAD_SAMPLE_ALIAS
#define WFC_IDENTIFY_SAMPLE_TYPE
#define WFC_DOWNLOAD_EDRUM_PROGRAM
#define WFC_UPLOAD_EDRUM_PROGRAM
#define WFC_SET_EDRUM_CHANNEL
#define WFC_INSTOUT_LEVELS
#define WFC_PEAKOUT_LEVELS
#define WFC_REPORT_CHANNEL_PROGRAMS
#define WFC_HARDWARE_VERSION
#define WFC_UPLOAD_SAMPLE_PARAMS
#define WFC_DOWNLOAD_OS
#define WFC_NOOP

#define WF_MAX_SAMPLE
#define WF_MAX_PATCH
#define WF_MAX_PROGRAM

#define WF_SECTION_MAX

/* # of bytes we send to the board when sending it various kinds of
   substantive data, such as samples, patches and programs.
*/

#define WF_PROGRAM_BYTES
#define WF_PATCH_BYTES
#define WF_SAMPLE_BYTES
#define WF_SAMPLE_HDR_BYTES
#define WF_ALIAS_BYTES
#define WF_DRUM_BYTES
#define WF_MSAMPLE_BYTES

#define WF_ACK
#define WF_DMA_ACK

/* OR-values for MIDI status bits */

#define WF_MIDI_VIRTUAL_ENABLED
#define WF_MIDI_VIRTUAL_IS_EXTERNAL
#define WF_MIDI_IN_TO_SYNTH_DISABLED

/* slot indexes for struct address_info: makes code a little more mnemonic */

#define WF_SYNTH_SLOT
#define WF_INTERNAL_MIDI_SLOT
#define WF_EXTERNAL_MIDI_SLOT

/* Magic MIDI bytes used to switch I/O streams on the ICS2115 MPU401
   emulation. Note these NEVER show up in output from the device and
   should NEVER be used in input unless Virtual MIDI mode has been 
   disabled. If they do show up as input, the results are unpredictable.
*/

#define WF_EXTERNAL_SWITCH
#define WF_INTERNAL_SWITCH

/* Debugging flags */

#define WF_DEBUG_CMD
#define WF_DEBUG_DATA
#define WF_DEBUG_LOAD_PATCH
#define WF_DEBUG_IO

/* WavePatch file format stuff */

#define WF_WAVEPATCH_VERSION
#define WF_MAX_COMMENT
#define WF_NUM_LAYERS
#define WF_NAME_LENGTH
#define WF_SOURCE_LENGTH

#define BankFileID
#define DrumkitFileID
#define ProgramFileID

struct wf_envelope
{};
wavefront_envelope;

struct wf_lfo
{};
wavefront_lfo;

struct wf_patch
{};
wavefront_patch;

struct wf_layer
{};
wavefront_layer;

struct wf_program
{};
wavefront_program;

struct wf_sample_offset
{};
wavefront_sample_offset;          
     
/* Sample slot types */

#define WF_ST_SAMPLE
#define WF_ST_MULTISAMPLE
#define WF_ST_ALIAS
#define WF_ST_EMPTY

/* pseudo's */

#define WF_ST_DRUM
#define WF_ST_PROGRAM
#define WF_ST_PATCH
#define WF_ST_SAMPLEHDR

#define WF_ST_MASK

/* Flags for slot status. These occupy the upper bits of the same byte
   as a sample type.
*/

#define WF_SLOT_USED
#define WF_SLOT_FILLED
#define WF_SLOT_ROM

#define WF_SLOT_MASK

/* channel constants */

#define WF_CH_MONO
#define WF_CH_LEFT
#define WF_CH_RIGHT

/* Sample formats */

#define LINEAR_16BIT
#define WHITE_NOISE
#define LINEAR_8BIT
#define MULAW_8BIT

#define WF_SAMPLE_IS_8BIT(smpl)


/* 

  Because most/all of the sample data we pass in via pointers has
  never been copied (just mmap-ed into user space straight from the
  disk), it would be nice to allow handling of multi-channel sample
  data without forcing user-level extraction of the relevant bytes.
  
  So, we need a way of specifying which channel to use (the WaveFront
  only handles mono samples in a given slot), and the only way to do
  this without using some struct other than wavefront_sample as the
  interface is the awful hack of using the unused bits in a
  wavefront_sample:
  
  Val      Meaning
  ---      -------
  0        no channel selection (use channel 1, sample is MONO)
  1        use first channel, and skip one
  2        use second channel, and skip one
  3        use third channel, and skip two
  4        use fourth channel, skip three
  5        use fifth channel, skip four
  6        use six channel, skip five


  This can handle up to 4 channels, and anyone downloading >4 channels
  of sample data just to select one of them needs to find some tools
  like sox ...

  NOTE: values 0, 1 and 2 correspond to WF_CH_* above. This is 
  important.

*/

#define WF_SET_CHANNEL(samp,chn) 
  
#define WF_GET_CHANNEL(samp)
  
wavefront_sample;

wavefront_multisample;

wavefront_alias;

wavefront_drum;

wavefront_drumkit;

wavefront_channel_programs;

/* How to get MIDI channel status from the data returned by
   a WFC_GET_CHANNEL_STATUS command (a struct wf_channel_programs)
*/

#define WF_CHANNEL_STATUS(ch,wcp)

wavefront_any;

/* Hannu Solvainen hoped that his "patch_info" struct in soundcard.h
   might work for other wave-table based patch loading situations.
   Alas, his fears were correct. The WaveFront doesn't even come with
   just "patches", but several different kind of structures that
   control the sound generation process.
 */

wavefront_patch_info;

/* The maximum number of bytes we will ever move to or from user space
   in response to a WFC_* command.  This obviously doesn't cover
   actual sample data.
*/

#define WF_MAX_READ
#define WF_MAX_WRITE

/*
   This allows us to execute any WF command except the download/upload
   ones, which are handled differently due to copyin/copyout issues as
   well as data-nybbling to/from the card.
 */

wavefront_control;

#define WFCTL_WFCMD
#define WFCTL_LOAD_SPP

/* Modulator table */

#define WF_MOD_LFO1
#define WF_MOD_LFO2
#define WF_MOD_ENV1
#define WF_MOD_ENV2
#define WF_MOD_KEYBOARD
#define WF_MOD_LOGKEY
#define WF_MOD_VELOCITY
#define WF_MOD_LOGVEL
#define WF_MOD_RANDOM
#define WF_MOD_PRESSURE
#define WF_MOD_MOD_WHEEL
#define WF_MOD_1 
#define WF_MOD_BREATH
#define WF_MOD_2
#define WF_MOD_FOOT
#define WF_MOD_4
#define WF_MOD_VOLUME
#define WF_MOD_7
#define WF_MOD_PAN
#define WF_MOD_10
#define WF_MOD_EXPR
#define WF_MOD_11

/* FX-related material */

wavefront_fx_info;

/* support for each of these will be forthcoming once I or someone 
   else has figured out which of the addresses on page 6 and page 7 of 
   the YSS225 control each parameter. Incidentally, these come from
   the Windows driver interface, but again, Turtle Beach didn't
   document the API to use them.
*/

#define WFFX_SETOUTGAIN
#define WFFX_SETSTEREOOUTGAIN
#define WFFX_SETREVERBIN1GAIN
#define WFFX_SETREVERBIN2GAIN
#define WFFX_SETREVERBIN3GAIN
#define WFFX_SETCHORUSINPORT
#define WFFX_SETREVERBIN1PORT
#define WFFX_SETREVERBIN2PORT
#define WFFX_SETREVERBIN3PORT
#define WFFX_SETEFFECTPORT
#define WFFX_SETAUXPORT
#define WFFX_SETREVERBTYPE
#define WFFX_SETREVERBDELAY
#define WFFX_SETCHORUSLFO
#define WFFX_SETCHORUSPMD
#define WFFX_SETCHORUSAMD
#define WFFX_SETEFFECT
#define WFFX_SETBASEALL
#define WFFX_SETREVERBALL
#define WFFX_SETCHORUSALL
#define WFFX_SETREVERBDEF
#define WFFX_SETCHORUSDEF
#define WFFX_DELAYSETINGAIN
#define WFFX_DELAYSETFBGAIN
#define WFFX_DELAYSETFBLPF
#define WFFX_DELAYSETGAIN
#define WFFX_DELAYSETTIME
#define WFFX_DELAYSETFBTIME
#define WFFX_DELAYSETALL
#define WFFX_DELAYSETDEF
#define WFFX_SDELAYSETINGAIN
#define WFFX_SDELAYSETFBGAIN
#define WFFX_SDELAYSETFBLPF
#define WFFX_SDELAYSETGAIN
#define WFFX_SDELAYSETTIME
#define WFFX_SDELAYSETFBTIME
#define WFFX_SDELAYSETALL
#define WFFX_SDELAYSETDEF
#define WFFX_DEQSETINGAIN
#define WFFX_DEQSETFILTER
#define WFFX_DEQSETALL
#define WFFX_DEQSETDEF
#define WFFX_MUTE
#define WFFX_FLANGESETBALANCE	
#define WFFX_FLANGESETDELAY
#define WFFX_FLANGESETDWFFX_TH
#define WFFX_FLANGESETFBGAIN
#define WFFX_FLANGESETINGAIN
#define WFFX_FLANGESETLFO
#define WFFX_FLANGESETALL
#define WFFX_FLANGESETDEF
#define WFFX_PITCHSETSHIFT
#define WFFX_PITCHSETBALANCE
#define WFFX_PITCHSETALL
#define WFFX_PITCHSETDEF
#define WFFX_SRSSETINGAIN
#define WFFX_SRSSETSPACE
#define WFFX_SRSSETCENTER
#define WFFX_SRSSETGAIN
#define WFFX_SRSSETMODE
#define WFFX_SRSSETDEF

/* Allow direct user-space control over FX memory/coefficient data.
   In theory this could be used to download the FX microprogram,
   but it would be a little slower, and involve some weird code.
 */

#define WFFX_MEMSET

#endif /* __SOUND_WAVEFRONT_H__ */