首页 > 解决方案 > 为什么在 java 音频中使用 thread.sleep?

问题描述

   {
           File sound=new File("audiocheck.net_whitenoisegaussian.wav");
           Clip clip=AudioSystem.getClip();
           clip.open(AudioSystem.getAudioInputStream(sound));
           clip.start();
           Thread.sleep((clip.getMicrosecondLength()/1000));//
        } catch(UnsupportedAudioFileException | IOException |  ex);

为什么在这段代码中使用 Thread.sleep !!!?有声音

标签: javamultithreadingfileaudio

解决方案


推荐阅读