Csound Csound-dev Csound-tekno Search About

[Cs-dev] csoundTableGet() with Java on Android?

Date2013-01-05 14:55
FromRory Walsh
Subject[Cs-dev] csoundTableGet() with Java on Android?
Any calls I make to csoundAndroid - TableGet() on Android fail, even
when I put the call in my YieldCallack method. It works fine using
csnd on my desktop. Anyone have any ideas what I might try to avoid
crashing my android apps? TableSet() works fine by the way...

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-01-05 15:32
FromVictor Lazzarini
SubjectRe: [Cs-dev] csoundTableGet() with Java on Android?
Did you look at the Waveview example activity? It uses this very function.
On 5 Jan 2013, at 14:55, Rory Walsh wrote:

> Any calls I make to csoundAndroid - TableGet() on Android fail, even
> when I put the call in my YieldCallack method. It works fine using
> csnd on my desktop. Anyone have any ideas what I might try to avoid
> crashing my android apps? TableSet() works fine by the way...
> 
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-01-05 15:57
FromSteven Yi
SubjectRe: [Cs-dev] csoundTableGet() with Java on Android?
I was going to mention using CsoundMYFLTArray but Victor beat me to it. :)

The code in the wave view example shows what to do:

CsoundMYFLTArray table = new CsoundMYFLTArray();
int length = csound.TableLength(1);
csound.GetTable(table.GetPtr(), 1);
tableData = new double[length];

for (int i = 0; i < length; i++) {
    tableData[i] = table.GetValue(i);
}


On Sat, Jan 5, 2013 at 10:32 AM, Victor Lazzarini
 wrote:
> Did you look at the Waveview example activity? It uses this very function.
> On 5 Jan 2013, at 14:55, Rory Walsh wrote:
>
>> Any calls I make to csoundAndroid - TableGet() on Android fail, even
>> when I put the call in my YieldCallack method. It works fine using
>> csnd on my desktop. Anyone have any ideas what I might try to avoid
>> crashing my android apps? TableSet() works fine by the way...
>>
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122912
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-01-05 16:48
FromRory Walsh
SubjectRe: [Cs-dev] csoundTableGet() with Java on Android?
Is this safe to use at any point or must it only be called between
calls to performKsmps()? I guess I'll find out soon enough..


On 5 January 2013 15:57, Steven Yi  wrote:
> I was going to mention using CsoundMYFLTArray but Victor beat me to it. :)
>
> The code in the wave view example shows what to do:
>
> CsoundMYFLTArray table = new CsoundMYFLTArray();
> int length = csound.TableLength(1);
> csound.GetTable(table.GetPtr(), 1);
> tableData = new double[length];
>
> for (int i = 0; i < length; i++) {
>     tableData[i] = table.GetValue(i);
> }
>
>
> On Sat, Jan 5, 2013 at 10:32 AM, Victor Lazzarini
>  wrote:
>> Did you look at the Waveview example activity? It uses this very function.
>> On 5 Jan 2013, at 14:55, Rory Walsh wrote:
>>
>>> Any calls I make to csoundAndroid - TableGet() on Android fail, even
>>> when I put the call in my YieldCallack method. It works fine using
>>> csnd on my desktop. Anyone have any ideas what I might try to avoid
>>> crashing my android apps? TableSet() works fine by the way...
>>>
>>> ------------------------------------------------------------------------------
>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>>> http://p.sf.net/sfu/learnmore_122912
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122912
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-01-05 16:53
FromVictor Lazzarini
SubjectRe: [Cs-dev] csoundTableGet() with Java on Android?
In between performKsmps() I'd say.
On 5 Jan 2013, at 16:48, Rory Walsh wrote:

> Is this safe to use at any point or must it only be called between
> calls to performKsmps()? I guess I'll find out soon enough..
> 
> 
> On 5 January 2013 15:57, Steven Yi  wrote:
>> I was going to mention using CsoundMYFLTArray but Victor beat me to it. :)
>> 
>> The code in the wave view example shows what to do:
>> 
>> CsoundMYFLTArray table = new CsoundMYFLTArray();
>> int length = csound.TableLength(1);
>> csound.GetTable(table.GetPtr(), 1);
>> tableData = new double[length];
>> 
>> for (int i = 0; i < length; i++) {
>>    tableData[i] = table.GetValue(i);
>> }
>> 
>> 
>> On Sat, Jan 5, 2013 at 10:32 AM, Victor Lazzarini
>>  wrote:
>>> Did you look at the Waveview example activity? It uses this very function.
>>> On 5 Jan 2013, at 14:55, Rory Walsh wrote:
>>> 
>>>> Any calls I make to csoundAndroid - TableGet() on Android fail, even
>>>> when I put the call in my YieldCallack method. It works fine using
>>>> csnd on my desktop. Anyone have any ideas what I might try to avoid
>>>> crashing my android apps? TableSet() works fine by the way...
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>>>> http://p.sf.net/sfu/learnmore_122912
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>> 
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>> 
>>> 
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>>> http://p.sf.net/sfu/learnmore_122912
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. SALE $99.99 this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122912
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122912
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-01-05 18:05
FromRory Walsh
SubjectRe: [Cs-dev] csoundTableGet() with Java on Android?
Thanks guys, this class looks like it might do the trick nicely. One
question however. Because Csoundo lets users change between csnd and
csoundandroid at the click of a button, the csound - GetTable() method
becomes problematic because it one case it takes a SWIGTYPE
float(csoundandroid) and in the other it takes a pointer to a SWIGTYPE
double(csnd). Although it might sound ambitious I'd very much like for
users not to have to write different code depending on the target
environments.

As it stands the choice of constructor will create either a Csound()
object, or a CsoundAndroid() object. All the other methods so far are
the same across interfaces so the same code/parameters etc, can be
used. I'm not sure if I'm explaining this correctly, perhaps you could
take a peak at the following:

https://github.com/jacobjoaquin/Csoundo/blob/master/csoundo/src/csoundo/Csoundo.java

Around line 400 is where it gets silly! So while the following code
will work in regulat java mode, it won't in android mode:

  table = new CsoundoArray();
  cs.getTable(table.GetPtr(), 1);

where CsoundoArray is a wrapper for CsoundMYFLTArray. When in android
mode the compiler says:

cannot access csnd.SWIGTYPE_p_p_double

about the GetTable() method. Obviously enough. Question is how can I
overload that function so it fools csnd?

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net