DLL Wrapper works when functions called out of main(), not from elsewhere?

Hello all,
I am currently trying the JSAsio wrapper out ( http://sourceforge.net/projects/jsasio )
Support on this project is nearly unexisting and a lot of people seem to complain that it doesn't work well.
It works very nicely here, I wrote a few test classes which called some functions (like playing a sound or recording it) and had no problems whatsoever.
These test classes were all static functions and ran straight out of the main() method and printed some results to the console.
     public static void main(String[] args)
          boolean result = callFunction();
          .. end..
     public static boolean callFunction()
          initASIO();
          openASIOLine();
          return true;
     }The results were all great!
Then I tried to implement these test classes into my swing-based applications. So I want to call these same functions, as in the test classes, as a result of any user action (for example, selecting the asio driver in a combobox) But then these asio driver functions just stop to work. I get errors saying that the ASIO driver is not available. (meaning that the dll wrapper loads the wrong asio driver or can't load one at all)
The library path and classpath are all set correctly, exactly the same as the test classes. Even copied the test code word for word in to my swing applications but it still will not work. I am calling these functions in a new Thread, and even put them in a static methods to try and get that working. When calling these asio methods from the main() method AFTER I set up my components gives me the desired results as well. But as soon as I call these same methods (which are in the same class) from a swing event, it fails;
public class ASIOTest
     public static void main(String[] args)
          ASIOTest test = new ASIOTest();
          test.callFunction(); // <-- WORKS
     public ASIOTest()
          initializeComponents();
     private void initializeComponents()
          frame = new JFrame();
          choices = new JComboBox();
          choices.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event)
                 // user made selection
                new Thread(
                        new Runnable() {
                            public void run() {
                                try
                                     callFunction(); // <-- DOES NOT WORK
                                catch (Exception e)
                                    e.printStackTrace();
                        }).start();
     public void callFunction()
          initASIO();
          openASIOLine();
}Is there something fundamental I am missing here?
For what reasons can an application which uses JNI functions go wrong when working in a swing enviroment? (and out of a static context, although this does not seem to make any difference, eg. when calling these functions from static methods inside another class, inside a new thread when the user has generated an event)
I am hoping someone could point me in the right direction :-)
Thank you in advance,
Steven
Edited by: dekoffie on Apr 21, 2009 11:11 AM
Edited by: dekoffie on Apr 21, 2009 11:16 AM

jschell wrote:
Two applications.
And you probably run them two different ways.
The environment is different so one works and the other doesn't.Thank you for your fast reply!
Well, I am running the "updated" version from the same environment; I copied the jframe, and a jcombobox into my original test class which only ran in the java console. Consider my second code example in my original post as the "updated" version of the first code example. And as I pointed out, it works fine when I call the jni functions in the main method, but not when I call it from inside the ActionListener.
Or am I again missing something essential by what you mean with a different environment? The classpath and the working directory is exactly the same, as is the Djava.library.path option. :-)
Thanks again!

