Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 22-01-2004
aram2r aram2r is offline
Miembro
 
Registrado: ene 2004
Posts: 81
Poder: 21
aram2r Va por buen camino
volumen en windows

Hi people, necesito ayuda y novia, como puedo controlar el volumen de mi pc desde Delphi???? Os agradeceria cualquier informacion gracias.... a si si es por lo segundo dejame tu mail
Responder Con Cita
  #2  
Antiguo 22-01-2004
__cadetill __cadetill is offline
Miembro
 
Registrado: may 2003
Posts: 3.387
Poder: 24
__cadetill Va por buen camino
Cita:
Empezado por aram2r
...necesito ayuda y novia
Bueno, creo que eso la necesitamos más de uno

Referente a la pregunta, quizas este enlace pueda servirte

http://msdn.microsoft.com/archive/de...umecontrol.asp
Responder Con Cita
  #3  
Antiguo 23-01-2004
aram2r aram2r is offline
Miembro
 
Registrado: ene 2004
Posts: 81
Poder: 21
aram2r Va por buen camino
Thumbs up

gracias cadetill....pero no habria otra forma un poco mas sencilla de subir y bajar el volumen de la musica en mi pc?????? esq tienes q reconocer q es un pokiko complicao......ah a ver si me puedes exar una mano con lo q te he puesto en la seccion de internet...y mu wapo tu teeeesssssssssssooorroooooooooo....
Responder Con Cita
  #4  
Antiguo 23-01-2004
__cadetill __cadetill is offline
Miembro
 
Registrado: may 2003
Posts: 3.387
Poder: 24
__cadetill Va por buen camino
Cita:
Empezado por aram2r
gracias cadetill....pero no habria otra forma un poco mas sencilla de subir y bajar el volumen de la musica en mi pc??????
Pues no te sabría decir. Delphi no creo que traiga nada en plan "rápido" y lo que encontré buscando por el MSDN fué eso. No se si habrá algún API que te lo permita de forma más rápida

Cita:
Empezado por aram2r
y mu wapo tu teeeesssssssssssooorroooooooooo....
Gracias
Responder Con Cita
  #5  
Antiguo 23-01-2004
albertron albertron is offline
Miembro
 
Registrado: dic 2003
Posts: 16
Poder: 0
albertron Va por buen camino
Hola Aram2r,

respondo por lo primero

Un trozo de código que he encontrado por ahí, espero que te sirva,

Código:
uses MMSystem;

type
   TVolumeRec = record
     case Integer of
       0: (LongVolume: Longint) ;
       1: (LeftVolume, RightVolume : Word) ;
     end;

const DeviceIndex=5
       {0:Wave
        1:MIDI
        2:CDAudio
        3:Line-In
        4:Microphone
        5:Master
        6:PC-loudspeaker}
     
procedure SetVolume(aVolume:Byte) ;
var Vol: TVolumeRec;
begin
   Vol.LeftVolume := aVolume shl 8;
   Vol.RightVolume:= Vol.LeftVolume;
   auxSetVolume(UINT(DeviceIndex), Vol.LongVolume) ;
end;

function GetVolume:Cardinal;
var Vol: TVolumeRec;
begin
   AuxGetVolume(UINT(DeviceIndex),@Vol.LongVolume) ;
   Result:=(Vol.LeftVolume + Vol.RightVolume) shr 9;
end;
Un saludo.
Responder Con Cita
  #6  
Antiguo 28-01-2004
CHiCoLiTa CHiCoLiTa is offline
Miembro
 
Registrado: may 2003
Posts: 102
Poder: 21
CHiCoLiTa Va por buen camino
Yo uso esto para modificar el sonido, la idea es parecida a la respuesta anterior, pero mediante otro metodo

Por cierto, si quieres menos complicacion a la hora de usar estas funciones, sobre todo para las modificaciones, por si usas un TrackBar con esta llamada te evitas todo el rollo.

Es simplemente llamar a control de volumen de windows

WinExec('SNDVOL32.EXE',SW_SHOWNORMAL);

Código:
uses MMSystem;

type
   TVolumeRec = record
     case Integer of
       0: (LongVolume: Longint) ;
       1: (LeftVolume, RightVolume : Word) ;
     end;

{ Funcion para modificar el sonido }
function SetWaveVolume(const AVolume: DWORD): Boolean;
var
  WaveOutCaps: TWAVEOUTCAPS;
begin
  Result := False;
  if WaveOutGetDevCaps(WAVE_MAPPER, @WaveOutCaps, SizeOf(WaveOutCaps)) = MMSYSERR_NOERROR then
    if WaveOutCaps.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
      Result := WaveOutSetVolume(-1, AVolume) = MMSYSERR_NOERROR;
end;

{ Funcion para ver que sonido tiene puesto }
function GetWaveVolume(var LVol: DWORD; var RVol: DWORD): Boolean;
var
  WaveOutCaps: TWAVEOUTCAPS;
  Volume: DWORD;
