
AmaDone RadioWeb
Ben moi aussi c pour baisser le son au niveau de la carte mere ou carte son directement. je pensais passer par le controle activex de windows media player, car sous delphi c possible pour géré certaint lien de webradio mais pour le sons je ne c pas.Mais je ne c pas comment géré les activex sous purebasic.
je sais plus qui voulai controller le son a partir un trackbar
exemple:
lecteur_mp3.rar
pour controller le son de la carte mere c le meme principe mais le probleme est que la lib est pas mis a jour
je m'en suis apercue apres
exemple:
lecteur_mp3.rar
pour controller le son de la carte mere c le meme principe mais le probleme est que la lib est pas mis a jour
je m'en suis apercue apres

voila
c'est pas tres propre mais ca marche
je sais pas si ca s'appelle controler le son de la carte son mais ca affecte le son du mappeur window (le petit icone en bas a droite)
pour 4.00:
master_volume.rar
a rajouter dans le code
puis on utilise comm suit
ca donne le resultat du son general de la carte son par defaut
voila j'espere que c ce que vous vouliez ?
c'est pas tres propre mais ca marche

je sais pas si ca s'appelle controler le son de la carte son mais ca affecte le son du mappeur window (le petit icone en bas a droite)
pour 4.00:
master_volume.rar
a rajouter dans le code
puis on utilise comm suit
Code : Tout sélectionner
resultat = GetMasterVolume_(0, 0)
voila j'espere que c ce que vous vouliez ?