Similar Messages

  • I just got my iphone and everything seems to work until i try to call someone. They cant hear me. When i face time the mic works and the speaker works for the voice memo but it doesnt work when i call out. i tried resetting should i try restoring?

    i just got my iphone 4 and it seems to work well expect when i call out. the other party cant hear me at all...if i face time the mic works and if i use the voice memo it works as well. idk what to do. i reset the phone should i try restoring it again?

    I've got the same issue. It just stopped working today. Kinda upset

  • My FaceTime isn't working, when I call someone, they do not receive the invitation.

    I call someone on FaceTime
    and they never receive any notice that I called at all. In this case, they can never answer. Please help me

    Hello I Like iPAd,
    Thanks for using Apple Support Communities.
    To troubleshoot issues with FaceTime on your iPad, please follow the steps in the article linked to below.
    iOS: Troubleshooting FaceTime
    http://support.apple.com/kb/TS3367
    Take care,
    Alex H.

  • All of the sudden my music will not play nor will sound play on games or texts. It will work when people call but I can not push the buttons for volume control either. Anyone help???

    Help

    Follow basic troubleshooting found in your user Guide for your phone.
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf
    #1: Reset: http://support.apple.com/kb/HT1430
    #2: Restore: http://support.apple.com/kb/HT1414

  • I wanted to know why they call me when I do not show the number but I get the words private number, and even when I call out to another private number.

    I wanted to know why they call me when I do not show the number but I get the words private number, and even when I call out to another private number.I tried it in the settings to activate id shows but nothing has changed. I hope you can help me.

    Cloud programs do not use serial numbers... you log in to your paid Cloud account to download & install & activate... you MAY need to log out of the Cloud and restart your computer and log back in to the Cloud for things to work
    Some general information for a Cloud subscription
    Log out of your Cloud account... Restart your computer... Log in to your paid Cloud account
    -Sign in help http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html
    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
    Does your Cloud subscription properly show on your account page?
    If you have more than one email, are you sure you are using the correct Adobe ID?
    https://www.adobe.com/account.html for subscriptions on your Adobe page

  • I needed to install a previously purchased CS6 versus on new computer. To do this, I had to download a version from CC. I will not be using CC. How do I activate Photoshop under my license so that it does not stop working when I am out of communication ra

    I needed to install a previously purchased CS6 versus on new computer. To do this, I had to download a version from CC. I will not be using CC. How do I activate Photoshop under my license so that it does not stop working when I am out of communication range a month from now?

    The CC version will not activate with your perpetual CS6 license. Download the version from here:
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    Your number should work with this version.

  • My microphone dosen't work when i call !! the caller can not hear me !! Any answer to this probleme ??

    my microphone dosen't work when i call !! the caller can not hear me !! Any answer to this probleme ??

    HI there,
    Please see the video link below to learn how to remove the pairing from your iPhone, powercycle the phone, reset the BlueAnt Q2 (please check which BlueAnt device you have and reset as approopriate) and then pair with iPhone again.
    http://www.myblueant.com/support/videos/Q2/iPhone/remove_and_reset/
    If this does not resolve your problem please contact our customer support team on +1 855 9 BLUEANT or +1 855 9 2583 268.
    Hope this helps
    Scott

  • Microphone of my iphone is not working when i call anyone nobody can listen but me, its working with headphone but its also working with videocam recording, please help me to solve this probelm.

    microphone of my iphone is not working when i call anyone nobody can listen me its working with headphone. but it is working with videocam recording, please help me to solve this probelm.

    Try this:
    1. Reset the iPhone by pressing and holding the sleep/wake and home buttons and releasing them, when the Apple logo appears on the display. Now test again.
    2. If the issue persists: Restore the iPhone without any of your own content, using this description from Apple: http://support.apple.com/kb/HT4137
    3. If the issue persists, Your iPhone need repair.

  • My transparency does not work on my iPhone and I was wondering how I fix that? It worked when I first downloaded ios7 but not now.

    My transparency does not work on my iPhone and I was wondering how I fix that? It worked when I first downloaded ios7 but not now.

    Hello wilsontot_too,
    Thank you for the details of the issue you are experiencing on your iPhone.  It sounds like you are not noticing transparency on your iPhone.  It may be that you have "Increase Contrast" turned on in your iPhone settings.
    I recommend verifying that Increase Contrast is turned off in Settings>General>Accessibility.
    iPhone User Guide - Large, bold, and high-contrast text
    http://help.apple.com/iphone/7/#/iph73b89c6
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • When someone calls me on Viber, WhatsApp and elsewhere do not appear on my iphone, and when you enjoy my photos on instagram also does not appear to do I do, take the technical assistance?

    when someone calls me on Viber, WhatsApp and elsewhere do not appear on my iphone, and when you enjoy my photos on instagram also does not appear to do I do, take the technical assistance?

    What iPhone do you have? You can check in settings>>general>> about.
    If you have a 3G you cannot update beyond iOS 4.2.1. The 3G is over 4 years old an was discontinued over 2 1/2 years ago. You need the latest ios to run the latest versions of some apps. If you have a 3GS you can update.
    If your phone is not responding, reset it by pressing and holding down both the home button ad lock/ sleep button simultaneously until the Apple logo appears.

  • When i call someone i can not hear the phone ring or the people talking.  they can not hear me either.  what i do notice if i select speaker then i can hear them through the speaker phone only

    when i call someone i can not hear the phone ring or the people talking.  They can not hear me either.  what i do notice if i select speaker then i can hear them through the speaker phone only

    If there's an Apple store nearby make an appointment with the genius bar to have it checked.  Be sure to sync it and back it up, as well as import your photos and videos to your computer and back up your contacts separately (such as by sync them with iCloud) in case it needs to be replaced.

  • After update 7.1.0. my sound only works for phone calls,emails etc, but not for music or games

    after update 7.1.0. my sound only works for phone calls,emails etc, but not for music or games

    Maybe I understood your problem. Get to Settings > Sounds > Ringers and Alerts >Turn Change With Buttons to Off. And if your Side Switch is assigned to 'Mute', turn it back on, else, use the control center to turn off mute.
        P/s: And your name is...

  • Flex: Method doesn't work when being called on parentDocument

    Hi,
    I wonder is anyone can look at this code and tell me why calling the  removeSelectedChild works when called from the same document, but  returns the following error when called from the child  document/component.
    "ArgumentError: Error #2025: The supplied DisplayObject must be a  child of the caller."
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
      <mx:Accordion id="myAccordion"
      width="100%" height="100%"
      selectedIndex="0">
      <mx:Script>
        <![CDATA[
          public function removeSelectedChild():void {
            myAccordion.removeChild(myAccordion.selectedChild);
        ]]>
      </mx:Script>
      <mx:headerRenderer>
        <mx:Component>
          <mx:Button click="{ parentDocument.removeSelectedChild() }" />
        </mx:Component>
      </mx:headerRenderer>
      <mx:HBox>
        <mx:Button click="{ removeSelectedChild() }" />
      </mx:HBox>
      </mx:Accordion>
    </mx:Application>
    Clicking on the button in the child produces the expected result,  whilst clicking on the header throws an error despite the fact they both  call exactly the same method.
    Sorry that the example is a little contrived, this problem arose in a  quite complicated view, which was using all kinds of custom components.  This was the only way I could display it in a way that will be quick  for you to compile and easy to focus on the real issue without  background noise.
    I'm pulling my hair out on this one and would really appreciate it if  anyone could help.
    Cheers,
    Chris

    What are you trying to remove?
    myAccordion.removeChild(myAccordion.selectedChild);
    tries to remove the container, which is the child of the Accordion. Is that what you want?
    Also, I'm wondering if  parentDocument.removeSelectedChild() would try to remove the Accordion.
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • IPhone speaker does not work when switching call to hands free option

    having problems with IPhone speaker, not working when switching phone calls to speaker mode, any suggestion?

    Same problem - I was on the phone last night and the speaker switched off and can't figure out what happened. I tried to reset the phone, no sound is working.  I can hear a phone call if I hold it up to my ear. Very frustrating as my phone is less than 3 months old. Tracy

  • NO SOUND ON DV6, BUT STRANGELY WORKS WHEN SKYPE CALLS ARE ON

    Hi,
    I have gone tried many of the things that were provided in these forums but nothing has helped so far. There is no playback from the speakers, so I assumed the speakers were dead and started using external speakers, but strangely the playback started working when I made a skype call.
    Any sounds played from media players, websites or any other source work properly when a skype call is being made.
    As soon as the call is disconnected, everything stops.
    What is the skype call triggering that enables the audio to play.
    I have uninstalled/reinstalled IDT drivers, tried all sorts of configuration settings, but nothing has worked so far.
    What is the problem here and how can it be fixed???
    Please help!!

    Hi,
    I have gone tried many of the things that were provided in these forums but nothing has helped so far. There is no playback from the speakers, so I assumed the speakers were dead and started using external speakers, but strangely the playback started working when I made a skype call.
    Any sounds played from media players, websites or any other source work properly when a skype call is being made.
    As soon as the call is disconnected, everything stops.
    What is the skype call triggering that enables the audio to play.
    I have uninstalled/reinstalled IDT drivers, tried all sorts of configuration settings, but nothing has worked so far.
    What is the problem here and how can it be fixed???
    Please help!!

Maybe you are looking for

  • Why isn't the movie I bought on my iPod Touch not showing up on iTunes?

    I purchased a video while on my iPod Touch one night, but when I got to Sync my iPod, it won't show up in the movies section on iTunes, only on my actual iPod. Is there something that makes it so that purchases on your iPod can't be transfered to iTu

  • I dropped my iPod, now it won't get out of recovery mode!

    I dropped my iPod, now it won't get out of recovery mode! If i don't connect it to the mac, it has the msg in 4 languages saying "connect to your computer. Use iTunes to restore". When i connect it to mac, and itunes is open, it says ipod needs to be

  • Problem with file to file scenario........

    Hi I have done file to file scenario.... I have created all data types,message types and message interfaces in Integration Repository..... and i have created reciever determitaion,interface determination, sender aggrement and reciever aggrement....an

  • Can't Update Because file "exists in filesystem" [SOLVED]

    I am having the below problem: $ sudo pacman -Suyy :: Synchronizing package databases... core 112.9 KiB 2.83M/s 00:00 [###############################################] 100% extra 1763.2 KiB 845K/s 00:02 [##############################################

  • cfdocument background image

    I am creating an appliaction that generates a pdf mock up for a catalog cover with custom content. I tried various methods to get this to work and none of them worked. I tried using both css and html, and referencing the image with an absolute path,