Re: GNUstep GUI design

"Yen-Ju Chen" <[email protected]> Mon, 07 Oct 2002 11:41:48 -0400
Newsgroups gmane.comp.lib.gnustep.applications
Message-ID <[email protected]>
  Try to reply something I can answer:

  1. MusicBox is a music manager, not only a player.
     So it is more like iTune than QuickTime player.
     For me, I would like to treat the audio CD as another file system.
     User can simply drag-and-drop the music from CD into other playlist  
and vice versa.
     So when user drag a song from CD into another playlist, it is 
encoding/ripping,
     and when user drop a song into CD, it is buring.
     In reality, buring needs more time and needs more care.
     But encoding/ripping is much simple (still takes some time).
     For the ideal situation, user should be able to
     drag-and-drop any song into any playlist,
     no matter what kind of media (real file system, CD, mp3 player) it is.
     That's what I thought.

  2. The encoder in MusicBox is optional.
     If you don't install any encoder bundles,
     then you get a MusicBox without encoders.
     Right now, I need an encoder so that I could produce some test samples 
for other function.
     So the encoder bundles will be keeped for a while.
     And I use external tools (cdda2wav and oggenc) for encoding.
     If you haven't install them, you get no encoding, too.
     MusicBox still compile without these external tools.
     They are only optional in MusicBox,
     so do other kinds of playlist.
     Install what you like.

  3. I'll definitely support Encod once it has service
     or it offers an encoder bundle.
     There is no reason I won't do that.
     Encod will be a better choice for people
     who need more advanced encoding function.
     But it is not a reason to prevent MusicBox from
     having a very simple one.

  4. Here is the interface I used (for now) for encoder:

#import <AppKit/AppKit.h>

#define EncoderPreferenceViewFrame NSMakeRect(0, 0, 300, 200)

@class SongInfo;

@protocol EncoderModule <NSObject>

+ (NSView *) preferenceView;

+ (NSString *) encoderName;

- (id) initWithOwner: (id) owner;

/* This is the SongInfo for encoding.
* Encoder should write the song/artist/album
* into the audio file if possible.
* The final audio file should be placed at filename.
* The directories to the filename will be set up
* by the MusicBox. Therefore, encoders don't need
* to set up the directories by themselves.
* But it's no harm to check that again.
* Encoder can modify this SongInfo if necessary.
* The track give the encoder which track to encoder
*/
- (void) setSongInfo: (SongInfo *) info;
- (SongInfo *) songInfo;

/* Return from 0-100 */
- (int) progress;
- (void) launch;
- (void) interrupt;

@end

@interface NSObject (MusicBoxEncoder)

- (void) encoder: (id <EncoderModule>) encoder didFinishEncoding: (BOOL) 
bool;

@end

@protocol EncoderModuleView <NSObject>

- (void) loadSettings;
- (void) saveSettings;

@end

The EncoderModuleView is a NSBox to put into the preferences.
So the real methods related to encoding are only these:
- (void) setSongInfo: (SongInfo *) info;
- (SongInfo *) songInfo;
- (int) progress;
- (void) launch;
- (void) interrupt;

and a delegate method:
- (void) encoder: (id <EncoderModule>) encoder didFinishEncoding: 
(BOOL)bool;

You can launch the encoding, and interrupt it (if needed).
It will notify once it is done. Call progress to know the percentage.
It is designed to encode only one track each time.
So MusicBox will use encoder several times for several tracks.
This interface is very simliar to NSSound.
Instead you play/stop a sound, you launch/interrupt an encoding.

And for SongInfo, which is simply a class to store the information of a 
song:
#import <AppKit/AppKit.h>

@class SGSound;

@interface SongInfo : NSObject <NSCoding>
{
  BOOL     checked;
  NSMutableDictionary *info;
  /* The keys and classes are:
     song, NSString
     status, NSString
     artist, NSString
     album, NSString
     track, NSNumber
     sound, SGSound
     filename, NSString
     duration, NSNumber, in seconds
   */
}

/**
* A SGSound may not always associate with SongInfo.
* loadSound a song before playing to save the memory
*/
- (void) loadSound;
- (void) updateDuration;

- (NSString *) description;

// Access method
- (void) setSong: (NSString *) song;
- (NSString *) song;
- (void) setStatus: (id) status;
- (id) status;
- (void) setArtist: (NSString *) artist;
- (NSString *) artist;
- (void) setAlbum: (NSString *) album;
- (NSString *) album;
- (void) setTrack: (NSNumber *) number;
- (NSNumber *) track;
- (void) setChecked: (BOOL) bool;
- (BOOL) checked;
- (void) setSound: (NSSound *) sound;
- (NSSound *) sound;
- (void) setFilename: (NSString *) filename;
- (NSString *) filename;
- (void) setDuration: (NSNumber *) duration;
- (NSNumber *) duration;
- (NSNumber *) size /* file size */;

@end

Since audio CD has no filename,
it is used to tell encoder where the encoded file should be placed.

Yen-Ju

>From: Andreas Heppel <[email protected]>
>Reply-To: [email protected]
>To: [email protected]
>CC: Yen-Ju Chen <[email protected]>
>Subject: Re: GNUstep GUI design
>Date: Mon, 07 Oct 2002 10:00:01 +0200
>
>On 2002-10-04 13:54:03 -0400 Yen-Ju Chen <[email protected]> wrote:

  [snip]

>
> > I already has an interface for encoder bundles in MusicBox,
> > but it is designed for external command line tools.
> > Maybe both of you will have a better idea.
>Well, if you post us a header file with the definition of this interface, 
>we will see how far it differs from what we have in mind. Maybe you have 
>the better idea. At least I think we may profit in the one or another way. 
>I know I could dig through MusicBox's sources for this stuff, but it will 
>be faster if you create an excerpt (maybe some documentatio?) and post it.
>
>Cheers,
>Andreas
>
>
>--
>Andreas Heppel
>
>Mail: mailto:aheppel at web dot de
>Home: http://www.andreasheppel.de
>GSburn.app: http://gsburn.sourceforge.net




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com



_______________________________________________
Apps-gnustep mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/apps-gnustep