| libws libws
    WSwan hardware library for the Wonderful toolchain | 
| #define WS_SOUND_CH_CTRL_CH1_ENABLE 0x01 | 
| #define WS_SOUND_CH_CTRL_CH2_ENABLE 0x02 | 
| #define WS_SOUND_CH_CTRL_CH2_VOICE 0x20 | 
| #define WS_SOUND_CH_CTRL_CH3_ENABLE 0x04 | 
| #define WS_SOUND_CH_CTRL_CH3_SWEEP 0x40 | 
| #define WS_SOUND_CH_CTRL_CH4_ENABLE 0x08 | 
| #define WS_SOUND_CH_CTRL_CH4_NOISE 0x80 | 
| #define WS_SOUND_FREQ_CH1_PORT 0x80 | 
Sound channel 1 frequency, stored as a divisor. Every 2048 - divisor cycles, the index of the sample to be fetched from the wavetable is incremented.
The resulting frequency is calculated as follows: sample rate = 3072000 Hz / (2048 - divisor).
Note that this refers to the sample rate of each sample in the wavetable, and needs to be scaled accordingly for a given waveform. For example, a 50% duty square wave (16 samples of 0 followed by 16 samples of 15) will have an effective sample rate of (3072000 / 32) Hz / (2048 - divisor), or 96000 Hz / (2048 - divisor).
| #define WS_SOUND_FREQ_CH2_PORT 0x82 | 
| #define WS_SOUND_FREQ_CH3_PORT 0x84 | 
| #define WS_SOUND_FREQ_CH4_PORT 0x86 | 
| #define WS_SOUND_NOISE_CTRL_ENABLE 0x10 | 
| #define WS_SOUND_NOISE_CTRL_RESET 0x08 | 
| #define WS_SOUND_NOISE_LFSR_PORT 0x92 | 
| #define WS_SOUND_OUT_CTRL_HEADPHONE_DETECT 0x80 | 
| #define WS_SOUND_OUT_CTRL_HEADPHONE_ENABLE 0x08 | 
| #define WS_SOUND_OUT_CTRL_PORT 0x91 | 
| #define WS_SOUND_OUT_CTRL_SPEAKER_ENABLE 0x01 | 
| #define WS_SOUND_OUT_CTRL_SPEAKER_VOLUME_100 0x06 | 
| #define WS_SOUND_OUT_CTRL_SPEAKER_VOLUME_200 0x04 | 
| #define WS_SOUND_OUT_CTRL_SPEAKER_VOLUME_400 0x02 | 
| #define WS_SOUND_OUT_CTRL_SPEAKER_VOLUME_800 0x00 | 
| #define WS_SOUND_SPEAKER_VOL_PORT 0x9E | 
| #define WS_SOUND_SWEEP_PORT 0x8C | 
| #define WS_SOUND_SWEEP_TIME_PORT 0x8D | 
| #define WS_SOUND_TEST_CHOUT_L_PORT 0x98 | 
| #define WS_SOUND_TEST_CHOUT_M_PORT 0x9A | 
| #define WS_SOUND_TEST_CHOUT_R_PORT 0x96 | 
| #define WS_SOUND_TEST_FAST_SWEEP 0x02 | 
| #define WS_SOUND_VOICE_SAMPLE_PORT 0x89 | 
| #define WS_SOUND_VOICE_VOL_LEFT_FULL 0x0C | 
| #define WS_SOUND_VOICE_VOL_LEFT_HALF 0x08 | 
| #define WS_SOUND_VOICE_VOL_LEFT_NONE 0x00 | 
| #define WS_SOUND_VOICE_VOL_RIGHT_FULL 0x03 | 
| #define WS_SOUND_VOICE_VOL_RIGHT_HALF 0x02 | 
| #define WS_SOUND_VOICE_VOL_RIGHT_NONE 0x00 | 
| #define WS_SOUND_WAVE_BASE_ADDR | ( | n | ) |