Accueil > > > TABLE DE MIXAGE DE WIN 9X
TABLE DE MIXAGE DE WIN 9X
Information sur la source
Description
Ce code vas pour présenter une technique qui vous permeteras de faire des programmes capable de remplancer la barre de Windows/ de contrôle le niveau des différentes sources sonores...
Source
- ' Originalité de ce code pas besoins de module pour vous servir de winmm.dll
-
- ' Dans cette exemple vous pouvez mixer comme dans l'utilitaire de Windows (et c'est rapide)
- '
- 'Il vous faut crée 3 TextBox qui afficheront l'état du canale, et un VBscrool et un objet Timer
-
- Private Const HIGHEST_VOLUME_SETTING = 100 '%
- Private Const AUX_MAPPER = -1&
- Private Const MAXPNAMELEN = 32
- Private Const AUXCAPS_CDAUDIO = 1 ' audio from internal CD-ROM drive
- Private Const AUXCAPS_AUXIN = 2 ' audio from auxiliary input jacks
- Private Const AUXCAPS_VOLUME = &H1 ' supports volume control
- Private Const AUXCAPS_LRVOLUME = &H2 ' separate left-right volume control
- Private Const MMSYSERR_NOERROR = 0
- Private Const MMSYSERR_BASE = 0
- Private Const MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2)
-
- Private Type AUXCAPS
- wMid As Integer
- wPid As Integer
- vDriverVersion As Long
- szPname As String * MAXPNAMELEN
- wTechnology As Integer
- dwSupport As Long
- End Type
-
- Private Type VolumeSetting
- LeftVol As Integer
- RightVol As Integer
- End Type
-
- Private Declare Function auxGetNumDevs Lib "winmm.dll" () As Long
- Private Declare Function auxGetDevCaps Lib "winmm.dll" Alias "auxGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As AUXCAPS, ByVal uSize As Long) As Long
- Private Declare Function auxSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
- Private Declare Function auxGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByRef lpdwVolume As VolumeSetting) As Long
- Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
-
- Private Function nSigned(ByVal lUnsignedInt As Long) As Integer
- Dim nReturnVal As Integer ' Return value from Function
- If lUnsignedInt > 65535 Or lUnsignedInt < 0 Then
- MsgBox "Error in conversion from Unsigned to nSigned Integer"
- nSignedInt = 0
- Exit Function
- End If
- If lUnsignedInt > 32767 Then
- nReturnVal = lUnsignedInt - 65536
- Else
- nReturnVal = lUnsignedInt
- End If
- nSigned = nReturnVal
- End Function
-
- Private Function lUnsigned(ByVal nSignedInt As Integer) As Long
- Dim lReturnVal As Long ' Return value from Function
- If nSignedInt < 0 Then
- lReturnVal = nSignedInt + 65536
- Else
- lReturnVal = nSignedInt
- End If
- If lReturnVal > 65535 Or lReturnVal < 0 Then
- MsgBox "Error in conversion from nSigned to Unsigned Integer"
- lReturnVal = 0
- End If
- lUnsigned = lReturnVal
- End Function
-
- Private Function lSetVolume(ByRef lLeftVol As Long, ByRef lRightVol As Long, lDeviceID As Long) As Long
- Dim Volume As VolumeSetting, lBothVolumes As Long
- Volume.LeftVol = nSigned(lLeftVol * 65535 / HIGHEST_VOLUME_SETTING)
- Volume.RightVol = nSigned(lRightVol * 65535 / HIGHEST_VOLUME_SETTING)
- 'copy our Volume-variable to a long
- CopyMemory lBothVolumes, Volume.LeftVol, Len(Volume)
- 'call the SetVolume-function
- lSetVolume = auxSetVolume(lDeviceID, lBothVolumes)
- End Function
-
- Private Sub AfficheEtat()
- Dim Volume As VolumeSetting, Cnt As Long, AC As AUXCAPS
- 'set the output to a persistent graphic
- Me.AutoRedraw = True
- 'loop through all the devices
- 'Cnt = 0 'To auxGetNumDevs - 1 'auxGetNumDevs is zero-based
- 'get the volume
- auxGetVolume Cnt, Volume
- 'get the device capabilities
- auxGetDevCaps Cnt, AC, Len(AC)
- 'print the name on the form
- Text1.Text = "Device #" + Str$(Cnt + 1) + ": " + Left(AC.szPname, InStr(AC.szPname, vbNullChar) - 1)
- 'print the left- and right volume on the form
- Text2.Text = "Left volume:" + Str$(HIGHEST_VOLUME_SETTING * lUnsigned(Volume.LeftVol) / 65535)
- Text3.Text = "Right volume:" + Str$(HIGHEST_VOLUME_SETTING * lUnsigned(Volume.RightVol) / 65535)
- 'set the left- and right-volume to 50%
- 'lSetVolume 50, 50, Cnt
- 'Me.Print "Both volumes now set to 50%"
- 'empty line
- End Sub
-
- Private Sub VScroll1_Change()
- lSetVolume CInt(100 - VScroll1.Value), CInt(100 - VScroll1.Value), 0
- ' Noter que vous pouvez modifier une autre Device{anglais en remplçant 0 par
- ' 0 :: Cd
- ' 1 :: Line-In
- ' 2 :: Microphone
- ' 3 :: Volume principale
- ' 4 :: Fm synthétise
- End Sub
-
- Private Sub Timer1_Timer()
- AfficheEtat
- End Sub
-
- Private Sub Form_Load() 'Taux de rafraichissement ...
- Timer1.Interval = 1000
- End Sub
-
' Originalité de ce code pas besoins de module pour vous servir de winmm.dll
' Dans cette exemple vous pouvez mixer comme dans l'utilitaire de Windows (et c'est rapide)
'
'Il vous faut crée 3 TextBox qui afficheront l'état du canale, et un VBscrool et un objet Timer
Private Const HIGHEST_VOLUME_SETTING = 100 '%
Private Const AUX_MAPPER = -1&
Private Const MAXPNAMELEN = 32
Private Const AUXCAPS_CDAUDIO = 1 ' audio from internal CD-ROM drive
Private Const AUXCAPS_AUXIN = 2 ' audio from auxiliary input jacks
Private Const AUXCAPS_VOLUME = &H1 ' supports volume control
Private Const AUXCAPS_LRVOLUME = &H2 ' separate left-right volume control
Private Const MMSYSERR_NOERROR = 0
Private Const MMSYSERR_BASE = 0
Private Const MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2)
Private Type AUXCAPS
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
wTechnology As Integer
dwSupport As Long
End Type
Private Type VolumeSetting
LeftVol As Integer
RightVol As Integer
End Type
Private Declare Function auxGetNumDevs Lib "winmm.dll" () As Long
Private Declare Function auxGetDevCaps Lib "winmm.dll" Alias "auxGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As AUXCAPS, ByVal uSize As Long) As Long
Private Declare Function auxSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
Private Declare Function auxGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByRef lpdwVolume As VolumeSetting) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Function nSigned(ByVal lUnsignedInt As Long) As Integer
Dim nReturnVal As Integer ' Return value from Function
If lUnsignedInt > 65535 Or lUnsignedInt < 0 Then
MsgBox "Error in conversion from Unsigned to nSigned Integer"
nSignedInt = 0
Exit Function
End If
If lUnsignedInt > 32767 Then
nReturnVal = lUnsignedInt - 65536
Else
nReturnVal = lUnsignedInt
End If
nSigned = nReturnVal
End Function
Private Function lUnsigned(ByVal nSignedInt As Integer) As Long
Dim lReturnVal As Long ' Return value from Function
If nSignedInt < 0 Then
lReturnVal = nSignedInt + 65536
Else
lReturnVal = nSignedInt
End If
If lReturnVal > 65535 Or lReturnVal < 0 Then
MsgBox "Error in conversion from nSigned to Unsigned Integer"
lReturnVal = 0
End If
lUnsigned = lReturnVal
End Function
Private Function lSetVolume(ByRef lLeftVol As Long, ByRef lRightVol As Long, lDeviceID As Long) As Long
Dim Volume As VolumeSetting, lBothVolumes As Long
Volume.LeftVol = nSigned(lLeftVol * 65535 / HIGHEST_VOLUME_SETTING)
Volume.RightVol = nSigned(lRightVol * 65535 / HIGHEST_VOLUME_SETTING)
'copy our Volume-variable to a long
CopyMemory lBothVolumes, Volume.LeftVol, Len(Volume)
'call the SetVolume-function
lSetVolume = auxSetVolume(lDeviceID, lBothVolumes)
End Function
Private Sub AfficheEtat()
Dim Volume As VolumeSetting, Cnt As Long, AC As AUXCAPS
'set the output to a persistent graphic
Me.AutoRedraw = True
'loop through all the devices
'Cnt = 0 'To auxGetNumDevs - 1 'auxGetNumDevs is zero-based
'get the volume
auxGetVolume Cnt, Volume
'get the device capabilities
auxGetDevCaps Cnt, AC, Len(AC)
'print the name on the form
Text1.Text = "Device #" + Str$(Cnt + 1) + ": " + Left(AC.szPname, InStr(AC.szPname, vbNullChar) - 1)
'print the left- and right volume on the form
Text2.Text = "Left volume:" + Str$(HIGHEST_VOLUME_SETTING * lUnsigned(Volume.LeftVol) / 65535)
Text3.Text = "Right volume:" + Str$(HIGHEST_VOLUME_SETTING * lUnsigned(Volume.RightVol) / 65535)
'set the left- and right-volume to 50%
'lSetVolume 50, 50, Cnt
'Me.Print "Both volumes now set to 50%"
'empty line
End Sub
Private Sub VScroll1_Change()
lSetVolume CInt(100 - VScroll1.Value), CInt(100 - VScroll1.Value), 0
' Noter que vous pouvez modifier une autre Device{anglais en remplçant 0 par
' 0 :: Cd
' 1 :: Line-In
' 2 :: Microphone
' 3 :: Volume principale
' 4 :: Fm synthétise
End Sub
Private Sub Timer1_Timer()
AfficheEtat
End Sub
Private Sub Form_Load() 'Taux de rafraichissement ...
Timer1.Interval = 1000
End Sub
Conclusion
Faite attention à tout les commentaires pour comprendre le code ... il y a peut être de petite imprécision.
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
table de mixage multi piste [ par philippe100 ]
Salut,quelq'un peut il m'expliquer ou je peu telecharger une table de mixage pour mp3 Votre texte ICI
Table de mixage; Modulation des volumes par fréquences [ par R2D2 ]
J'aimerais savoir comment je peux réaliser une table de mixage pour pouvoir faire varier les volumes des différentes fréquences...Je suppose qu'il fau
Comment piloter la table de mixage de windows ? [ par remy ]
Je travalle sur un programme qui utilise le contol multimedia pour lireet enregistrer des sons au format Wave. Afin de contrôler le niveau émisainsi q
atteindre un champ d'un etat [ par jeje ]
Je désire enregistrer dans des fichiers séparés certaines lignes d'une table avec une présentation correcte.le seul moyen que j'ai trouvé pour le mome
enregistrement trop long [ par Sandrine ]
J'ai une table XXX qui contient environ 70 observations.Et une autre table YYY vide, avec pour seul champ une clé primaire.Je veux transformer les 70
Changement de table avec ADO [ par Arken ]
Salut ,Voilà mon problème :j'ai créer une base de donnée avec deux tables, et d'origine mon contrôle ADO pointe sur la première table TABLE1, au momen
importer des fichiers ASCII dans une table d'Access97 [ par Virginie ]
Salut, Je souhaite importer automatiquement des fichiers ASCII dans une table ACCESS97. Les fichiers sont séparés par des ";".Je voudrais connaître le
DataReport [ par gg ]
J'ai un datareport basé sur un objet commande construit par une requete SQL parmètrée.Les parametres sont passés par une feuille avec un bouton imprim
Modif d'un ordre dans Access97 [ par Luke ]
J'ai une table contenant 4 champs, dont un nommé Ordre (qui me sert à afficher les données de ma table selon cet ordre précisément). Lorsque par VB6 j
SELECT...INNER JOIN [ par Bendes ]
J'arrive à faire un SELECT INNER JOIN entre deux tables d'une même base de données (Access 2000), mais comment faire ce SELECT sur une table d'une db
|
Derniers Blogs
ASYNC/AWAIT: COMPRENDRE COMMENT CA MARCHEASYNC/AWAIT: COMPRENDRE COMMENT CA MARCHE par fathi
Tout le monde est unanime pour dire que la programmation multi-thread et asynchrone est en train de devenir un sujet incontournable. Beaucoup de choses sont arrivées avec le framework 4 pour le code parallèle (TPL, PLinq,.) et bientôt, on va avoir l...
Cliquez pour lire la suite de l'article par fathi PAS D'INTELLITRACE SUR MON SITE WEB DANS IIS !PAS D'INTELLITRACE SUR MON SITE WEB DANS IIS ! par Etienne Margraff
J'ai récemment eu un problème pour obtenir l'intelliTrace sur un site web dans IIS. Il n'y avait pas de message d'erreur, rien dans le journal d'évènement Windows, et après 3 appels à une voyante, 2 visites chez un marabou, j'ai failli me résign...
Cliquez pour lire la suite de l'article par Etienne Margraff OFFICE 365 - SHAREPOINT ONLINE, QUELQUES LIMITATIONSOFFICE 365 - SHAREPOINT ONLINE, QUELQUES LIMITATIONS par junarnoalg
De nombreuses entreprises font le choix de SharePoint Online, service fourni au travers de l'offre de Microsoft Office 365. S'il est vrai que ce choix apporte un grand nombre d'avantages; rapidité de mise en œuvre, disponibilité, large couvertu...
Cliquez pour lire la suite de l'article par junarnoalg PRéSENTATION DES API REST DE WINDOWS AZURE : LISTER LES COMPTES DE STORAGEPRéSENTATION DES API REST DE WINDOWS AZURE : LISTER LES COMPTES DE STORAGE par richardc
http://www.c2idotnet.com/articles/presentation-des-api-rest-de-windows-azure-lister-les-comptes-de-storage
Désolé pour "toto", mais c2i existait avant blogs.developpeur.org et c'est mon site "officiel" ;-) ...
Cliquez pour lire la suite de l'article par richardc
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|