Exemple #1
0
        public SampleSourceVAG(SoundVoice voice, int address, int size, bool loopMode)
        {
            if (!InstanceFieldsInitialized)
            {
                InitializeInstanceFields();
                InstanceFieldsInitialized = true;
            }
            this.voice    = voice;
            this.address  = address;
            this.loopMode = loopMode;

            if (address == 0)
            {
                numberSamples   = 0;
                numberVGABlocks = 0;
            }
            else
            {
                readHeader();

                numberVGABlocks    = size / 16;
                numberSamples      = numberVGABlocks * 28;
                currentSampleIndex = -1;
                SampleIndex        = 0;

                if (log.TraceEnabled)
                {
                    log.trace(string.Format("VAG numberVGABlocks={0:D}, numberSamples={1:D}", numberVGABlocks, numberSamples));
                }
            }
        }
Exemple #2
0
 public SampleSourceWithADSR(ISampleSource sampleSource, SoundVoice voice, VoiceADSREnvelope envelope)
 {
     this.sampleSource = sampleSource;
     this.voice        = voice;
     envelopeState     = new EnvelopeState(envelope);
     tracing           = sceSasCore.log.TraceEnabled;
 }
Exemple #3
0
        public SampleSourcePCM(SoundVoice voice, int addr, int samples, int loopMode)
        {
            this.voice   = voice;
            this.addr    = addr;
            this.samples = samples;
            size         = samples << 1;
            sampleIndex  = samples;

            looping = loopMode >= 0;
        }
Exemple #4
0
 public VoiceADSREnvelope(SoundVoice outerInstance)
 {
     this.outerInstance = outerInstance;
     // Default values (like on PSP)
     AttackRate       = 0;
     DecayRate        = 0;
     SustainRate      = 0;
     ReleaseRate      = 0;
     AttackCurveType  = PSP_SAS_ADSR_CURVE_MODE_LINEAR_INCREASE;
     DecayCurveType   = PSP_SAS_ADSR_CURVE_MODE_LINEAR_DECREASE;
     SustainCurveType = PSP_SAS_ADSR_CURVE_MODE_LINEAR_DECREASE;
     ReleaseCurveType = PSP_SAS_ADSR_CURVE_MODE_LINEAR_DECREASE;
     SustainLevel     = 0;
     height           = 0;
 }
Exemple #5
0
        private void mix(int[] mixedSamples, int addr, int samples, int leftVol, int rightVol, bool writeSamples)
        {
            bool isStereo = Modules.sceSasCoreModule.OutputMode == PSP_SAS_OUTPUTMODE_STEREO;

            for (int i = 0; i < voices.Length; i++)
            {
                SoundVoice voice = voices[i];

                if (voice.Playing && !voice.Paused)
                {
                    ISampleSource sampleSource = synthesizers[i].SampleSource;
                    int           playSample   = voice.PlaySample;
                    if (sampleSource.Ended)
                    {
                        // End of voice sample reached
                        if (log.TraceEnabled)
                        {
                            log.trace(string.Format("Reaching end of sample source for voice {0}", voice));
                        }
                        voice.Playing = false;
                    }
                    else
                    {
                        if (isStereo)
                        {
                            mixStereo(mixedSamples, sampleSource, playSample, samples, voice.LeftVolume, voice.RightVolume);
                        }
                        else
                        {
                            mixMono(mixedSamples, sampleSource, playSample, samples, voice.LeftVolume);
                        }
                        writeSamples = true;

                        voice.PlaySample = 1;
                    }
                }
            }

            if (isStereo)
            {
                copyStereoSamplesToMem(mixedSamples, addr, samples, leftVol, rightVol, writeSamples);
            }
            else
            {
                copyMonoSamplesToMem(mixedSamples, addr, samples, leftVol, writeSamples);
            }
        }
Exemple #6
0
 public SoftwareSynthesizer(SoundVoice voice)
 {
     this.voice = voice;
 }
Exemple #7
0
 public SampleSourceWithPitch(ISampleSource sampleSource, SoundVoice voice)
 {
     this.sampleSource = sampleSource;
     this.voice        = voice;
 }