trunk/src/mess/audio/alesis.c
r17432 | r17433 | |
6 | 6 | - volume |
7 | 7 | - panning |
8 | 8 | - output 2 |
9 | | - fix 16-bit output to DAC (currently samples are only shifted by 8) |
10 | | - remove noise during patterns recording |
11 | 9 | |
12 | 10 | ****************************************************************************/ |
13 | 11 | |
r17432 | r17433 | |
70 | 68 | m_output_active = false; |
71 | 69 | m_count = 0; |
72 | 70 | m_cur_sample = 0; |
| 71 | m_shift = 0; |
73 | 72 | memset(m_cmd, 0, sizeof(m_cmd)); |
74 | 73 | } |
75 | 74 | |
r17432 | r17433 | |
82 | 81 | { |
83 | 82 | INT16 sample = m_samples[m_cur_sample++]; |
84 | 83 | |
85 | | // FIXME |
86 | | sample <<= 8; |
| 84 | if (sample == -128 && m_shift) |
| 85 | { |
| 86 | /* |
| 87 | The HR-16 seems to use a simple scheme to generate 16-bit samples from its 8-bit sample ROMs. |
| 88 | When the sound starts the 8-bit sample is sent to the most significant bits of the DAC and every |
| 89 | time a -1 sample is found the data is shifted one position to right. |
| 90 | */ |
| 91 | sample = m_samples[m_cur_sample++]; |
| 92 | m_shift--; |
87 | 93 | |
88 | | m_dac->write_signed16(sample + 0x8000); |
| 94 | if (LOG) logerror("DM3AG '%s' shift: %02x\n", tag(), m_shift); |
| 95 | } |
89 | 96 | |
| 97 | m_dac->write_signed16((sample << m_shift) + 0x8000); |
| 98 | |
90 | 99 | // every block ends with three or more -1 samples |
91 | 100 | if (m_cur_sample == 0xfffff || (m_samples[m_cur_sample-1] == -128 && m_samples[m_cur_sample] == -128 && m_samples[m_cur_sample+1] == -128)) |
92 | 101 | { |
r17432 | r17433 | |
122 | 131 | if (m_cur_sample > 0) |
123 | 132 | { |
124 | 133 | m_output_active = true; |
| 134 | m_shift = 8; |
125 | 135 | |
126 | 136 | if (LOG) |
127 | 137 | { |