begin
  Result := False;
  if WaveOutGetDevCaps(WAVE_MAPPER, @WaveOutCaps, SizeOf
    if WaveOutCaps.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
    begin
      Result := WaveOutGetVolume(-1, @Volume) = MMSYSERR_NOERROR;
      //Result := WaveOutGetVolume(WAVE_MAPPER, @Volume) = MMSYSERR_NOERROR;
      LVol   := LoWord(Volume);
      RVol   := HiWord(Volume);
    end;
end;
Responder Con Cita
  #7  
Antiguo 28-01-2004
aram2r aram2r is offline
Miembro
 
Registrado: ene 2004
Posts: 81
Poder: 21
aram2r Va por buen camino
Talking

Bueno mi gran dilema solucionado , gracias a todos los q me habeis ayudado......bueno ahora vamos a por lo segundo....Quien me ayuda?
Responder Con Cita
  #8  
Antiguo 28-01-2004
Avatar de Nuria
Nuria Nuria is offline
Miembro
 
Registrado: may 2003
Posts: 531
Poder: 21
Nuria Va por buen camino
Código:
vamos a por lo segundo....Quien me ayuda?
Pon un anuncio en el periódico, , igual tienes suerte .....


Saludos!
Responder Con Cita
  #9  
Antiguo 12-05-2006
metalfox6383 metalfox6383 is offline
Miembro
 
Registrado: jul 2005
Posts: 97
Poder: 19
metalfox6383 Va por buen camino
Algunas aplicaciones pueden subir y bajar el volúmen para sólo los archivos de sonido de esa reproduce, y no para todas. ¿Cómo se puede hacer eso?
Responder Con Cita
  #10  
Antiguo 06-06-2006
jorgito.crazy jorgito.crazy is offline
Miembro
 
Registrado: may 2006
Posts: 54
Poder: 18
jorgito.crazy Va por buen camino
hola

Cita:
Empezado por albertron
Hola Aram2r,

respondo por lo primero

Un trozo de código que he encontrado por ahí, espero que te sirva,

Código:
uses MMSystem;
 
type
   TVolumeRec = record
     case Integer of
       0: (LongVolume: Longint) ;
       1: (LeftVolume, RightVolume : Word) ;
     end;
 
const DeviceIndex=5
       {0:Wave
        1:MIDI
        2:CDAudio
        3:Line-In
        4:Microphone
        5:Master
        6:PC-loudspeaker}
 
procedure SetVolume(aVolume:Byte) ;
var Vol: TVolumeRec;
begin
   Vol.LeftVolume := aVolume shl 8;
   Vol.RightVolume:= Vol.LeftVolume;
   auxSetVolume(UINT(DeviceIndex), Vol.LongVolume) ;
end;
 
function GetVolume:Cardinal;
var Vol: TVolumeRec;
begin
   AuxGetVolume(UINT(DeviceIndex),@Vol.LongVolume) ;
   Result:=(Vol.LeftVolume + Vol.RightVolume) shr 9;
end;
Un saludo.
Esto esta muy bien pero hay que cambiar:
const DeviceIndex=5 a: const DeviceIndex=3
y esto seria para el auxiliar.
Como Pudiera poner El volumen Master y dejar const DeviceIndex=5
Responder Con Cita
  #11  
Antiguo 16-01-2007
SataSoft SataSoft is offline
Registrado
 
Registrado: ene 2007
Ubicación: ConCon
Posts: 6
Poder: 0
SataSoft Va por buen camino
Exclamation Reproductor de audio y Video xD!!

Amigos ayuda porfa
hice un reproductor de Audio y video, en Delphi 7, que objeto de solapa o ficha utilizo?
q evento activo o donde inserto el codigo q ahan enviado algunos
Gracias.
les dejo mi codigo:
*****************************************
al insertar el codigo q han enviado no me da errores, q onda?
*****************************************
Código Delphi [-]
var
  F_mp3: TF_mp3;

implementation

uses Unit2, MMSystem;
 type
  TVolumeRec = record
     case Integer of
       0: (LongVolume: Longint) ;
       1: (LeftVolume, RightVolume : Word) ;
     end;
const DeviceIndex=5
       {0:Wave
        1:MIDI
        2:CDAudio
        3:Line-In
        4:Microphone
        5:Master
        6:PC-loudspeaker};

procedure SetVolume(aVolume:Byte) ;
var Vol: TVolumeRec;
begin
   Vol.LeftVolume := aVolume shl 8;
   Vol.RightVolume:= Vol.LeftVolume;
   auxSetVolume(UINT(DeviceIndex), Vol.LongVolume) ;
end;

function GetVolume:Cardinal;
var Vol: TVolumeRec;
begin
   AuxGetVolume(UINT(DeviceIndex),@Vol.LongVolume) ;
   Result:=(Vol.LeftVolume + Vol.RightVolume) shr 9;
end;
        {$R *.dfm}



procedure TF_mp3.ToolButton3Click(Sender: TObject);
begin
Pagecontrol1.ActivePageIndex := 0;
end;

procedure TF_mp3.ToolButton5Click(Sender: TObject);
begin
        PageControl1.ActivePageIndex := 1;
end;

procedure TF_mp3.ToolButton1Click(Sender: TObject);
begin
        Application.Terminate;
end;

procedure TF_mp3.BitBtn1Click(Sender: TObject);
begin
    if Opendialog1.Execute = true Then
       MediaPlayer1.FileName := Opendialog1.FileName;
       MediaPlayer1.Open;
       MediaPlayer1.DisplayRect :=rect(0,0,OleContainer1.Width,OleContainer1.Height);
       MEdiaPlayer1.Play;
      StatusBar1.SimpleText := 'Repoduciendo Archivo: ' + OpenDialog1.FileName;
      Label3.Visible := True;
      Label4.Visible := True;

  end;



procedure TF_mp3.Timer1Timer(Sender: TObject);
var 
  posicion, duracion : LongInt;
begin
  if StatusBar1.SimpleText <> 'Inactivo' then
    begin
      with MediaPlayer1 do
        begin
          MediaPlayer1.TimeFormat := tfMilliseconds;
          duracion := Round(Length div 1000);
          scrollBar1.Max := length;
          Label3.Caption := Format('%d:%d',[duracion div 60, duracion Mod 60]);
          posicion := round(Position div 1000);
          Label4.Caption := Format('%d:%d',[posicion div 60, posicion Mod 60]);
          ScrollBar1.Position := position; //minuto * 60 + segundo;
        end;
    end;
end;



procedure TF_mp3.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (HiWord(GetKeyState(VK_MENU)) <> 0) and (Key = 13) then
    begin
      if F_mp3.WindowState = WsNormal then
        begin
         Width := F_mp3.Width;
         Height:= F_mp3.Height;
         Label1.Visible := False;
         Label2.Visible := False;
         Label3.Visible := False;
         Label4.Visible := False;
         MediaPlayer1.Visible := False;
         BitBtn1.Visible := False;
         StatusBar1.Visible := False;
         ScrollBar1.Visible := False;
         OleContainer1.Visible := False;
         F_mp3.BorderStyle := BsNone;
         F_mp3.WindowState := WsMaximized;
         MediaPlayer1.Display := F_mp3;
         MediaPlayer1.DisplayRect := rect(0,0,F_mp3.Clientwidth,F_mp3.ClientHeight);
       end
    else
     begin
       F_mp3.WindowState := WsNormal;
       F_mp3.Width := Width;
       F_mp3.Height := Height;
       F_mp3.Position := PoScreenCenter;
       Label1.Visible := True;
       Label2.Visible := True;
       Label3.Visible := True;
       Label4.Visible := True;
       MediaPlayer1.Visible := True;
       BitBtn1.Visible := True;
       StatusBar1.Visible := True;
       ScrollBar1.Visible := True;
       OleContainer1.Visible := True;
       F_mp3.BorderStyle := BsSingle;
       MediaPlayer1.Display := OleContainer1;
       MediaPlayer1.DisplayRect := rect(0,0,F_mp3.Clientwidth,F_mp3.ClientHeight);
     end;
   end;


end;

procedure TF_mp3.FormPaint(Sender: TObject);

var
   i: Integer;

   procedure MakeShadow(control: TControl; Width: Integer; Color: TColor);
   var
        rect: TRect;
        old: TColor;
   begin

     rect := control.boundsrect;
     rect.Left := rect.Left + width;
     rect.Top := rect.Top + width;
     rect.Right := rect.Right + width;
     rect.Bottom := rect.Bottom + width;
old := Self.canvas.brush.color;
     
Self.canvas.brush.Color := color;
     Self.canvas.fillrect(rect);
     Self.canvas.brush.Color := old;
   end;

 begin

for i:=0 to Self.ControlCount-1 do
    if self.Controls[i].Visible then
     MakeShadow(Self.Controls[i],2,clGray);

 end;


procedure TF_mp3.BitBtn2Click(Sender: TObject);
begin
  Form2.ShowModal;
end;
end.

Última edición por vtdeleon fecha: 18-01-2007 a las 20:44:33.
Responder Con Cita
  #12  
Antiguo 17-01-2007
Avatar de Ñuño Martínez
Ñuño Martínez Ñuño Martínez is offline
Moderador
 
Registrado: jul 2006
Ubicación: Ciudad Catedral, Españistán
Posts: 6.000
Poder: 25
Ñuño Martínez Tiene un aura espectacularÑuño Martínez Tiene un aura espectacular
Amigo mio, creo que deberías leerte esto, y esto también.
__________________
Proyectos actuales --> Allegro 5 Pascal ¡y Delphi!|MinGRo Game Engine
Responder Con Cita
  #13  
Antiguo 17-01-2007
SataSoft SataSoft is offline
Registrado
 
Registrado: ene 2007
Ubicación: ConCon
Posts: 6
Poder: 0
SataSoft Va por buen camino
Sr. ÑoÑo

viendolo del lado del programnador eres un 0 a la izquierda, solo pedia un poko de ayuda, sobre delphi, no de como escribir un mensaje o como hacer una pregunta.
gracias de todos modos
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 15:18:17.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi