begin process at 2012 02 17 10:05:44
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Multimedia

 > 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

Source avec Zip VBFLASH

 Sources de la même categorie

Source avec Zip Source .NET (Dotnet) MON LECTEUR MP3 par kentharold
Source avec Zip Source avec une capture LECTEUR MULTIMÉDIA par lartiguef
Source avec Zip Source avec une capture RENOMMER SOUS-TITRES par memejoueur
Source .NET (Dotnet) "PARLEUR" EN VB 2010 par clementgeek41
Source avec Zip Source avec une capture CHANGER LE VOLUME SYSTÉME SANS ACTIVEX par kayoub5

 Sources en rapport avec celle ci

Source avec Zip Source avec une capture Source .NET (Dotnet) CREER CONNECTER ET REMPLIR UNE BASE SQLCE par Le Pivert
Source avec Zip Source avec une capture Source .NET (Dotnet) OUVRIR BASE ACCESS PAR CLIC DROIT par Le Pivert
Source avec Zip Source avec une capture TABLE DE MIXAGE COMME VIRTUAL DJ EN MIEUX par cednoir
Source avec Zip RÉCUPÉRER L'INDEX D'UNE ADRESSE IP LOCALE À PARTIR DE L'ADRE... par Philippe734
EXPORT AUTOMATISÉ DONNÉES TABLE OU REQUÊTE ACCESS DANS UN CL... par houtas

Commentaires et avis

Commentaire de vbsirob le 06/06/2003 13:16:34

ça marche pas, mais ça pourrait, sous directX je sais qu'il y a moyen...  mais quelles sont les commandes ?????

(moi aussi ça fait depuis longtemps que je veux une table de mixage)

Commentaire de logisim le 10/09/2003 14:41:54

Il y a une table de mixage complète sur PSC :

http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=42946&lngWId=1

 Ajouter un commentaire


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


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,560 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales