Copyright Echo Digital Audio Corporation (c) 1998 - 2004 All rights reserved www.echoaudio.com
This file is part of Echo Digital Audio's generic driver library.
Echo Digital Audio's generic driver library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* * * Defines to handle the MIDI input state engine; these are used to properly * extract MIDI time code bytes and their timestamps from the MIDI input stream. *
*/
Setting the sample rates on Layla24 is somewhat schizophrenic.
For standard rates, it works exactly like Mona and Gina24. That is, for 8, 11.025, 16, 22.05, 32, 44.1, 48, 88.2, and 96 kHz, you just set the appropriate bits in the control register and write the control register.
In order to support MIDI time code sync (and possibly SMPTE LTC sync in the future), Layla24 also has "continuous sample rate mode". In this mode, Layla24 can generate any sample rate between 25 and 50 kHz inclusive, or 50 to 100 kHz inclusive for double speed mode.
To use continuous mode:
-Set the clock select bits in the control register to 0xe (see the #define below)
-Set double-speed mode if you want to use sample rates above 50 kHz
-Write the control register as you would normally
-Now, you need to set the frequency register. First, you need to determine the value for the frequency register. This is given by the following formula:
-Wait for the DSP handshake -Write the frequency_reg value to the .SampleRate field of the comm page -Send the vector command SET_LAYLA24_FREQUENCY_REG (see vmonkey.h)
Once you have set the control register up for continuous mode, you can just write the frequency register to change the sample rate. This could be used for MIDI time code sync. For MTC sync, the control register is set for continuous mode. The driver then just keeps writing the SET_LAYLA24_FREQUENCY_REG command.
#define HANDSHAKE_TIMEOUT 20000 /* send_vector command timeout (20ms) */ #define VECTOR_BUSY_TIMEOUT 100000 /* 100ms */ #define MIDI_OUT_DELAY_USEC 2000 /* How long to wait after MIDI fills up */
/* * * Flags for .Flags field in the comm page *
*/
#define DSP_FLAG_MIDI_INPUT 0x0001 /* Enable MIDI input */ #define DSP_FLAG_SPDIF_NONAUDIO 0x0002 /* Sets the "non-audio" bit * in the S/PDIF out status * bits. Clear this flag for * audio data; * set it for AC3 or WMA or
* some such */ #define DSP_FLAG_PROFESSIONAL_SPDIF 0x0008 /* 1 Professional, 0 Consumer */
/* * * Clock detect bits reported by the DSP for Gina20, Layla20, Darla24, and Mia *
*/
/* * * DSP Audio formats * * These are the audio formats that the DSP can transfer * via input and output pipes. LE means little-endian, * BE means big-endian. * * DSP_AUDIOFORM_MS_8 * * 8-bit mono unsigned samples. For playback, * mono data is duplicated out the left and right channels * of the output bus. The "MS" part of the name * means mono->stereo. * * DSP_AUDIOFORM_MS_16LE * * 16-bit signed little-endian mono samples. Playback works * like the previous code. * * DSP_AUDIOFORM_MS_24LE * * 24-bit signed little-endian mono samples. Data is packed * three bytes per sample; if you had two samples 0x112233 and 0x445566 * they would be stored in memory like this: 33 22 11 66 55 44. * * DSP_AUDIOFORM_MS_32LE * * 24-bit signed little-endian mono samples in a 32-bit * container. In other words, each sample is a 32-bit signed * integer, where the actual audio data is left-justified * in the 32 bits and only the 24 most significant bits are valid. * * DSP_AUDIOFORM_SS_8 * DSP_AUDIOFORM_SS_16LE * DSP_AUDIOFORM_SS_24LE * DSP_AUDIOFORM_SS_32LE * * Like the previous ones, except now with stereo interleaved * data. "SS" means stereo->stereo. * * DSP_AUDIOFORM_MM_32LE * * Similar to DSP_AUDIOFORM_MS_32LE, except that the mono * data is not duplicated out both the left and right outputs. * This mode is used by the ASIO driver. Here, "MM" means * mono->mono. * * DSP_AUDIOFORM_MM_32BE * * Just like DSP_AUDIOFORM_MM_32LE, but now the data is * in big-endian format. *
*/
#define DSP_AUDIOFORM_MS_8 0 /* 8 bit mono */ #define DSP_AUDIOFORM_MS_16LE 1 /* 16 bit mono */ #define DSP_AUDIOFORM_MS_24LE 2 /* 24 bit mono */ #define DSP_AUDIOFORM_MS_32LE 3 /* 32 bit mono */ #define DSP_AUDIOFORM_SS_8 4 /* 8 bit stereo */ #define DSP_AUDIOFORM_SS_16LE 5 /* 16 bit stereo */ #define DSP_AUDIOFORM_SS_24LE 6 /* 24 bit stereo */ #define DSP_AUDIOFORM_SS_32LE 7 /* 32 bit stereo */ #define DSP_AUDIOFORM_MM_32LE 8 /* 32 bit mono->mono little-endian */ #define DSP_AUDIOFORM_MM_32BE 9 /* 32 bit mono->mono big-endian */ #define DSP_AUDIOFORM_SS_32BE 10 /* 32 bit stereo big endian */ #define DSP_AUDIOFORM_INVALID 0xFF /* Invalid audio format */
/* * * Super-interleave is defined as interleaving by 4 or more. Darla20 and Gina20 * do not support super interleave. * * 16 bit, 24 bit, and 32 bit little endian samples are supported for super * interleave. The interleave factor must be even. 16 - way interleave is the * current maximum, so you can interleave by 4, 6, 8, 10, 12, 14, and 16. * * The actual format code is derived by taking the define below and or-ing with * the interleave factor. So, 32 bit interleave by 6 is 0x86 and * 16 bit interleave by 16 is (0x40 | 0x10) = 0x50. *
*/
/* * * Gina20 & Layla20 have input gain controls for the analog inputs; * this is the magic number for the hardware that gives you 0 dB at -10. *
*/
#define GL20_INPUT_GAIN_MAGIC_NUMBER 0xC8
/* * * Defines how much time must pass between DSP load attempts *
*/
#define DSP_LOAD_ATTEMPT_PERIOD 1000000L /* One second */
/* * * Size of arrays for the comm page. MAX_PLAY_TAPS and MAX_REC_TAPS are * no longer used, but the sizes must still be right for the DSP to see * the comm page correctly. *
*/
/* sg_entry is a single entry for the scatter-gather list. The array of struct
sg_entry struct is read by the DSP, so all values must be little-endian. */
The comm page. This structure is read and written by the DSP; the DSP code is a firm believer in the byte offsets written in the comments at the end of each line. This structure should not be changed.
Any reads from or writes to this structure should be in little-endian format.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.