Code:int fd, v = 30; // where v = 0..100 fd = open("/dev/mixer", O_RDONLY); ioctl(fd, SOUND_MIXER_WRITE_VOLUME, &v); ioctl(fd, SOUND_MIXER_READ_OGAIN, &v); printf("VOLUME = %d\n", v);
open /dev/mixer ok, then --->
ioctl(mix_fd, SOUND_MIXER_READ_DEVMASK, &devs)
got -1 in a1200, am i miss something ?
code seg like these :
always give me the result :Code:char *mix_dev = "/dev/mixer"; int mix_fd = -1; if((mix_fd = open(mix_dev, O_RDWR)) <0) die("open"); if(ioctl(mix_fd, SOUND_MIXER_READ_DEVMASK, &devs)==-1) die("SOUND_MIXER_READ_DEVMASK"); if(ioctl(mix_fd, SOUND_MIXER_READ_RECMASK, &recable)==-1) die("SOUND_MIXER_READ_RECMASK"); if(ioctl(mix_fd, MIXER_READ(SOUND_MIXER_OUTMASK), &outable)==-1) /* This is not supported on all devices apparently, so it is not an error if this fails. */ outable = -1; if(ioctl(mix_fd, SOUND_MIXER_READ_STEREODEVS, &stereo)==-1) die("SOUND_MIXER_READ_STEREODEVS"); if(ioctl(mix_fd, SOUND_MIXER_READ_CAPS, &caps)==-1) die("SOUND_MIXER_READ_CAPS");
SOUND_MIXER_READ_DEVMASK: Invalid argument
use /dev/dsp(stereo) and /dev/dsp16(mono) play sound succefully,
but change volume seems not work.
any body can help me about that ?
great thanks
Code:int fd, v = 30; // where v = 0..100 fd = open("/dev/mixer", O_RDONLY); ioctl(fd, SOUND_MIXER_WRITE_VOLUME, &v); ioctl(fd, SOUND_MIXER_READ_OGAIN, &v); printf("VOLUME = %d\n", v);
eXMMS and Rockbox running on E680, E680i, E680g, A780, A1200 and ROKR E6
hi, blackhawk, i have test your method on a1200 hw, cheers!!
it works perfectly. the mixer control problem solved now.
one step further to my goal.
great thanks, blackhawk.
Your welcome. If you have enough time to develop something, can you try to make rockbox directly access to framebuffer /dev/fb0 and make a qwidget as background and catch button event? Yea, sound like mplayer from bragon. This methode will speed up rockbox compare to sdl simulator. The next big work is make a new rockbox setup for ezx platform.
eXMMS and Rockbox running on E680, E680i, E680g, A780, A1200 and ROKR E6
hoho,blackhawk, i am glade to do that!
i'v tried the following method to get touch screen event,
it really works.i plan to program in a1200 with this
touch screen control, and frame buffer+/dev/dsp or /dev/dsp16
to make regular applications work.
i have successfully make a1200 18bpp frame buffer work, andCode:#include <stdio> #include <ZApplication> #include <ZMainWidget> #include <unistd> class MyApplication:public QApplication{ //Q_OBJECT, not using this macro, derive directly // i can't explain why this could work, but it does. // also we need to comment some str related functions // in QApplication header file. public: MyApplication(int argc,char **argv):QApplication(argc,argv) {} virtual ~MyApplication() {} virtual bool qwsEventFilter( QWSEvent * event) { QApplication::qwsEventFilter(event); QWSMouseEvent * mouse = NULL; QWSFocusEvent * focus = NULL ; int x,y,z; if(!event) return false; switch(event->type){ case QWSEvent::NoEvent: //printf("no event\n"); break; case QWSEvent::Connected: //printf("connected\n"); break; case QWSEvent::Mouse: mouse = event->asMouse(); if(mouse==0) return false; x=mouse->simpleData.x_root; y=mouse->simpleData.y_root; z=mouse->simpleData.state; printf("mouse: x=%d,y=%d,state=%d\n",x,y,z); break; case QWSEvent::Focus: focus=(QWSFocusEvent *)event; printf("focus %d\n",focus->simpleData.get_focus); break; case QWSEvent::Key: //printf("key\n"); break; } return false ; } }; int main (int argc, char** argv) { MyApplication app (argc, argv); QWidget* w = new QWidget ; app.setMainWidget ((QWidget *)w); w->showFullScreen(); return app.exec(); }
written a chinese 12x12, 16x16 display lib, could display chinese in gb2312, unicode, utf-8 with 8x16 ascii code support.
last weekend,
i try to port libmad and madplay into a1200, many warnnings
and errors need deal, the mixer problem solved here,
thank you again blackhawk.
now i am porting cximage lib on to a1200, to make picture display easily.
hi, I was on a business trip for a month, I´m back but I´m afraid I got more projects then I can handle now (some of then needs development - which I do myself).
And I will not be able to work on ming projects for a month or more.
Anyway, if you are still interested, here is the source, project, headers, and binaries for the libmad for A1200.
This will work on ming and other motorola linux devices.
(I did not change the original libmad source code - so you will be able to use new versions of it)
@blackhawk
I also use the GAIN control.....
But I don't allow the gain pass 90 (I think it is dangerous - I was thinking in limit it to 80).
@serverclient2004
I can see that you already display images but I if you think it can help...I also have LIBPNG.
Ah, and sorry to be late here and could not help in the color 24->18bpp quest.....I've already walked through this path two months ago. I think you needed a little less time to solve it then me.
hoho, glade to c u again CLOVIS KKK,
me too, have successfully port libmad, just like you the version is 0.15, also try to make the command line front madplay work. i use arm-linux-g++ not arm-linux-gcc for further gui develop. change some uncompatible
codes in madplay.
about the image lib i use the other choice --> cximage, now it can display
png, gif, jpeg, bmp, tif...many image formats. it is lit weighted and written in pure c++. i managed to make it work in a1200.
it also give some rotate, scale, mirror, fft and some common use graphic algorithms.
now, i have gotten the author's permit to port it to a1200 for freely use.
i'll cleanup the codes (for i have so many lines of codes for test) and
release the source in some days latter.
caller codes are quite simple:
Code:#include <stdio> #include <stdlib> #include <string> #include "ezfb.h" // framebuffer port for a1200 #include "M5ImgDec.h" // cximage wrapper to make it more easy to use // and fix some gif frame display bugs struct ezfb fb = {0} ; int main(int argc, char * argv[]) { CM5ImgDec m5dec ; // declare the cximage object u_short * img = NULL ; ezfb_init(&fb) ; ezfb_clear(&fb) ; img = new u_short [fb.Var.xres * fb.Var.yres] ; if(img == NULL) { printf("no memory !\n"); ezfb_release(&fb) ; exit(1) ; } m5dec.Decode("a.png") ; // direct pass the file name // support png, jpg, bmp, tif, gif ...many more // get the decoded data into 16bpp format array. m5dec.GetFrame((u_char *)(img), IMG_MOD_16BPP, 0) ; // use framebuffer to display the image, here the image is 240x320 // so put it to screen directly ezfb_put_screen(&fb, (u_char *)(img), MODE_BPP16) ; sleep(20) ; ezfb_release(&fb) ; delete [] img ; return 0 ; }
hi, i found that when i play mono, 8khz, pcm16 data in /dev/dsp16 device file, the upper method :
ioctl(fd, SOUND_MIXER_WRITE_VOLUME, &v);
couldn't effect the volume, the method could only work for the /dev/dsp stereo play mode.
any other method to adjust the /dev/dsp16 volume ?
great thanks.
init codes looks like this, am i misse something ? or some thing is not right ?
Code:int format ; m_dev_handle = open("/dev/dsp16", O_WRONLY) ; if(!m_dev_handle) return false ; // config the sound device format = AFMT_S16_NE ; // signed 16 bit pcm if(ioctl(m_dev_handle, SNDCTL_DSP_SETFMT, &format) < 0) printf("AFMT_S16_NE failed\n") ; format = 16 ; // 16 bit pcm binary data if(ioctl(m_dev_handle, SOUND_PCM_WRITE_BITS, &format) < 0) printf("16 bit pcm failed\n") ; format = 1 ; // mono 1 channel if(ioctl(m_dev_handle, SNDCTL_DSP_STEREO, &format) < 0) printf("channel set failed\n") ; format = 8000 ; if(ioctl(m_dev_handle, SNDCTL_DSP_SPEED, &format) < 0) printf("sample rate failed\n") ;