Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development


Reply
 
Share Thread Tools Display Modes
Old 10-05-2004, 05:30 PM   #1
Variable Bitrate
 
Join Date: Mar 2004
Location: New Jersey
Posts: 340
Kamakazie2 is on a distinguished road
Volume control question..

Is there any way to make the volume controls for my SB Audigy lock to the main volume controls?

I would like to have my Wave / Optical IN/ and Line In volume match the master volume.

Frodo made a great program that locked Wave to Main called matchvol.exe

The purpose for my request, is while in controling my volume i always have to adjust the Wave and others to fine tune the volume.

I always seem to have the wrong volume. I need to adjust the others so i can have very low background music, or i have to crank up the other volumes when i want to blast it. When i have Wave and Main locked i can achieve this. But it only works on wave
__________________
-Jack
2006 Chrysler 300C AWD
IBM T30 Thinkpad / RoadRunner
XMPCR/GPS/SIRIUS

(RIP) HDRadio project: http://www.mp3car.com/vbulletin/hardware-development/93791-someone-here-has-able-crack-hdradio-car.html
Kamakazie2 is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 10-07-2004, 10:22 AM   #2
FLAC
 
IntellaWorks's Avatar
 
Join Date: Jun 2004
Location: NH
Posts: 1,173
IntellaWorks is on a distinguished road
.

yes, there is a way the only way I can think of though is to just write a wrapper class around windows mixer controls.. I've done this in my car-software... If ya had VB6 I could send you the code and you can re-shape it to how you see fit.
IntellaWorks is offline   Reply With Quote
Old 10-07-2004, 05:45 PM   #3
Variable Bitrate
 
Join Date: Mar 2004
Location: New Jersey
Posts: 340
Kamakazie2 is on a distinguished road
Well unfortunatley, i am only a hardware person. I know a few coders who might be able to help. If you wouldnt mind i would love to get the source. Thanks

-Jack
__________________
-Jack
2006 Chrysler 300C AWD
IBM T30 Thinkpad / RoadRunner
XMPCR/GPS/SIRIUS

(RIP) HDRadio project: http://www.mp3car.com/vbulletin/showthread.php?t=93791
Kamakazie2 is offline   Reply With Quote
Old 10-07-2004, 07:16 PM   #4
FLAC
 
IntellaWorks's Avatar
 
Join Date: Jun 2004
Location: NH
Posts: 1,173
IntellaWorks is on a distinguished road
Const MMSYSERR_NOERROR = 0
Const MAXPNAMELEN = 32
Const MIXER_LONG_NAME_CHARS = 64
Const MIXER_SHORT_NAME_CHARS = 16
Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = &H4
Const MIXERCONTROL_CONTROLTYPE_VOLUME = &H50030001

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 mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
Private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal length As Long)
Private Declare Function GlobalAlloc Lib "Kernel32" (ByVal wFlags As Long, _
ByVal dwBytes As Long) As Long
Private Declare Function GlobalLock Lib "Kernel32" (ByVal hmem As Long) As Long
Private Declare Function GlobalFree Lib "Kernel32" (ByVal hmem As Long) As Long

Private Type MIXERCONTROL
cbStruct As Long
dwControlID As Long
dwControlType As Long
fdwControl As Long
cMultipleItems As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
lMinimum As Long
lMaximum As Long
Reserved(10) As Long
End Type

Private Type MIXERCONTROLDETAILS
cbStruct As Long
dwControlID As Long
cChannels As Long
item As Long
cbDetails As Long
paDetails As Long
End Type

Private Type MIXERCONTROLDETAILS_UNSIGNED
dwValue As Long
End Type

Private Type MIXERLINE
cbStruct As Long
dwDestination As Long
dwSource As Long
dwLineID As Long
fdwLine As Long
dwUser As Long
dwComponentType As Long
cChannels As Long
cConnections As Long
cControls As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
dwType As Long
dwDeviceID As Long
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
End Type

Private Type MIXERLINECONTROLS
cbStruct As Long
dwLineID As Long
dwControl As Long
cControls As Long
cbmxctrl As Long
pamxctrl As Long
End Type

' Set the master volume level.
'
' VolumeLevel is the level value in percentage (0 = min, 100 = max)
' Returns True if successful

Function SetVolume(volumelevel As Long) As Boolean
Dim hmx As Long
Dim uMixerLine As MIXERLINE
Dim uMixerControl As MIXERCONTROL
Dim uMixerLineControls As MIXERLINECONTROLS
Dim uDetails As MIXERCONTROLDETAILS
Dim uUnsigned As MIXERCONTROLDETAILS_UNSIGNED
Dim RetValue As Long
Dim hmem As Long
Dim filepath As String


'Function explanation
'Sets Volume, saves it to network/volume.txt
'its a "global" volume so it effects every program





' VolumeLevel value must be between 0 and 100
If volumelevel < 0 Or volumelevel > 100 Then GoTo error

' Open the mixer
RetValue = mixerOpen(hmx, 0, 0, 0, 0)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Initialize MIXERLINE structure and call mixerGetLineInfo
uMixerLine.cbStruct = Len(uMixerLine)
uMixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
RetValue = mixerGetLineInfo(hmx, uMixerLine, _
MIXER_GETLINEINFOF_COMPONENTTYPE)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Initialize MIXERLINECONTROLS strucure and
' call mixerGetLineControls
uMixerLineControls.cbStruct = Len(uMixerLineControls)
uMixerLineControls.dwLineID = uMixerLine.dwLineID
uMixerLineControls.dwControl = MIXERCONTROL_CONTROLTYPE_VOLUME
uMixerLineControls.cControls = 1
uMixerLineControls.cbmxctrl = Len(uMixerControl)

' Allocate a buffer to receive the properties of the master volume control
' and put his address into uMixerLineControls.pamxctrl
hmem = GlobalAlloc(&H40, Len(uMixerControl))
uMixerLineControls.pamxctrl = GlobalLock(hmem)
uMixerControl.cbStruct = Len(uMixerControl)
RetValue = mixerGetLineControls(hmx, uMixerLineControls, _
MIXER_GETLINECONTROLSF_ONEBYTYPE)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Copy data buffer into the uMixerControl structure
CopyMemory uMixerControl, ByVal uMixerLineControls.pamxctrl, _
Len(uMixerControl)
GlobalFree hmem
hmem = 0

uDetails.item = 0
uDetails.dwControlID = uMixerControl.dwControlID
uDetails.cbStruct = Len(uDetails)
uDetails.cbDetails = Len(uUnsigned)

' Allocate a buffer in which properties for the volume control are set
' and put his address into uDetails.paDetails
hmem = GlobalAlloc(&H40, Len(uUnsigned))
uDetails.paDetails = GlobalLock(hmem)
uDetails.cChannels = 1
uUnsigned.dwValue = CLng((volumelevel * uMixerControl.lMaximum) / 100)
CopyMemory ByVal uDetails.paDetails, uUnsigned, Len(uUnsigned)

' Set new volume level
RetValue = mixerSetControlDetails(hmx, uDetails, _
MIXER_SETCONTROLDETAILSF_VALUE)
GlobalFree hmem
hmem = 0
If RetValue <> MMSYSERR_NOERROR Then GoTo error

mixerClose hmx
' signal success

Open App.Path & "/network/volume.txt" For Output As #1
Write #1, volumelevel
Close #1

'vol_shader = 0 at left = 885
'vol_shader = 100 at 3120
'2235 * (volumelevel / 100) = twips to add to 885

'media_search.vol_shader.Left = CInt((volumelevel / 100) * 2235) + 885
'media_search.vol_shader.Width = 3120 - media_search.vol_shader.Left

'2625
' media_search.img_vol.Width = CInt((volumelevel / 100) * 2235)

SetVolume = True
Exit Function

error:
' An error occurred

' Release resources
If hmx <> 0 Then mixerClose hmx
If hmem Then GlobalFree hmem
' signal failure
SetVolume = False

End Function

Function GetVolume()
Dim volumelevel As Integer


Open App.Path & "/network/volume.txt" For Input As #1
Input #1, volumelevel
Close #1

'media_search.img_vol.Width = CInt((volumelevel / 100) * 2235)
GetVolume = Abs(volumelevel)

End Function
__________________
Progress [I will seriously never be done!]
Via EPIA MII
512MB RAM
OEM GPS (embedded)
nLite WinXP pro on
1GB Extreme III CF card
Carnetix 1260 startup/ DC-DC regulator
Software: Still, re-Writing my existing front end in .Net
IntellaWorks is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EQ sound question + volume dank_Army General Hardware Discussion 6 02-16-2004 01:09 PM
USB Sound Card with ASIO driver and volume control tbdombrosky General Hardware Discussion 0 02-04-2003 12:00 AM
The volume question: MASTER vs. WAVE tbdombrosky Software & Software Development 1 07-19-2002 03:59 AM
remote control button question, any1 know? detz General Hardware Discussion 2 07-16-2002 10:27 PM
hardware volume control ODYSSEY General Hardware Discussion 18 04-20-2001 11:43 AM



All times are GMT -5. The time now is 04:40 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics