[Csnd-dev] odd issue with latest Windows build...?
Date | 2016-04-03 12:21 |
From | Rory Walsh |
Subject | [Csnd-dev] odd issue with latest Windows build...? |
I'm seeing some strange issues with Cabbage for Windows now that I'm using msys2 to build everything. The following code works fine on other OSs, but is now causing a memory issue on Windows:
for(int channel = 0; channel < getNumOutputChannels(); channel++ ) { audioBuffer = buffer.getWritePointer(channel,0); pos = csndIndex*getNumOutputChannels(); float samp = audioBuffer[i]*cs_scale; CSspin[channel+pos] = samp; audioBuffer[i] = (CSspout[channel+pos]/cs_scale); } Here is the output from DrMemory. Line 2163 is the line that access CSspin[] and line 2164 is the one that accesses CSpout[]. It seems to tell me that pos is out of bounds? But if that was teh case it would show on OSX and Linux too right? The weirdest thing is that many instruments continue to run perfectly fine, and then boom, the whole thing comes crashing down. Mostly when I try to recreate and recompile my main Csound object. Anyone any ideas? Error #1: UNADDRESSABLE ACCESS beyond heap bounds: writing 8 byte(s) # 0 CabbagePluginAudioProcessor::processBlock [../../Source/Plugin/CabbagePluginProcessor.cpp:2163] # 1 juce::AudioProcessorPlayer::audioDeviceIOCallback [../../JuceLibraryCode/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp:166] # 2 DSOUND.dll!DirectSoundCaptureEnumerateW +0xaca2 (0x00007ffd0a38dc73 <DSOUND.dll+0x1dc73>) # 3 DSOUND.dll!DllCanUnloadNow +0x5511 (0x00007ffd0a3a3152 <DSOUND.dll+0x33152>) # 4 KERNELBASE.dll!InitOnceExecuteOnce +0x9 (0x00007ffd35de10ea <KERNELBASE.dll+0x510ea>) # 5 juce::AudioDeviceManager::audioDeviceIOCallbackInt [../../JuceLibraryCode/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:735] # 6 juce::AudioDeviceManager::CallbackHandler::audioDeviceIOCallback [../../JuceLibraryCode/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:56] # 7 juce::CriticalSection::enter [../../JuceLibraryCode/modules/juce_core/native/juce_win32_Threads.cpp:75] # 8 juce::DSoundAudioIODevice::run [../../JuceLibraryCode/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp:1001] # 9 juce::Thread::threadEntryPoint [../../JuceLibraryCode/modules/juce_core/threads/juce_Thread.cpp:101] #10 juce::threadEntryProc [../../JuceLibraryCode/modules/juce_core/threads/juce_Thread.cpp:113] #11 msvcrt.dll!beginthreadex #12 msvcrt.dll!endthreadex #13 KERNEL32.dll!BaseThreadInitThunk +0x21 (0x00007ffd38722d92 <KERNEL32.dll+0x12d92>) Note: refers to 0 byte(s) beyond last valid byte in prior malloc Error #2: UNADDRESSABLE ACCESS beyond heap bounds: reading 8 byte(s) # 0 CabbagePluginAudioProcessor::processBlock [../../Source/Plugin/CabbagePluginProcessor.cpp:2164] # 1 juce::AudioProcessorPlayer::audioDeviceIOCallback [../../JuceLibraryCode/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp:166] # 2 DSOUND.dll!DirectSoundCaptureEnumerateW +0xaca2 (0x00007ffd0a38dc73 <DSOUND.dll+0x1dc73>) # 3 DSOUND.dll!DllCanUnloadNow +0x5511 (0x00007ffd0a3a3152 <DSOUND.dll+0x33152>) # 4 KERNELBASE.dll!InitOnceExecuteOnce +0x9 (0x00007ffd35de10ea <KERNELBASE.dll+0x510ea>) # 5 juce::AudioDeviceManager::audioDeviceIOCallbackInt [../../JuceLibraryCode/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:735] # 6 juce::AudioDeviceManager::CallbackHandler::audioDeviceIOCallback [../../JuceLibraryCode/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:56] # 7 juce::CriticalSection::enter [../../JuceLibraryCode/modules/juce_core/native/juce_win32_Threads.cpp:75] # 8 juce::DSoundAudioIODevice::run [../../JuceLibraryCode/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp:1001] # 9 juce::Thread::threadEntryPoint [../../JuceLibraryCode/modules/juce_core/threads/juce_Thread.cpp:101] #10 juce::threadEntryProc [../../JuceLibraryCode/modules/juce_core/threads/juce_Thread.cpp:113] #11 msvcrt.dll!beginthreadex #12 msvcrt.dll!endthreadex #13 KERNEL32.dll!BaseThreadInitThunk +0x21 (0x00007ffd38722d92 <KERNEL32.dll+0x12d92>) Note: refers to 0 byte(s) beyond last valid byte in prior malloc |
Date | 2016-04-03 23:46 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
I did some more digging on this and it turns out that getKsmps() is not always returning the correct value for me, which explains the problems with spin and spout. 99% of the time it returns the correct ksmps value, but with the following instrument it always returns 22050. I don't get this issue with the CLI for Csound. It's only when I run Csound through Cabbage. Here's the instrument that causes the problems: sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 giSine ftgen 0, 0, 65536, 10, 1 giSquare ftgen 0, 0, 128, 7, 1, 64, 1, 0, -1, 64, -1 giSquarePos ftgen 0, 0, 128, 7, 1, 64, 1, 0, 0, 64, 0 instr 3 krise = 2 ; with this variable present, the oscillator will not go faster than 1 Hz kgateRate = 5 kgateLfo oscil 1, kgateRate, giSquarePos ; outs upsamp(kgateLfo), upsamp(kgateLfo) printk2 kgateLfo endin If I remove krise it works fine. Leave krise in and ksmps changes from 32 to 22050. I totally stumped. On 3 April 2016 at 12:21, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2016-04-04 07:42 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
Does this happen on other platforms? Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-04-04 07:44 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
by the way ksmps=22050 means kr= 2 Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-04-04 09:07 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
No it doesn't happen on Linux. I will try today on osx but I suspect it is a window only problem. On 4 Apr 2016 7:44 am, "Victor Lazzarini" <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2016-04-04 09:23 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
Did you try using any other combination of kr* = 2? It appears to be something to do with that. Also can you add print ksmps in two places; out of the instrument and inside the instrument to see what it prints? ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 4 Apr 2016, at 09:07, Rory Walsh |
Date | 2016-04-04 09:43 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
print ksmps prints 22050, both inside and out side of the instrument. I've also tried several different kr, ksmps combos, 128, 256, 1024, etc. I'll have to start placing breakpoints in the Csound source. On 4 April 2016 at 09:23, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: Did you try using any other combination of kr* = 2? It appears to be something to do with that. |
Date | 2016-04-04 09:54 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
What if you change krise to say 4, or 10, or whatever? ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 4 Apr 2016, at 09:43, Rory Walsh |
Date | 2016-04-04 12:02 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
Yes. Changing it to 4 actually helps it work. Btw, I just tried on OSX and I get the same results as Windows. On 4 April 2016 at 09:54, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: What if you change krise to say 4, or 10, or whatever? |
Date | 2016-04-04 15:26 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
GOod and bad news. THe bad news is that I'm seeing the same issue now on Linux. The good news is that my build setup on Linux is far better than the other two platforms. So at the moment I'm trying to step run through the Csound source to see if I can identify what's going on. When does ksmps first get set? That's what I'm looking for right now. Any other ideas I might try? On 4 April 2016 at 12:02, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2016-04-04 15:45 |
From | Oeyvind Brandtsegg |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
Just chiming in, unless it is obvious... I think what happens is that the variable name "krise" is interpreted as "kr". I tested it here now, and this is how it behaves. For some reason the last part of the name is ignored, so any variable starting with the letters "kr" actually sets kr, regardless of any additional characters (krise, kruse, krase, krap...). It is strange that it happens in Cabbage and not in the CLI. 2016-04-04 16:26 GMT+02:00 Rory Walsh |
Date | 2016-04-04 15:59 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
Thanks Oeyvind. I think you're right, and I think I know exactly where this is happening. On 4 April 2016 at 15:45, Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no> wrote: Just chiming in, |
Date | 2016-04-04 16:02 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
How is this code compiled? I mean what function are you using? It looks like a parser issue. If you are compiling on the fly, it might be to do with the changes related to compileCSD that John did (to do with core files). It’s a major issue, if that is the case. ksmps/kr are set in the header in the first compilation and will not change (csound_orc_compile.c), ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 4 Apr 2016, at 15:26, Rory Walsh |
Date | 2016-04-04 16:03 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
This is what I guessed this morning. The difference might be to do with what API functions you are calling to compile this code. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 4 Apr 2016, at 15:59, Rory Walsh |
Date | 2016-04-04 16:05 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
I can now confirm this is a Cabbage issue and not a Csound one. So users were experiencing some issues with inconsistent kr rates a few months back and I added a ksmps override call. This is what was causing the problems. Thanks for all the help. What a stupid little bug. On 4 April 2016 at 16:02, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: How is this code compiled? I mean what function are you using? |
Date | 2016-04-04 16:49 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
and how is krise etc involved? Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-04-04 17:10 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
I was parsing some code myself as a work around to another issue, as a workaround to another workaround, etc. I can summarise it in the following method: while(workAround==shit) { if(workaroundWasWrittenByMe==false) workAround==good else workAround==shit } I have no idea how changing the value of krise had any effect on it, but I'm pretty sure it's caught and fixed now. On 4 April 2016 at 16:49, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2016-04-04 17:15 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
Did you parse the Csound code to look for 'kr'? Victor Lazzarini Dean of Arts, Celtic Studies, and Philosophy Maynooth University Ireland
|
Date | 2016-04-04 17:16 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] odd issue with latest Windows build...? |
I did. But did it half arsed. I can't even recall why I put that code in their, when Csound does a perfectly find job of parsing for kr! On 4 April 2016 at 17:15, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|