Skip to content

AudioSystem.mixerInfo returns 0 mixer (Java 1.3 Service compatibility) #61

@jpragey

Description

@jpragey

When I run the following Ceylon code :

import java.lang { ObjectArray }
import javax.sound.sampled { AudioSystem, Mixer }
hared void run() {
    ObjectArray<Mixer.Info> mixers=AudioSystem.mixerInfo;
    print("Ceylon: ``mixers.size``");
}
module org.audiotest "1.0.0" {
    import java.base "7";
    import java.desktop "7";
}

I get 0 results; however when I run the following Java code (in the same ceylon project):

package org.audiotest;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Mixer;

public class AudioTest {

    public AudioTest() {}

    public static void main(String[] args) {
        Mixer.Info[] mixers = AudioSystem.getMixerInfo();
        System.out.println("Mixers: " + mixers.length);
    }
}

I get 5 results.

I investigated it with eclipse debugger; it ended up in sun.misc.Service$LazyIterator.hasNext() loading "META-INF/services/javax.sound.sampled.spi.MixerProvider" by CeylonModuleClassLoader.getResources(), which returned an empty enumeration.

In pure java it is loaded by sun.misc.Launcher.AppClassLoader.getResources() returns 2 values.
On my PC (linux 64 / openJDK 7)
META-INF/services/javax.sound.sampled.spi.MixerProvider is in /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar.

So the PB is probably a more general Java 1.3 Service SPI and Ceylon class loading compatibility issue than a strictly java audio one.

Full project:
https://drive.google.com/file/d/0B09FzhUz_CgbMkhRenpWQXdfQ2c/edit?usp=sharing

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions