Example #1
0
        public JAIDSPVoice(ref JAIDSPSoundBuffer buff)
        {
            rootBuffer = buff;  // save root buffer.


            voiceHandle = Bass.BASS_StreamCreateFile(buff.globalFileBuffer, 0, buff.fileBuffer.Length, BASSFlag.BASS_DEFAULT);

            if (buff.looped)
            {
                //Console.WriteLine("Force loop!");
                syncHandle = Bass.BASS_ChannelSetSync(voiceHandle, BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME, buff.loopEnd, JAIDSP.globalLoopProc, new IntPtr(buff.loopStart));
            }
        }
Example #2
0
        public static JAIDSPSoundBuffer SetupSoundBuffer(byte[] pcm, int cn, int sr, int bs)
        {
            v1++;

            var rt = new JAIDSPSoundBuffer()
            {
                format = new JAIDSPFormat()
                {
                    channels   = cn,
                    sampleRate = sr,
                },
                buffer = pcm,
                looped = false,
            };

            rt.generateFileBuffer();
            //File.WriteAllBytes("test/" + v1.ToString() + ".wav", rt.fileBuffer);
            return(rt);
        }
Example #3
0
        public static JAIDSPSoundBuffer SetupSoundBuffer(byte[] pcm, int cn, int sr, int bs, int ls, int le)
        {
            v1++;
            var rt = new JAIDSPSoundBuffer()
            {
                format = new JAIDSPFormat()
                {
                    channels   = cn,
                    sampleRate = sr,
                },
                buffer    = pcm,
                loopStart = (int)Math.Floor((ls / 8f) * 16f), // 16 samples = 8 bytes
                loopEnd   = (int)Math.Floor((le / 8f) * 16f),
                looped    = true,
            };

            rt.generateFileBuffer();
            //File.WriteAllBytes("test/" + v1.ToString() + ".wav", rt.fileBuffer) ;
            return(rt);
        }