On Wed, Oct 26, 2011 at 1:19 AM, HamdiHamZ <hamdi.zr...@gmail.com> wrote:

> Hi Dianne and thank you for your reply,
>
>     Sorry, I can't get your point, do you mean that we can't use C++
> at all with the NDK? So why we can see cpp classes in the android
> sources? is it only to build libs and after that libs should be used
> from Java?
>
>
No, it simply means you can't write code that tries to access internal C++
classes from the platform because these are not exposed by the NDK.

In other words, you're trying to access functions that are used by the
system, but not available to applications because they can (and will be) be
modified or removed at will between platform releases, or simply in custom
ROMs.



> Regards,
>
> On Oct 25, 8:38 pm, Dianne Hackborn <hack...@android.com> wrote:
> > This is not part of the NDK.  *NO* C++ classes are part of the NDK.
> >
> > Even if you manage to get this to work, you are using private
> implementation
> > details of the platform, and I can guarantee you that your app will break
> > all over the place on different devices.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Oct 25, 2011 at 1:36 AM, HamdiHamZ <hamdi.zr...@gmail.com>
> wrote:
> > > Hi folks,
> >
> > > I ma trying to write a media player for Android 2.2. I am using
> > > NDK_rb6 to build my JNI library written i C/C++ (under Ubuntu
> > > 11.04)... Actually, I faced a lot of problems of linking and
> > > dependencies, I resolved a lot of the and I am stuck with this one:
> >
> > > ~/dev/workspace/MyApp/jni/android-out.cpp:95: undefined reference to
> > > `android::AudioTrack::set(int, unsigned int, int, int, int, unsigned
> > > int, void (*)(int, void*, void*), void*, int,
> > > android::sp<android::IMemory> const&, bool, int)'
> > > collect2: ld returned 1 exit status
> >
> > > However, I found its definition in $(ANDROID_SRC)/frameworks/base/
> > > media/libmedia/AudioTrack.cpp:
> >
> > > status_t AudioTrack::set(
> > >        int streamType,
> > >        uint32_t sampleRate,
> > >        int format,
> > >        int channels,
> > >        int frameCount,
> > >        uint32_t flags,
> > >        callback_t cbf,
> > >        void* user,
> > >        int notificationFrames,
> > >        const sp<IMemory>& sharedBuffer,
> > >        bool threadCanCallJava,
> > >        int sessionId)
> > > {
> > > ...
> > > }
> >
> > > and in the header that I included (media/audioTrack.h):
> >
> > >   /* Initialize an uninitialized AudioTrack.
> > >     * Returned status (from utils/Errors.h) can be:
> > >     *  - NO_ERROR: successful intialization
> > >     *  - INVALID_OPERATION: AudioTrack is already intitialized
> > >     *  - BAD_VALUE: invalid parameter (channels, format,
> > > sampleRate...)
> > >     *  - NO_INIT: audio server or audio hardware not initialized
> > >     * */
> > >            status_t    set(int streamType      =-1,
> > >                            uint32_t sampleRate = 0,
> > >                            int format          = 0,
> > >                            int channels        = 0,
> > >                            int frameCount      = 0,
> > >                            uint32_t flags      = 0,
> > >                            callback_t cbf      = 0,
> > >                            void* user          = 0,
> > >                            int notificationFrames = 0,
> > >                            const sp<IMemory>& sharedBuffer = 0,
> > >                            bool threadCanCallJava = false,
> > >                            int sessionId = 0);
> >
> > > and I am using it this way:
> >
> > > status = track->set(AudioSystem::MUSIC,
> > >                        audec->samplerate,
> > >                        AudioSystem::PCM_16_BIT,
> > >                        (audec->channels == 1) ?
> > > AudioSystem::CHANNEL_OUT_MONO : AudioSystem::CHANNEL_OUT_STEREO,
> > >                        0,       // frameCount
> > >                        0,       // flags
> > >                        audioCallback,
> > >                        audec,    // user when callback
> > >                        0,       // notificationFrames
> > >                        0,       // shared buffer
> > >                        0);
> >
> > > So I am not able to see where am I wrong?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to