Find the answer to your Linux question:
Results 1 to 9 of 9
I wrote my own media player a while back. It's basically just a playlist window with informative titlebar and statusbar. It works great. Just recently I added 2 new features ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    363

    2 nice new features for xmms/media players


    I wrote my own media player a while back. It's basically just a playlist window with informative titlebar and statusbar. It works great.

    Just recently I added 2 new features to it that I've never seen in any other media players, and I thought I would share them here.

    Occasionally I want to just hit ENTER on a track, and have it play just that track and stop. For this I used the '1' key. If I hit the '1' key, a 'PLAY_ONE' flag is toggled. If this flag is set, the player will stop after playing just one track without having to mess with the playlist.

    The 2nd (related) feature:

    xmms uses z x c v b for rewind, pause, play, stop, and forward. I do too. What I did was bind the V (SHIFT v) to toggle a STOP flag on the track under the cursor. When the player gets to that track, it stops. This is great if, for example, I want it to play all my Chopin tracks as I drift off to sleep, but don't want it to continue on and play all my Clash, thereby waking my wife up in an annoyed state at 2 in the morning.

    Peace and Cheer.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    Sounds good Miven. Is there any way to try it out?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Guru rokytnji's Avatar
    Join Date
    Jul 2008
    Location
    Desert
    Posts
    4,049
    @ rubberman. We have some xmms .debs on file at Index of /repo/testing/main
    scroll to the bottom of the page and .deb.to rpm I guess for you.
    Linux Registered User # 475019
    Lead,Follow, or get the heck out of the way. I Have a Masters in Raising Hell
    Tech Books
    Free Linux Books
    Newbie Guide
    Courses at Home

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    .deb to .rpm? I'm not familiar with that tool. I assume there source to build as an alternative?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Linux User
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    363
    Quote Originally Posted by Rubberman View Post
    Sounds good Miven. Is there any way to try it out?
    Well, I don't think you want to try my music player. It's very particular to my needs, and some features are only stubs as yet. Some features are quite dangerous too:

    I like to keep my music track filenames just so. Having files called track_04.mp3 really bugs me. And I don't really like standard id3 tags, so I have a file editor feature where you can control these things, and it's quite happy to overwrite existing files, because that's what it's designed to do, so you have to be very careful.

    Another 2 features I use a lot are shuffle and sort. F11 shuffles the entire list randomly, and F12 sorts it alphabetically. In Xmms, you have to hunt and peck through the little menus at the bottom of the playlist to do this. I got tired of that because I use these 2 features so often, I hacked the source code to add the hotkeys.

    I kept finding shortcomings in Xmms, that I finally wrote my own player. It's full of experimental code and I wouldn't release it to unsuspecting victims. It plays with gthreads, signals, has a nifty and simple way of doing remote control, uses a type of function stack that I've never really seen used before to change modes/screens and change back. Basically it's a hacker's dream. My next major feature addition is to implement a good plugin interface so I can easily play more audio codecs.

    It uses ncurses, as it's just basically a list manager, and I wanted it to work nicely without X, so maybe I can play music while I'm doing fsck on the root partition or something

    Has anyone tried getting the mousewheel working with ncurses?

    It basically fails at this. Heres a little hack that gets buttons 4 (up) and button 5 (down) working:
    Code:
    void mouse_init ( void ) {
        ampd.mfd = open("/dev/mouse",O_RDWR|O_NOCTTY|O_SYNC|O_NONBLOCK);
        /* this next line puts the mouse into proper mode for mousewheel */
        write (ampd.mfd, "\363\310\363\144\363\120", 6); /* magic */
        char dummy[100];
        read ( ampd.mfd, &dummy, 100 ); /* clear the garbage */
    }
    guint translate_mouse(unsigned int mouse_long_word)
    {
        guint md = 0;
      switch(mouse_long_word)
        {
        case 0x00000008 :  break ;
        case 0x00000009 :  break ;
        case 0x0000000a :  break ;
        case 0x0000000c :  break ;
        case 0x000fdec8 : md = BUTTON4_CLICKED; break ;
        case 0x0001d6c8 : md = BUTTON5_CLICKED; break ;
        case 0xff000008 : md = BUTTON4_CLICKED; break ;
        case 0xfe000008 : md = BUTTON4_CLICKED; break ;
        case 0x01000008 : md = BUTTON5_CLICKED; break ;
        case 0x02000008 : md = BUTTON5_CLICKED; break ;
        case 0x00000108 :  break ;
        case 0x0000ff18 :  break ;
        case 0x00010008 :  break ;
        case 0x00ff0028 :  break ;
        //default:          fprintf(stderr,"Unknown Event           \n"); break ;
        default: break ;
        }
      return md;
    }
    union port_data
    {
      unsigned int   port_long_word;   /* 1x 32bits */
      unsigned short port_word[2];     /* 2x 16bits */
      unsigned char  port_byte[4];     /* 4x 8bits  */
    };
    union port_data mouse_dat;
    guint read_mouse_raw ( void ) {
          read(ampd.mfd,&mouse_dat.port_byte[0],1);
          read(ampd.mfd,&mouse_dat.port_byte[1],1);
          read(ampd.mfd,&mouse_dat.port_byte[2],1);
          read(ampd.mfd,&mouse_dat.port_byte[3],1);
          return mouse_dat.port_long_word;
    }
    guint read_mouse ( void ) {
        guint md = 0;
        if ( ampd.mfd ) {
            md = read_mouse_raw();
            //fprintf(stderr,"%016X\n", md );
            if ( md ) {
                md = translate_mouse ( md );
                mouse_dat.port_long_word = 0;
            }
        }
        return md;
    }
    Believe it or not, you can read /dev/mouse while ncurses is doing it too. I'm not sure why, but this works.

    When you get KEY_MOUSE from getch(), just call read_mouse() and OR the result to the MEVENT bstate. Now you have your buttons 4 and 5. Your list scrolls nicely up and down with the mousewheel.

    Peace and Cheer.

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,539
    I used to do low-level mouse (and game-controller / joystick A/D) programming back in the "dark ages". In any case, a decent, low-impact audio player is something I'd love to have. I too do a lot of console-level stuff, and it would be nice to have an audio playback tool that would run decently in a console (curses/ncurses) environment.

    Just and FYI - I wrote a "mouse" driver for X-Windows back in the 1980's so I could use my game-port (analog) joystick as a mouse! It actually worked quite well.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Linux User
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    363
    Quote Originally Posted by rokytnji View Post
    @ rubberman. We have some xmms .debs on file at Index of /repo/testing/main
    scroll to the bottom of the page and .deb.to rpm I guess for you.
    You know, I have an old Toshiba Satellite laptop that works fine. It's slow, so right now it's happy with Mandrake 10 and is basically a glorified typewriter. It has all kinds of wacky features that I have yet to test out (IR, BIOS net boot, and stuff). I've been using it to test out lilo/grub/chainloading and a few older Centos distros that it wasn't quite happy with. Maybe I'll have a go at AntiX. It looks kinda cool.

  8. #8
    Linux Guru rokytnji's Avatar
    Join Date
    Jul 2008
    Location
    Desert
    Posts
    4,049
    The reason I threw the link out was because xmms2 has took over and is not the same player as xmms. For cli I use moc

    http://www.linuxforums.org/forum/cof...tml#post914778
    Linux Registered User # 475019
    Lead,Follow, or get the heck out of the way. I Have a Masters in Raising Hell
    Tech Books
    Free Linux Books
    Newbie Guide
    Courses at Home

  9. #9
    Linux User
    Join Date
    Dec 2011
    Location
    Turtle Island West
    Posts
    363
    Quote Originally Posted by Rubberman View Post
    I used to do low-level mouse (and game-controller / joystick A/D) programming back in the "dark ages".
    That's hilarious. Was the screen 40x24 or the *enhanced* 80x25 with the card that used up a slot? Green or orange text?
    In any case, a decent, low-impact audio player is something I'd love to have. I too do a lot of console-level stuff, and it would be nice to have an audio playback tool that would run decently in a console (curses/ncurses) environment.
    I don't know how "low-impact" this thing is. Like I say, it has a lot of experimental code that depends on a lot of peculiarities of an extremely well-hacked 9 year old system. I haven't even tried it on another PC.

    The Makefiles are all hand-rolled. There's no configure script or anything. But I did write a crappy manpage for it It's one of those programs that likes to be called ./amp 2>/dev/pts/242 or whatever so it can spew all kinds of nonsense to another screen.

    I have a couple days off. Maybe I'll see if I can get it to compile and work on a vanilla Mandrake10 box. If so, I'll see about posting it here. The tarball is about 125K, and that includes some well hacked libao/libmad stuff, and some term translation layer stuff because I was going to get fancy and have an SDL interface option.

    Peace and Cheer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •