vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Zippen wie die Profis!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
Re: Ton aus / Stumm / Mute 
Autor: anve
Datum: 26.08.06 19:11

so hier meine Lösung:

Deklaration:
Dim stumm as Boolean
Form Load:
    ' Abfragen ob Stumm
    With Mixer
        If .Choose(SpeakersOut, Mute) Then
            stumm = IIf(.Value = 0, True, False)
        End If
    End With
Ereignis z.B. Button:
                With Mixer 'set current values
                    If stumm = False Then
                        stumm = True
                    Else
                        stumm = False
                    End If
                    If .Choose(SpeakersOut, Mute) Then
                        .Value = IIf(stumm = False, 100, 0) '100 = true; 0 = 
                        ' false
                    End If
                End With 'MIXER
Klassenmodul:
Option Explicit
 
'Simple Sound Mixer Wrapper Class
'''''''''''''''''''''''''''''''''
'
'How To:
''''''''
'  Choose the Channel and SoundControl; this will return True if the selection 
' was successful.
'  Get or Let the Value; note that ALL values are in %
'  For booleans (like Mute) the value 0 means False and 100 means True
'                                                       (one hundred percent 
' true, so to say).
'
'  Success returns True when the last selection was successful.
'  ChannName returns the selected channel name (eg. Speakers).
'  CrtlName returns the selected SoundControl name (eg. VolumeControl).
'
'Authors note:
''''''''''''''
'  Unfortunately the Mixer interface is rather complicated - maybe written by a 
' musician *g* -
'  so there are quite a few mystic API calls with plenty of params, 
' mixer-constants with
'  ugly names, cryptic structure types, and virtual memory address pointers 
' from one structure
'  to the next  >:-(  *grrrhh!*...
'
'  And Micro$oft's documentation is slim, to put it polite.
'
Private Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId _
  As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As _
  Long) As Long
Private Declare Function mixerGetLineInfo Lib "winmm.dll" Alias _
"mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As _
Long) As Long
Private Declare Function mixerGetLineControls Lib "winmm.dll" Alias _
"mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, _
ByVal fdwControls As Long) As Long
Private Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj _
As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Private Declare Function mixerGetControlDetails Lib "winmm.dll" Alias _
"mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, _
ByVal fdwDetails As Long) As Long
Private Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
 
Private Enum MixerConstants 'this makes them long by default
 
    MMSYSERR_NOERROR = 0
    MIXER_CONTROLDETAILSF_VALUE = 0
    MIXER_GETLINECONTROLSF_ONEBYTYPE = 2
    MIXER_GETLINEINFOF_COMPONENTTYPE = 3
    MIXER_SHORT_NAME_CHARS = 16
    MIXER_LONG_NAME_CHARS = 64
    MAXPNAMELEN = 32
 
    'mixer line constants
    MLC_DST_FIRST = 0
    MLC_SRC_FIRST = &H1000
 
    'Mixer control constants
    MCT_CLASS_FADER = &H50000000
    MCT_UNITS_UNSIGNED = &H30000
    MCT_FADER = MCT_CLASS_FADER Or MCT_UNITS_UNSIGNED
 
    MCT_CLASS_SWITCH = &H20000000
    MCT_UNITS_BOOLEAN = &H10000
    MCT_BOOLEAN = MCT_CLASS_SWITCH Or MCT_UNITS_BOOLEAN
 
End Enum
 
Public Enum Channels
    DigitalOut = MLC_DST_FIRST + 1
    LineOut = MLC_DST_FIRST + 2
    MonitorOut = MLC_DST_FIRST + 3
    SpeakersOut = MLC_DST_FIRST + 4
    HeadphonesOut = MLC_DST_FIRST + 5
    TelephoneOut = MLC_DST_FIRST + 6
    WaveInOut = MLC_DST_FIRST + 7
    VoiceInOut = MLC_DST_FIRST + 8
    DigitalIn = MLC_SRC_FIRST + 1
    LineIn = MLC_SRC_FIRST + 2
    MikrophoneIn = MLC_SRC_FIRST + 3
    SynthesizerIn = MLC_SRC_FIRST + 4
    CompactDiscIn = MLC_SRC_FIRST + 5
    TelephoneIn = MLC_SRC_FIRST + 6
    PCSpeakerIn = MLC_SRC_FIRST + 7
    WaveOutIn = MLC_SRC_FIRST + 8
    AuxiliaryIn = MLC_SRC_FIRST + 9
    AnalogIn = MLC_SRC_FIRST + 10
End Enum
#If False Then
Private DigitalOut, LineOut, MonitorOut, SpeakersOut, HeadphonesOut, _
  TelephoneOut, WaveInOut, VoiceInOut
Private DigitalIn, LineIn, MikrophoneIn, SynthesizerIn, CompactDiscIn, _
TelephoneIn, PCSpeakerIn, WaveOutIn, AuxiliaryIn, AnalogIn
#End If
...
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Ton aus / Stumm / Mute4.012anve16.08.06 21:20
Re: Ton aus / Stumm / Mute3.582anve18.08.06 22:13
Re: Ton aus / Stumm / Mute3.868anve26.08.06 19:11
Re: Ton aus / Stumm / Mute3.759anve26.08.06 19:11
Re: Ton aus / Stumm / Mute3.681anve26.08.06 19:12

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel