Create file

I want to know about how to create .wav sound for android platform . It seem like method in JuceDemo doesn't work for me because it dont create .wav file when i build . 

Have you given your Android app the required file-access permissions?

i already solved this . i have changed 

this code from jucedemo     

const File file (File::getSpecialLocation (File::userDocumentsDirectory) .getNonexistentChildFile ("myfile", ".wav"));


const File file (File::getSpecialLocation(File::currentExecutableFile).getParentDirectory().getChildFile("myfile.wav"));

and it's work

many thanks for your help anyway 



oh sorry , look like i have problem again ... now my application works great with ios simulator but still not with android 

about file access permission 

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

  uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

i already add this two permission and still doesn't work

Adding android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE to my project's .Jucer file's Custom permission section worked for me... Though I was reading a file which already existed rather than creating one...

That shouldn't be a problem, though.


Erm, have you checked the filename/path specified is correct? Try creating a file somewhere like /sdcard/Test.obj

(check it's there with a file manager app)


Mine had something like:

File file("/sdcard/Test.obj");

if (file.exists())
    DBG("Yes... File exists!")
    DBG("Damnit! /sdcard/Test.obj doesn't exit!")

String obj = file.loadFileAsString();


yeah , it works great with your solution .

but it still want to create new one without specific location , and i can find the way now

i use this code.

 const File file (File::getSpecialLocation(File::userApplicationDataDirectory).getChildFile("samplexx.wav"));

and it works .


Thanks a lot for your help , Dub :D