Code : Tout sélectionner
; Code : KarLKoX
#MMSYSERR_NOERROR = 0
#MIXER_SHORT_NAME_CHARS = 16
#MIXER_LONG_NAME_CHARS = 64
Structure MIXERCONTROL
cbStruct.l
dwControlID.l
dwControlType.l
fdwControl.l
cMultipleItems.l
szShortName.s[#MIXER_SHORT_NAME_CHARS]
szName.s[#MIXER_LONG_NAME_CHARS]
lMinimum.l
lMaximum.l
reserved.l[10]
EndStructure
Procedure.l MIXER_getVolume(Type.l)
Protected dwVolume.l, result.l, hMixer
Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED
RtlZeroMemory_(ml,SizeOf(MIXERLINE))
RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS))
RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS))
RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED))
result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER)
If result = #MMSYSERR_NOERROR
ml\cbStruct = SizeOf(MIXERLINE)
ml\dwComponentType = Type
result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE)
If result = #MMSYSERR_NOERROR
mlc\cbStruct = SizeOf(MIXERLINECONTROLS)
mlc\dwLineID = ml\dwLineID
mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME
mlc\cControls = 1
mlc\pamxctrl = @mc
mlc\cbmxctrl = SizeOf(MIXERCONTROL)
result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE)
If result = #MMSYSERR_NOERROR
mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS)
mcd\dwControlID = mc\dwControlID;
mcd\paDetails = @mcdu
mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED)
mcd\cChannels = 1
result = mixerGetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE)
If result = #MMSYSERR_NOERROR
dwVolume = mcdu\dwValue
EndIf
EndIf
EndIf
EndIf
ProcedureReturn dwVolume
EndProcedure
; newvolume va de 0 = 65535
Procedure MIXER_setVolume(Type.l, newvolume.l)
Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED
RtlZeroMemory_(ml,SizeOf(MIXERLINE))
RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS))
RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS))
RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED))
result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER)
If result = #MMSYSERR_NOERROR
ml\cbStruct = SizeOf(MIXERLINE)
ml\dwComponentType = Type
result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE)
If result = #MMSYSERR_NOERROR
mlc\cbStruct = SizeOf(MIXERLINECONTROLS)
mlc\dwLineID = ml\dwLineID
mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME
mlc\cControls = 1
mlc\pamxctrl = @mc
mlc\cbmxctrl = SizeOf(MIXERCONTROL)
result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE)
If result = #MMSYSERR_NOERROR
mcdu\dwValue = newvolume
mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS)
mcd\dwControlID = mc\dwControlID
mcd\paDetails = @mcdu
mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED)
mcd\cChannels = 1
result = mixerSetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE)
If result = #MMSYSERR_NOERROR
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndIf
EndIf
EndIf
EndProcedure
#MAIN_WINDOW = 0
#TRACKBAR = 1
If OpenWindow(#MAIN_WINDOW,0,0,100,200,"Controleur de volume principal")
CreateGadgetList(WindowID(#MAIN_WINDOW))
TrackBarGadget(#TRACKBAR, 50, 20, 20, 160, 0, 655, #PB_TrackBar_Vertical)
SetGadgetState(#TRACKBAR,MIXER_getVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS)/100)
Repeat
eventid = WaitWindowEvent()
If eventid = #PB_Event_Gadget
Select EventGadget()
Case #TRACKBAR
curvolume = GetGadgetState(#TRACKBAR)
MIXER_setVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,curvolume*100+36)
EndSelect
EndIf
Until eventid = #PB_Event_CloseWindow
EndIf
"Qui baise trop bouffe un poil." P. Desproges
et vola la nouvelle source
merci KarLKoX
le probleme aparament c'est que les 3/4 des liens sont mort va faloir que je refasse le tour mais pouvez-vous essayé les stations et me dire si chez vous sa fonctionne. merci
@++

Code : Tout sélectionner
InitSound()
InitModule()
;- Window Constants
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
Enumeration
#Frame3D_0
#Frame3D_1
#Button_0
#Button_1
#Button_2
#Button_3
#Button_4
#Button_5
#Button_6
#Button_7
#Button_8
#Button_9
#TRACKBAR
#radio
#Text_0
#Text_1
EndEnumeration
Procedure connexion()
If Connection = 0
MessageRequester("erreur", "AmaDone RadioWeb n'a pas pu se connecter au serveur, veuillez verifier votre connexion.",#MB_ICONERROR)
End
EndIf
EndProcedure
#MMSYSERR_NOERROR = 0
#MIXER_SHORT_NAME_CHARS = 16
#MIXER_LONG_NAME_CHARS = 64
Structure MIXERCONTROL
cbStruct.l
dwControlID.l
dwControlType.l
fdwControl.l
cMultipleItems.l
szShortName.s[#MIXER_SHORT_NAME_CHARS]
szName.s[#MIXER_LONG_NAME_CHARS]
lMinimum.l
lMaximum.l
reserved.l[10]
EndStructure
Procedure.l MIXER_getVolume(Type.l)
Protected dwVolume.l, result.l, hMixer
Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED
RtlZeroMemory_(ml,SizeOf(MIXERLINE))
RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS))
RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS))
RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED))
result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER)
If result = #MMSYSERR_NOERROR
ml\cbStruct = SizeOf(MIXERLINE)
ml\dwComponentType = Type
result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE)
If result = #MMSYSERR_NOERROR
mlc\cbStruct = SizeOf(MIXERLINECONTROLS)
mlc\dwLineID = ml\dwLineID
mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME
mlc\cControls = 1
mlc\pamxctrl = @mc
mlc\cbmxctrl = SizeOf(MIXERCONTROL)
result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE)
If result = #MMSYSERR_NOERROR
mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS)
mcd\dwControlID = mc\dwControlID;
mcd\paDetails = @mcdu
mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED)
mcd\cChannels = 1
result = mixerGetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE)
If result = #MMSYSERR_NOERROR
dwVolume = mcdu\dwValue
EndIf
EndIf
EndIf
EndIf
ProcedureReturn dwVolume
EndProcedure
; newvolume va de 0 = 65535
Procedure MIXER_setVolume(Type.l, newvolume.l)
Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED
RtlZeroMemory_(ml,SizeOf(MIXERLINE))
RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS))
RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS))
RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED))
result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER)
If result = #MMSYSERR_NOERROR
ml\cbStruct = SizeOf(MIXERLINE)
ml\dwComponentType = Type
result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE)
If result = #MMSYSERR_NOERROR
mlc\cbStruct = SizeOf(MIXERLINECONTROLS)
mlc\dwLineID = ml\dwLineID
mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME
mlc\cControls = 1
mlc\pamxctrl = @mc
mlc\cbmxctrl = SizeOf(MIXERCONTROL)
result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE)
If result = #MMSYSERR_NOERROR
mcdu\dwValue = newvolume
mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS)
mcd\dwControlID = mc\dwControlID
mcd\paDetails = @mcdu
mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED)
mcd\cChannels = 1
result = mixerSetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE)
If result = #MMSYSERR_NOERROR
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndIf
EndIf
EndIf
EndProcedure
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Comic Sans MS", 12, #PB_Font_Bold)
If OpenWindow(#Window_0, 216, 0, 350, 400, "AmaDone RadioWeb", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget )
If CreateGadgetList(WindowID(#Window_0))
Frame3DGadget(#Frame3D_0, 10, 10, 330, 230, "STATIONS")
Frame3DGadget(#Frame3D_1, 10, 250, 330, 60, "VOLUME")
ButtonGadget(#Button_0, 20, 30, 130, 30, "nrj")
SetGadgetFont(#Button_0, FontID1)
ButtonGadget(#Button_1, 20, 70, 130, 30, "rfm")
SetGadgetFont(#Button_1, FontID1)
ButtonGadget(#Button_2, 20, 110, 130, 30, "skyrock")
SetGadgetFont(#Button_2, FontID1)
ButtonGadget(#Button_3, 190, 30, 130, 30, "rire et chansons")
SetGadgetFont(#Button_3, FontID1)
ButtonGadget(#Button_4, 190, 70, 130, 30, "nostalgie")
SetGadgetFont(#Button_4, FontID1)
ButtonGadget(#Button_5, 190, 110, 130, 30, "europe 2")
SetGadgetFont(#Button_5, FontID1)
ButtonGadget(#Button_6, 20, 150, 130, 30, "rtl")
SetGadgetFont(#Button_6, FontID1)
ButtonGadget(#Button_7, 20, 190, 130, 30, "rtl²")
SetGadgetFont(#Button_7, FontID1)
ButtonGadget(#Button_8, 190, 150, 130, 30, "contact")
SetGadgetFont(#Button_8, FontID1)
ButtonGadget(#Button_9, 190, 190, 130, 30, "france inter")
SetGadgetFont(#Button_9, FontID1)
TrackBarGadget(#TRACKBAR, 15, 270, 320, 30, 1, 655)
SetGadgetState(#TRACKBAR,MIXER_getVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS)/100)
TextGadget(#Text_0, 10, 330, 230, 50, "actuellement vous n'ecoutez aucune radio")
SetGadgetFont(#Text_0, FontID1)
EndIf
EndIf
Repeat
event = WaitWindowEvent()
If event = #PB_Event_Gadget
Select EventGadget()
Case #Button_0
WebGadget(#radio,0,0,1,1,"http://player.nrj.fr/V4/nrj/nrj_launch_V3.html")
TextGadget(#Text_0, 10, 330, 230, 50, "vous etre actuellement entrain d'ecouter : NRJ")
SetGadgetFont(#Text_0, FontID1)
Case #Button_1
WebGadget(#radio,0,0,1,1,"http://cache.yacast.fr/V4/player_rfm/rfm_main_V2.html")
TextGadget(#Text_0, 10, 330, 230, 50, "vous etre actuellement entrain d'ecouter : RFM")
SetGadgetFont(#Text_0, FontID1)
Case #Button_2
WebGadget(#radio,0,0,1,1,"http://player.skyrock.com/V4/skyrock/skyrock_main_V2.html")
TextGadget(#Text_0, 10, 330, 230, 50, "vous etre actuellement entrain d'ecouter : SKYROCK")
SetGadgetFont(#Text_0, FontID1)
Case #button_3
WebGadget(#radio,0,0,1,1,"http://player.rireetchansons.fr/V4/rireetchansons/rireetchansons_main_V3.html")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : RIRE ET CHANSONS")
SetGadgetFont(#Text_0, FontID1)
Case #button_4
WebGadget(#radio,0,0,1,1,"http://player.nostalgie.fr/V4/nostalgie/nostv2_main.html")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : NOSTALGIE")
SetGadgetFont(#Text_0, FontID1)
Case #button_5
WebGadget(#radio,0,0,1,1,"http://cache.yacast.fr/V4/player_europe2/europe2_launch_V21.html")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : EUROPE 2")
SetGadgetFont(#Text_0, FontID1)
Case #button_6
WebGadget(#radio,0,0,1,1,"http://yacast.rtl.fr/V4/rtl/rtl_launch_V5.html")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : RTL")
SetGadgetFont(#Text_0, FontID1)
Case #button_7
WebGadget(#radio,0,0,1,1,"http://yacast.rtl2.fr/V4/rtl2/rtl2_main_V5.html")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : RTL²")
SetGadgetFont(#Text_0, FontID1)
Case #button_8
WebGadget(#radio,0,0,1,1,"")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : CONTACT")
SetGadgetFont(#Text_0, FontID1)
Case #button_9
WebGadget(#radio,0,0,1,1,"http://viphttp.yacast.net/V4/franceinter/finter_main_V4.html")
TextGadget(#Text_0, 10, 330, 280, 50, "vous etre actuellement entrain d'ecouter : FRANCE INTER")
SetGadgetFont(#Text_0, FontID1)
Case #TRACKBAR
curvolume = GetGadgetState(#TRACKBAR)
MIXER_setVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,curvolume*100+36)
EndSelect
EndIf
Until event = #PB_Event_CloseWindow
@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Salut tous le monde, voici une petite astuce pour contourner l'utilisation du control activex de windows media player.
.
Voila pour mon soft de Web Radio, il me fallais lire des Url avec extention *.asx ou *.asf or la commande
Ben ca marche pas car par defaut c le media player de microsoft qui lit l'adresse et me fait ecouter la radio.
Donc pour que ca marche je me suis dit qu'il faut faire comme dans delphi utiliser un controle Activex du media player.
Mais comme je suis un gros debutant en PB pas moyen d'utiliser d'activex ou de comprendre l'utilisation d'un activex sous PB.
Alors pour faire marcher mon soft, g trouver une petite astuce pour que ca soit completement transparent. C tres simple.
1.
Il faut crée une page html avec ce code et l'url de la radio dedans. (Ce code fait appel a un plugins microsoft qui va charger windows media player dans une page HTML)
2.
Puis cette page vous l'heberger sur votre espace perso de votre FAI
3.
Et enfin dans le code de votre application vous appeler votre page html dans un WebGadget tous simplement.
Voici un exemple: ici
Avantage:
-Completement transparent, facile
Point faible:
Ben si votre FAI vous lache les pageS web n'existe plus donc le soft ne marche plus
Donc voila pour la petite astuce.



Voila pour mon soft de Web Radio, il me fallais lire des Url avec extention *.asx ou *.asf or la commande
Code : Tout sélectionner
WebGadget(#Web_0,0,0,1,1,"http://www.hardradio.com/windowsmedia/hard32.asx")
Donc pour que ca marche je me suis dit qu'il faut faire comme dans delphi utiliser un controle Activex du media player.
Mais comme je suis un gros debutant en PB pas moyen d'utiliser d'activex ou de comprendre l'utilisation d'un activex sous PB.
Alors pour faire marcher mon soft, g trouver une petite astuce pour que ca soit completement transparent. C tres simple.
1.
Il faut crée une page html avec ce code et l'url de la radio dedans. (Ce code fait appel a un plugins microsoft qui va charger windows media player dans une page HTML)
Code : Tout sélectionner
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="media" href="http://www.hardradio.com/windowsmedia/hard32.asx" />
</head>
<body>
<div align="center">
<table width="240 "height="128">
<tr>
<td width="240" height="128"><div align="center">
<!-- Début | Lecteur -->
<object id="MediaPlayer" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject" standby="Loading Microsoft Windows Media Player components..." height=128" width="240" align="absmiddle">
<param name="enabled" value="true" />
<param name="defaultframe" />
<param name="enablecontextmenu" value="false" />
<param name="stretchtofit" value="true" />
<param name="windowlessvideo" value="true" />
<param name="url" value="http://www.hardradio.com/windowsmedia/hard32.asx" />
<param name="autostart" value="true" />
<param name="uimode" value="full" />
<param name="volume" value="30" />
<embed type="application/x-mplayer"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
SRC="http://www.hardradio.com/windowsmedia/hard32.asx"
name="MediaPlayer"
width=240
height=128
autostart=1
showcontrols=1> </embed>
</object>
<!-- Fin | Lecteur -->
</div></td>
</tr>
</table>
</div>
</body>
</html>
Puis cette page vous l'heberger sur votre espace perso de votre FAI
3.
Et enfin dans le code de votre application vous appeler votre page html dans un WebGadget tous simplement.
Voici un exemple: ici
Avantage:
-Completement transparent, facile
Point faible:
Ben si votre FAI vous lache les pageS web n'existe plus donc le soft ne marche plus

Donc voila pour la petite astuce.
KarLKoX a écrit :[/code]Code : Tout sélectionner
; Code : KarLKoX #MMSYSERR_NOERROR = 0 #MIXER_SHORT_NAME_CHARS = 16 #MIXER_LONG_NAME_CHARS = 64 Structure MIXERCONTROL cbStruct.l dwControlID.l dwControlType.l fdwControl.l cMultipleItems.l szShortName.s[#MIXER_SHORT_NAME_CHARS] szName.s[#MIXER_LONG_NAME_CHARS] lMinimum.l lMaximum.l reserved.l[10] EndStructure Procedure.l MIXER_getVolume(Type.l) Protected dwVolume.l, result.l, hMixer Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED RtlZeroMemory_(ml,SizeOf(MIXERLINE)) RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS)) RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS)) RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED)) result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER) If result = #MMSYSERR_NOERROR ml\cbStruct = SizeOf(MIXERLINE) ml\dwComponentType = Type result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE) If result = #MMSYSERR_NOERROR mlc\cbStruct = SizeOf(MIXERLINECONTROLS) mlc\dwLineID = ml\dwLineID mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME mlc\cControls = 1 mlc\pamxctrl = @mc mlc\cbmxctrl = SizeOf(MIXERCONTROL) result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE) If result = #MMSYSERR_NOERROR mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS) mcd\dwControlID = mc\dwControlID; mcd\paDetails = @mcdu mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED) mcd\cChannels = 1 result = mixerGetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE) If result = #MMSYSERR_NOERROR dwVolume = mcdu\dwValue EndIf EndIf EndIf EndIf ProcedureReturn dwVolume EndProcedure ; newvolume va de 0 = 65535 Procedure MIXER_setVolume(Type.l, newvolume.l) Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED RtlZeroMemory_(ml,SizeOf(MIXERLINE)) RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS)) RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS)) RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED)) result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER) If result = #MMSYSERR_NOERROR ml\cbStruct = SizeOf(MIXERLINE) ml\dwComponentType = Type result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE) If result = #MMSYSERR_NOERROR mlc\cbStruct = SizeOf(MIXERLINECONTROLS) mlc\dwLineID = ml\dwLineID mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME mlc\cControls = 1 mlc\pamxctrl = @mc mlc\cbmxctrl = SizeOf(MIXERCONTROL) result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE) If result = #MMSYSERR_NOERROR mcdu\dwValue = newvolume mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS) mcd\dwControlID = mc\dwControlID mcd\paDetails = @mcdu mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED) mcd\cChannels = 1 result = mixerSetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE) If result = #MMSYSERR_NOERROR ProcedureReturn #True Else ProcedureReturn #False EndIf EndIf EndIf EndIf EndProcedure #MAIN_WINDOW = 0 #TRACKBAR = 1 If OpenWindow(#MAIN_WINDOW,0,0,100,200,"Controleur de volume principal") CreateGadgetList(WindowID(#MAIN_WINDOW)) TrackBarGadget(#TRACKBAR, 50, 20, 20, 160, 0, 655, #PB_TrackBar_Vertical) SetGadgetState(#TRACKBAR,MIXER_getVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS)/100) Repeat eventid = WaitWindowEvent() If eventid = #PB_Event_Gadget Select EventGadget() Case #TRACKBAR curvolume = GetGadgetState(#TRACKBAR) MIXER_setVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,curvolume*100+36) EndSelect EndIf Until eventid = #PB_Event_CloseWindow EndIf
Excellent ! le jour ou j'en serait là


Voila KarlKox j'ais voulu faire un test avec ta source mais le probleme c que chez moi, une fois que je clic sur le trackBar le son se coupe et je ne peut pas le gérer. Voici ma Source :
Code : Tout sélectionner
Enumeration
#Window_0
EndEnumeration
Enumeration
#TRACKBAR
EndEnumeration
#MMSYSERR_NOERROR = 0
#MIXER_SHORT_NAME_CHARS = 16
#MIXER_LONG_NAME_CHARS = 64
Structure MIXERCONTROL
cbStruct.l
dwControlID.l
dwControlType.l
fdwControl.l
cMultipleItems.l
szShortName.s[#MIXER_SHORT_NAME_CHARS]
szName.s[#MIXER_LONG_NAME_CHARS]
lMinimum.l
lMaximum.l
reserved.l[10]
EndStructure
Procedure.l MIXER_getVolume(Type.l)
Protected dwVolume.l, result.l, hMixer
Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED
RtlZeroMemory_(ml,SizeOf(MIXERLINE))
RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS))
RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS))
RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED))
result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER)
If result = #MMSYSERR_NOERROR
ml\cbStruct = SizeOf(MIXERLINE)
ml\dwComponentType = Type
result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE)
If result = #MMSYSERR_NOERROR
mlc\cbStruct = SizeOf(MIXERLINECONTROLS)
mlc\dwLineID = ml\dwLineID
mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME
mlc\cControls = 1
mlc\pamxctrl = @mc
mlc\cbmxctrl = SizeOf(MIXERCONTROL)
result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE)
If result = #MMSYSERR_NOERROR
mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS)
mcd\dwControlID = mc\dwControlID;
mcd\paDetails = @mcdu
mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED)
mcd\cChannels = 1
result = mixerGetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE)
If result = #MMSYSERR_NOERROR
dwVolume = mcdu\dwValue
EndIf
EndIf
EndIf
EndIf
ProcedureReturn dwVolume
EndProcedure
; newvolume va de 0 = 65535
Procedure MIXER_setVolume(Type.l, newvolume.l)
Protected ml.MIXERLINE, mlc.MIXERLINECONTROLS,mc.MIXERCONTROL,mcd.MIXERCONTROLDETAILS,mcdu.MIXERCONTROLDETAILS_UNSIGNED
RtlZeroMemory_(ml,SizeOf(MIXERLINE))
RtlZeroMemory_(mlc,SizeOf(MIXERLINECONTROLS))
RtlZeroMemory_(mcd,SizeOf(MIXERCONTROLDETAILS))
RtlZeroMemory_(mcdu,SizeOf(MIXERCONTROLDETAILS_UNSIGNED))
result = mixerOpen_(@hMixer, 0, 0, 0, #MIXER_OBJECTF_HMIXER)
If result = #MMSYSERR_NOERROR
ml\cbStruct = SizeOf(MIXERLINE)
ml\dwComponentType = Type
result = mixerGetLineInfo_(hMixer, @ml, #MIXER_GETLINEINFOF_COMPONENTTYPE)
If result = #MMSYSERR_NOERROR
mlc\cbStruct = SizeOf(MIXERLINECONTROLS)
mlc\dwLineID = ml\dwLineID
mlc\dwControlType = #MIXERCONTROL_CONTROLTYPE_VOLUME
mlc\cControls = 1
mlc\pamxctrl = @mc
mlc\cbmxctrl = SizeOf(MIXERCONTROL)
result = mixerGetLineControls_(hMixer, @mlc, #MIXER_GETLINECONTROLSF_ONEBYTYPE)
If result = #MMSYSERR_NOERROR
mcdu\dwValue = newvolume
mcd\cbStruct = SizeOf(MIXERCONTROLDETAILS)
mcd\dwControlID = mc\dwControlID
mcd\paDetails = @mcdu
mcd\cbDetails = SizeOf(MIXERCONTROLDETAILS_UNSIGNED)
mcd\cChannels = 1
result = mixerSetControlDetails_(hMixer, @mcd, #MIXER_SETCONTROLDETAILSF_VALUE)
If result = #MMSYSERR_NOERROR
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndIf
EndIf
EndIf
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 424, 237, 378, 43, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
TrackBarGadget(#TRACKBAR, 10, 10, 360, 20, 0, 10)
SetGadgetState(#TRACKBAR,MIXER_getVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS)/100)
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
If Event = #PB_Event_Gadget
If GadgetID = #TRACKBAR
curvolume = GetGadgetState(#TRACKBAR)
MIXER_setVolume(#MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,curvolume*100+36)
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
End
salut ,
c'est par ce que ta trackbar fait 10 et pas 655 de long
toi tu a sa
alors que tu devrai avoir ceux-ci
voila pourquoi
.
@++
c'est par ce que ta trackbar fait 10 et pas 655 de long

toi tu a sa
Code : Tout sélectionner
TrackBarGadget(#TRACKBAR, 10, 10, 360, 20, 0, 10)
Code : Tout sélectionner
TrackBarGadget(#TRACKBAR, 10, 10, 360, 20, 0, 655)

@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
GPU : radeon HD6370M, CPU : p6200 2.13Ghz