Plays the audio utilizing PC audio system through SourceDataLine

Plays the audio utilizing PC audio system through SourceDataLine

Hi all people,
Can anyone assist me to Plays the audio utilizing PC audio system through SourceDataLine and never headphones


B4X:


Sub Class_Globals
    Private nativeMe As JavaObject
End Sub

'Initializes the item. You can add parameters to this methodology if wanted.
Public Sub Initialize

    nativeMe = Me
    nativeMe.RunMethod( "initialaudio", Null)
End Sub

Public Sub StartAudioPlayer
    nativeMe.RunMethod( "startaudio", Null)
End Sub

Public Sub StopAudioPlayer
    nativeMe.RunMethod( "stopaudio", Null)
End Sub

Public Sub SendDataPlayer (knowledge() As Byte)
    nativeMe.RunMethod( "playaudio", Array(knowledge,knowledge.Length))
End Sub

#IF JAVA
import javax.sound.sampled.*;

    SourceDataLine _speaker;

    public void initialaudio() throws LineUnavailableException{
        //  specifying the audio format
        AudioFormat _format = new AudioFormat(22050.F,// Sample Rate
                16,     // Size of SampleBits
                1,      // Number of Channels
                true,   // Is Signed...

Read extra

HI-FI News

through B4X Programming Forum https://ift.tt/0lZMkuV

August 5, 2025 at 08:32AM