@@ -117,30 +117,30 @@ public int SelectedRegister
117117 public void Reset ( )
118118 {
119119 /*
120- _noiseVal = 0x0FFFF;
121- _outABC = 0;
122- _outNoiseABC = 0;
123- _counterNoise = 0;
124- _counterA = 0;
125- _counterB = 0;
126- _counterC = 0;
127- _EnvelopeCounterBend = 0;
128-
129- // clear all the registers
130- for (int i = 0; i < 14; i++)
131- {
132- SelectedRegister = i;
133- PortWrite(0);
134- }
135-
136- randomSeed = 1;
137-
138- // number of frames to update
139- var fr = (_audioBufferIndex * _tStatesPerFrame) / _audioBuffer.Length;
140-
141- // update the audio buffer
142- BufferUpdate(fr);
143- */
120+ _noiseVal = 0x0FFFF;
121+ _outABC = 0;
122+ _outNoiseABC = 0;
123+ _counterNoise = 0;
124+ _counterA = 0;
125+ _counterB = 0;
126+ _counterC = 0;
127+ _EnvelopeCounterBend = 0;
128+
129+ // clear all the registers
130+ for (int i = 0; i < 14; i++)
131+ {
132+ SelectedRegister = i;
133+ PortWrite(0);
134+ }
135+
136+ randomSeed = 1;
137+
138+ // number of frames to update
139+ var fr = (_audioBufferIndex * _tStatesPerFrame) / _audioBuffer.Length;
140+
141+ // update the audio buffer
142+ BufferUpdate(fr);
143+ */
144144 }
145145
146146 /// <summary>
@@ -359,36 +359,36 @@ public void UpdateSound(int frameCycle)
359359 /// The register array
360360 /// </summary>
361361 /*
362- The AY-3-8910/8912 contains 16 internal registers as follows:
363-
364- Register Function Range
365- 0 Channel A fine pitch 8-bit (0-255)
366- 1 Channel A course pitch 4-bit (0-15)
367- 2 Channel B fine pitch 8-bit (0-255)
368- 3 Channel B course pitch 4-bit (0-15)
369- 4 Channel C fine pitch 8-bit (0-255)
370- 5 Channel C course pitch 4-bit (0-15)
371- 6 Noise pitch 5-bit (0-31)
372- 7 Mixer 8-bit (see below)
373- 8 Channel A volume 4-bit (0-15, see below)
374- 9 Channel B volume 4-bit (0-15, see below)
375- 10 Channel C volume 4-bit (0-15, see below)
376- 11 Envelope fine duration 8-bit (0-255)
377- 12 Envelope course duration 8-bit (0-255)
378- 13 Envelope shape 4-bit (0-15)
379- 14 I/O port A 8-bit (0-255)
380- 15 I/O port B 8-bit (0-255) (Not present on the AY-3-8912)
381-
382- * The volume registers (8, 9 and 10) contain a 4-bit setting but if bit 5 is set then that channel uses the
383- envelope defined by register 13 and ignores its volume setting.
384- * The mixer (register 7) is made up of the following bits (low=enabled):
385-
386- Bit: 7 6 5 4 3 2 1 0
387- Register: I/O I/O Noise Noise Noise Tone Tone Tone
388- Channel: B A C B A C B A
389-
390- The AY-3-8912 ignores bit 7 of this register.
391- */
362+ The AY-3-8910/8912 contains 16 internal registers as follows:
363+
364+ Register Function Range
365+ 0 Channel A fine pitch 8-bit (0-255)
366+ 1 Channel A course pitch 4-bit (0-15)
367+ 2 Channel B fine pitch 8-bit (0-255)
368+ 3 Channel B course pitch 4-bit (0-15)
369+ 4 Channel C fine pitch 8-bit (0-255)
370+ 5 Channel C course pitch 4-bit (0-15)
371+ 6 Noise pitch 5-bit (0-31)
372+ 7 Mixer 8-bit (see below)
373+ 8 Channel A volume 4-bit (0-15, see below)
374+ 9 Channel B volume 4-bit (0-15, see below)
375+ 10 Channel C volume 4-bit (0-15, see below)
376+ 11 Envelope fine duration 8-bit (0-255)
377+ 12 Envelope course duration 8-bit (0-255)
378+ 13 Envelope shape 4-bit (0-15)
379+ 14 I/O port A 8-bit (0-255)
380+ 15 I/O port B 8-bit (0-255) (Not present on the AY-3-8912)
381+
382+ * The volume registers (8, 9 and 10) contain a 4-bit setting but if bit 5 is set then that channel uses the
383+ envelope defined by register 13 and ignores its volume setting.
384+ * The mixer (register 7) is made up of the following bits (low=enabled):
385+
386+ Bit: 7 6 5 4 3 2 1 0
387+ Register: I/O I/O Noise Noise Noise Tone Tone Tone
388+ Channel: B A C B A C B A
389+
390+ The AY-3-8912 ignores bit 7 of this register.
391+ */
392392 private int [ ] _registers = new int [ 16 ] ;
393393
394394 /// <summary>
@@ -500,20 +500,20 @@ The AY-3-8912 ignores bit 7 of this register.
500500 /// </summary>
501501 private static readonly List < uint [ ] > PanTabs = new List < uint [ ] >
502502 {
503- // MONO
504- new uint [ ] { 50 , 50 , 50 , 50 , 50 , 50 } ,
505- // ABC
506- new uint [ ] { 100 , 10 , 66 , 66 , 10 , 100 } ,
507- // ACB
508- new uint [ ] { 100 , 10 , 10 , 100 , 66 , 66 } ,
509- // BAC
510- new uint [ ] { 66 , 66 , 100 , 10 , 10 , 100 } ,
511- // BCA
512- new uint [ ] { 10 , 100 , 100 , 10 , 66 , 66 } ,
513- // CAB
514- new uint [ ] { 66 , 66 , 10 , 100 , 100 , 10 } ,
515- // CBA
516- new uint [ ] { 10 , 100 , 66 , 66 , 100 , 10 }
503+ // MONO
504+ new uint [ ] { 50 , 50 , 50 , 50 , 50 , 50 } ,
505+ // ABC
506+ new uint [ ] { 100 , 10 , 66 , 66 , 10 , 100 } ,
507+ // ACB
508+ new uint [ ] { 100 , 10 , 10 , 100 , 66 , 66 } ,
509+ // BAC
510+ new uint [ ] { 66 , 66 , 100 , 10 , 10 , 100 } ,
511+ // BCA
512+ new uint [ ] { 10 , 100 , 100 , 10 , 66 , 66 } ,
513+ // CAB
514+ new uint [ ] { 66 , 66 , 10 , 100 , 100 , 10 } ,
515+ // CBA
516+ new uint [ ] { 10 , 100 , 66 , 66 , 100 , 10 }
517517 } ;
518518
519519 /// <summary>
@@ -722,40 +722,40 @@ public void GetSamplesSync(out short[] samples, out int nsamp)
722722 tickCounter = 0 ;
723723 return ;
724724 /*
725- _blipL.EndFrame((uint)SampleClock);
726- _blipR.EndFrame((uint)SampleClock);
727- SampleClock = 0;
728-
729- int sampL = _blipL.SamplesAvailable();
730- int sampR = _blipR.SamplesAvailable();
731-
732- if (sampL > sampR)
733- nsamp = sampL;
734- else
735- nsamp = sampR;
736-
737- short[] buffL = new short[sampL];
738- short[] buffR = new short[sampR];
739-
740- _blipL.ReadSamples(buffL, sampL - 1, false);
741- _blipR.ReadSamples(buffR, sampR - 1, false);
742-
743- if (_audioBuffer.Length != nsamp * 2)
744- _audioBuffer = new short[nsamp * 2];
745-
746- int p = 0;
747- for (int i = 0; i < nsamp; i++)
748- {
749- if (i < sampL)
750- _audioBuffer[p++] = buffL[i];
751- if (i < sampR)
752- _audioBuffer[p++] = buffR[i];
753- }
754-
755- //nsamp = _samplesPerFrame;
756- samples = _audioBuffer;
757- DiscardSamples();
758- */
725+ _blipL.EndFrame((uint)SampleClock);
726+ _blipR.EndFrame((uint)SampleClock);
727+ SampleClock = 0;
728+
729+ int sampL = _blipL.SamplesAvailable();
730+ int sampR = _blipR.SamplesAvailable();
731+
732+ if (sampL > sampR)
733+ nsamp = sampL;
734+ else
735+ nsamp = sampR;
736+
737+ short[] buffL = new short[sampL];
738+ short[] buffR = new short[sampR];
739+
740+ _blipL.ReadSamples(buffL, sampL - 1, false);
741+ _blipR.ReadSamples(buffR, sampR - 1, false);
742+
743+ if (_audioBuffer.Length != nsamp * 2)
744+ _audioBuffer = new short[nsamp * 2];
745+
746+ int p = 0;
747+ for (int i = 0; i < nsamp; i++)
748+ {
749+ if (i < sampL)
750+ _audioBuffer[p++] = buffL[i];
751+ if (i < sampR)
752+ _audioBuffer[p++] = buffR[i];
753+ }
754+
755+ //nsamp = _samplesPerFrame;
756+ samples = _audioBuffer;
757+ DiscardSamples();
758+ */
759759 }
760760
761761 public int nullDump = 0 ;
0 commit comments