Old 05-10-2021, 07:26 PM   #1
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,640
Default Q: ProtoPlug Play WAV ?

I couldn't get the wav file to play using file_riff when in reajsVST
https://forum.cockos.com/showthread.php?t=253184
So looking at http://hise.audio and also ProtoPlug

But I can't get this Drums120bpm.wav to play in ProtoPlug

Code:
--[[
name: soundfile test
description: A simple demo that plays an audio file.
author: osar.fr
--]]

require "include/protoplug"

local path = "C:\\Temp\\Drums120bpm.wav"
local wave, len

-- 'prepareToPlay' will be triggered when the host sample rate is known,
-- so we can load sound files with automatic sample rate conversion:
plugin.addHandler('prepareToPlay', function()
	local readr = juce.AudioFormatReader(path)
	if readr==nil then error ("can't open wave: "..path) end
	wave, len = readr:readToFloat(2) -- require 2 channels
end)

polyGen.initTracks(8)

function polyGen.VTrack:noteOn(note, vel, ev)
	self.playing = true
	self.wavepos = 0
end

function polyGen.VTrack:noteOff(note, ev)
	self.playing = false
end

function polyGen.VTrack:addProcessBlock(samples, smax)
	for i = 0,smax do
		if self.playing and self.wavepos < len then
			self.wavepos = self.wavepos + 1
			samples[0][i] = samples[0][i] + wave[0][self.wavepos] -- left
			samples[1][i] = samples[1][i] + wave[1][self.wavepos] -- right
		end
	end
end
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.