Bass library, VST and IceCast
Posted: Fri Feb 25, 2022 12:20 am
Hello !
My project is a french webradio : Radio Les Floralies.
i'm trying to use Bass library, include stereotool vst too. And next broadcast to my icecast server inside my purebasic program.
But it's difficult to understand what's wrong today inside my code.
You can see my post inside the BASS forum at un4seem website : 'Purebasic, Icecast and Bass'
(https://www.un4seen.com/forum/?topic=19 ... #msg137734)
we're here :
My program correctly play sounds as a playliste on the device 'dispositif' (i can hear the sound on my headphones) . It open the vst, and seems to connect to the icecast server without error... but i've no final sound.
So Is there a BASS - Purebasic guru here ? Someone who managed to use the bass library with purebasic to stream to an icecast server ?
Many thanks !
My project is a french webradio : Radio Les Floralies.
i'm trying to use Bass library, include stereotool vst too. And next broadcast to my icecast server inside my purebasic program.
But it's difficult to understand what's wrong today inside my code.
You can see my post inside the BASS forum at un4seem website : 'Purebasic, Icecast and Bass'
(https://www.un4seen.com/forum/?topic=19 ... #msg137734)
we're here :
My program correctly play sounds as a playliste on the device 'dispositif' (i can hear the sound on my headphones) . It open the vst, and seems to connect to the icecast server without error... but i've no final sound.
Code: Select all
Procedure Son_envoyer_vers_serveur()
Protected HENCODE_encoder
Protected NomServeur.s
Protected MotDePasse.s
Protected Nom.s
Protected Url.s
Protected Genre.s
Protected Description.s
Protected Header.s
Protected Commande.s
Protected NomVst.s
Protected Retour
Protected channel
Protected FDSP
NomServeur = "146.59.233.129:8000/floralies.ogg" ; address:port/mount" (Icecast).
NomServeur = "http://lesfloralies.ovh:8000/floralies.ogg" ; address:port/mount" (Icecast).
MotDePasse = "*****"
Nom = "Radio Les Floralies 2"
Url = "http://www.lesfloralies.info"
Genre = "other"
Description = "Webradio à Castelnaudary France"
Header = ""
Protected Dispositif
Dispositif = gParametres\Dispositif_sonore
Retour = BASS_RecordInit(Dispositif)
If Retour = 0
MessageRequester ("Erreur","RecordInit : " + BASS_ErrorGetCode())
EndIf
Retour = BASS_RecordSetDevice(Dispositif)
If Retour = 0
MessageRequester ("Erreur","RecordSetDevice : " + BASS_ErrorGetCode())
EndIf
Channel = BASS_RecordStart (0, 2, #BASS_RECORD_PAUSE|#BASS_SAMPLE_FLOAT,#Null, #Null)
If Channel = 0
MessageRequester ("Erreur","RecordStart : " + BASS_ErrorGetCode())
EndIf
NomVst = "C:\Users\user\Documents\radio_programmation_purebasic_broadcast\vst_stereo_tool_64.dll"
FDSP = BASS_VST_ChannelSetDSP(Channel, @NomVst, #BASS_Unicode, 0);
; panel should To be a second form Or in the Mainform remember the Sterotool Editor is Not small
OpenWindow_vst(0,0)
BASS_VST_EmbedEditor(FDSP, WindowID(Window_vst))
Commande = StringToUTF("oggenc -M %d -m %d -r -R 44100 -")
HENCODE_encoder = BASS_Encode_Start(channel, @Commande, #BASS_ENCODE_NOHEAD, #Null, 0); // setup the encoder
If HENCODE_encoder = 0
MessageRequester ("Erreur","Erreur de l'encodeur OGG Bass : " + BASS_ErrorGetCode())
Else
Ajouter_au_log ("Encodeur OGG Bass fonctionne.", #LOG_DEMARRAGE)
EndIf
Retour = BASS_Encode_CastInit(HENCODE_encoder, NomServeur, MotDePasse, #BASS_ENCODE_TYPE_OGG, Nom, Url , Genre, Description, Header, 192, 1) ; débute le cast
If Retour = 1
Ajouter_au_log ("Connecté au serveur IceCast.", #LOG_DEMARRAGE)
Else
Select BASS_ErrorGetCode()
Case #BASS_ERROR_BUSY
MessageRequester ("Erreur","Le serveur IceCast est déja occupé !")
Default
MessageRequester ("Erreur","Connection serveur IceCast Erreur : " + BASS_ErrorGetCode())
EndSelect
EndIf
BASS_ChannelPlay(Channel, 0)
EndProcedure
Many thanks !