/** * Furnace Tracker - multi-system chiptune tracker * Copyright (C) 2021-2023 tildearrow and contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include "jack.h" #include "../ta-log.h" int taJACKonSampleRate(jack_nframes_t rate, void* inst) { TAAudioJACK* in=(TAAudioJACK*)inst; in->onSampleRate(rate); return 0; } int taJACKonBufferSize(jack_nframes_t bufsize, void* inst) { TAAudioJACK* in=(TAAudioJACK*)inst; in->onBufferSize(bufsize); return 0; } int taJACKProcess(jack_nframes_t nframes, void* inst) { TAAudioJACK* in=(TAAudioJACK*)inst; in->onProcess(nframes); return 0; } void TAAudioJACK::onSampleRate(jack_nframes_t rate) { if (sampleRateChanged!=NULL) { sampleRateChanged(SampleRateChangeEvent(rate)); } } void TAAudioJACK::onBufferSize(jack_nframes_t bufsize) { if (bufferSizeChanged!=NULL) { bufferSizeChanged(BufferSizeChangeEvent(bufsize)); } } void TAAudioJACK::onProcess(jack_nframes_t nframes) { for (int i=0; idesc.bufsize) { delete[] inBufs[i]; inBufs[i]=new float[nframes]; } memcpy(iInBufs[i],inBufs[i],nframes*sizeof(float)); } for (int i=0; idesc.bufsize) { delete[] outBufs[i]; outBufs[i]=new float[nframes]; } } if (audioProcCallback!=NULL) { if (midiIn!=NULL) midiIn->gather(); audioProcCallback(audioProcCallbackUser,inBufs,outBufs,desc.inChans,desc.outChans,nframes); } for (int i=0; i0) { inBufs=new float*[desc.inChans]; iInBufs=new float*[desc.inChans]; ai=new jack_port_t*[desc.inChans]; for (int i=0; i0) { outBufs=new float*[desc.outChans]; iOutBufs=new float*[desc.outChans]; ao=new jack_port_t*[desc.outChans]; for (int i=0; i