[SDL] Mix_VolumeMusic doesn't work properly

Jesse David Andrews jdandr2 at uky.edu
Wed Jan 22 12:18:00 PST 2003


Mix_Volume's prototype is:
int Mix_Volume(int channel, int volume)

Even if you do Mix_Volume(-1, MIX_MAX_VOLUME/4); 
the music will still be full volume.

Mix_VolumeChunk's prototype is:
int Mix_VolumeChunk(Mix_Chunk *chunk, int volume) 

and Mix_LoadMUS("filename.wav") returns a Mix_music *, not a Mix_Chunk.

but Mix_music is a structure with pointers to (like Mix_music->wave or Mix_music->mp3, depending on what Mix_music->type is...), that we may be able to use...

But that isn't the point, if it is just a matter of manually going to the root of the data source and setting the volume, why not just set it via the Mix_VolumeMusic command with the code there?

Should it have worked before, and this is just a bug that cropped in?  

Jesse

-----Original Message-----
From: Robert Diel <robert at littlebitlost.com>
To: sdl at libsdl.org
Date: 22 Jan 2003 13:44:14 -0600 
Subject: Re: [SDL] Mix_VolumeMusic doesn't work properly

Have you tried Mix_Volume or Mix_VolumeChunk? 

On Wed, 2003-01-22 at 11:30, Jesse David Andrews wrote:
> What operating system?  I also have .it & .mod files working, but I cannot get the volume to change for .wav (haven't tried MP3).
> 
> I am on linux.
> 
> Jesse
> 
> 
> -----Original Message-----
> From: enzogupi at interfree.it ()
> To: sdl at libsdl.org
> Date: 22 Jan 2003 13:17:32 -0000 
> Subject: [SDL] Mix_VolumeMusic doesn't work properly
> 
> 
> When I try to use Mix_VolumeMusic on mp3 files everithing goes ok.
> When I replace mp3 with a "midi+sample" music file (ex. .it or .xm)
> I obtain no effect.
> 
> You can try by yourself with this small program and the "music.it"
> file included in SDL "aliens" demo.
> 
> Simply type:
>    gcc -c testmusic.c
>    gcc -o testmusic testmusic.o -lSDL -lSDL_mixer -lpthread
> 
> and you'll see that modifing the Mix_VolumeMusic value doesn't
> change the result.
> 
> I don't think it's my fault 'cause it works with mp3 music.
> 
> Thanks,
> Enzo.
> 
> --- file testmusic.c
> 
> #include <SDL/SDL.h>
> #include <SDL/SDL_mixer.h>
> char MusicName [] = "music.it";
> Mix_Music* Music;
> int main()
> {
>   if (SDL_Init (SDL_INIT_AUDIO) >= 0) {
>     if (Mix_OpenAudio (44100,AUDIO_S16,1,8192) >= 0) {
>       Music = Mix_LoadMUS (MusicName);
>       Mix_VolumeMusic (50);
>       if (Music) {
> 	Mix_PlayMusic (Music,0);
> 	while (Mix_PlayingMusic()) SDL_Delay (100);
> 	Mix_FreeMusic (Music);  
>       }
>     }
>   }
>   SDL_Quit();
>   return 0;
> };
> 
> 
> 
> 
> -----------------------------------------------------
> 
> Salve, il messaggio che hai ricevuto
> 蠳tato inviato per mezzo del sistema
> di web mail interfree. Se anche tu vuoi 
> una casella di posta free visita il
> sito http://club.interfree.it
> Ti aspettiamo!
> 
> -----------------------------------------------------
> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 
> 
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl



_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl







More information about the SDL mailing list