//JumpTrack currently aborts the current track. However, it doesn't clear the
//data-structures as StopTrack does.  this allows for rewind even after the
//track has finished playing
//Question:  Should 'abort' call StopTrack?
void
JumpTrack (void)
{
    if (!sound_sample)
        return; // nothing to skip

    LockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
    seek_track (tracks_length + 1);
    UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
}
void
FastForward_Smooth (void)
{
    sint32 offset;

    if (!sound_sample)
        return; // nothing is playing, so.. bye!

    LockMutex (soundSource[SPEECH_SOURCE].stream_mutex);

    offset = get_current_track_pos ();
    offset += ACCEL_SCROLL_SPEED;
    seek_track (offset);

    UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
}
void
FastReverse_Smooth (void)
{
    sint32 offset;

    if (!sound_sample)
        return; // nothing is playing, so.. bye!

    LockMutex (soundSource[SPEECH_SOURCE].stream_mutex);

    offset = get_current_track_pos ();
    offset -= ACCEL_SCROLL_SPEED;
    seek_track (offset);

    // Restart the stream in case it ended previously
    if (!PlayingStream (SPEECH_SOURCE))
        PlayStream (sound_sample, SPEECH_SOURCE, false, true, false);
    UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
}
void
FastForward_Page (void)
{
    TFB_SoundChunk *next;

    if (!sound_sample)
        return; // nothing is playing, so.. bye!

    LockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
    next = find_next_page (cur_sub_chunk);
    if (next)
    {   // Set the chunk to be played
        cur_chunk = next;
        cur_sub_chunk = next;
        // Decoder will be set in OnStreamStart()
        PlayStream (sound_sample, SPEECH_SOURCE, false, true, true);
    }
    else
    {   // End of the tracks (pun intended)
        seek_track (tracks_length + 1);
    }
    UnlockMutex (soundSource[SPEECH_SOURCE].stream_mutex);
}
Exemple #5
0
static void act(struct floppy_state *fs)
{
	for (;;) {
		switch (fs->state) {
		case idle:
			return;		/* XXX shouldn't get here */

		case locating:
			if (swim3_readbit(fs, TRACK_ZERO)) {
				fs->cur_cyl = 0;
				if (fs->req_cyl == 0)
					fs->state = do_transfer;
				else
					fs->state = seeking;
				break;
			}
			scan_track(fs);
			return;

		case seeking:
			if (fs->cur_cyl < 0) {
				fs->expect_cyl = -1;
				fs->state = locating;
				break;
			}
			if (fs->req_cyl == fs->cur_cyl) {
				printk("whoops, seeking 0\n");
				fs->state = do_transfer;
				break;
			}
			seek_track(fs, fs->req_cyl - fs->cur_cyl);
			return;

		case settling:
			/* check for SEEK_COMPLETE after 30ms */
			fs->settle_time = (HZ + 32) / 33;
			set_timeout(fs, fs->settle_time, settle_timeout);
			return;

		case do_transfer:
			if (fs->cur_cyl != fs->req_cyl) {
				if (fs->retries > 5) {
					swim3_end_request_cur(-EIO);
					fs->state = idle;
					return;
				}
				fs->state = seeking;
				break;
			}
			setup_transfer(fs);
			return;

		case jogging:
			seek_track(fs, -5);
			return;

		default:
			printk(KERN_ERR"swim3: unknown state %d\n", fs->state);
			return;
		}
	}
}
Exemple #6
0
static void act(struct floppy_state *fs)
{
	volatile struct swim3 *sw = fs->swim3;

	for (;;) {
		switch (fs->state) {
		case idle:
			return;		/* XXX shouldn't get here */

		case locating:
			if (swim3_readbit(fs, TRACK_ZERO)) {
				fs->cur_cyl = 0;
				if (fs->req_cyl == 0)
					fs->state = do_transfer;
				else
					fs->state = seeking;
				break;
			}
			scan_track(fs);
			return;

		case seeking:
			if (fs->cur_cyl < 0) {
				fs->expect_cyl = -1;
				fs->state = locating;
				break;
			}
			if (fs->req_cyl == fs->cur_cyl) {
				printk("whoops, seeking 0\n");
				fs->state = do_transfer;
				break;
			}
			seek_track(fs, fs->req_cyl - fs->cur_cyl);
			return;

		case settling:
			/* wait for SEEK_COMPLETE to become true */
			swim3_select(fs, SEEK_COMPLETE);
			udelay(10);
			out_8(&sw->intr_enable, ERROR_INTR | DATA_CHANGED);
			in_8(&sw->intr);	/* clear DATA_CHANGED */
			if (in_8(&sw->status) & DATA) {
				/* seek_complete is not yet true */
				set_timeout(fs, HZ/2, seek_timeout);
				return;
			}
			out_8(&sw->intr_enable, 0);
			in_8(&sw->intr);
			fs->state = locating;
			break;

		case do_transfer:
			if (fs->cur_cyl != fs->req_cyl) {
				if (fs->retries > 5) {
					end_request(fd_req, 0);
					fs->state = idle;
					return;
				}
				fs->state = seeking;
				break;
			}
			setup_transfer(fs);
			return;

		case jogging:
			seek_track(fs, -5);
			return;

		default:
			printk(KERN_ERR"swim3: unknown state %d\n", fs->state);
			return;
		}
	}
}
Exemple #7
0
static void act(struct floppy_state *fs)
{
	for (;;) {
		swim3_dbg("  act loop, state=%d, req_cyl=%d, cur_cyl=%d\n",
			  fs->state, fs->req_cyl, fs->cur_cyl);

		switch (fs->state) {
		case idle:
			return;		/* XXX shouldn't get here */

		case locating:
			if (swim3_readbit(fs, TRACK_ZERO)) {
				swim3_dbg("%s", "    locate track 0\n");
				fs->cur_cyl = 0;
				if (fs->req_cyl == 0)
					fs->state = do_transfer;
				else
					fs->state = seeking;
				break;
			}
			scan_track(fs);
			return;

		case seeking:
			if (fs->cur_cyl < 0) {
				fs->expect_cyl = -1;
				fs->state = locating;
				break;
			}
			if (fs->req_cyl == fs->cur_cyl) {
				swim3_warn("%s", "Whoops, seeking 0\n");
				fs->state = do_transfer;
				break;
			}
			seek_track(fs, fs->req_cyl - fs->cur_cyl);
			return;

		case settling:
			/* check for SEEK_COMPLETE after 30ms */
			fs->settle_time = (HZ + 32) / 33;
			set_timeout(fs, fs->settle_time, settle_timeout);
			return;

		case do_transfer:
			if (fs->cur_cyl != fs->req_cyl) {
				if (fs->retries > 5) {
					swim3_err("Wrong cylinder in transfer, want: %d got %d\n",
						  fs->req_cyl, fs->cur_cyl);
					swim3_end_request(fs, BLK_STS_IOERR, 0);
					fs->state = idle;
					return;
				}
				fs->state = seeking;
				break;
			}
			setup_transfer(fs);
			return;

		case jogging:
			seek_track(fs, -5);
			return;

		default:
			swim3_err("Unknown state %d\n", fs->state);
			return;
		}
	}
}
Exemple #8
0
static int32_t cdpa_seek(rnc_dev_t *dev, rnc_track_t *trk, uint32_t blk)
{
    cdpa_t  *cdpa = dev->data;

    return seek_track(cdpa, trk->idx, blk);
}
Exemple #9
0
static int cdpa_get_tracks(rnc_dev_t *dev, rnc_track_t *buf, size_t size)
{
    cdpa_t       *cdpa = dev->data;
    cdpa_track_t *tracks, *trk;
    int           ntrack, base, naudio;
    rnc_track_t  *t;
    int           id, i;

    mrp_debug("getting tracks");

    base = cdio_get_first_track_num(cdpa->cdio);

    if (cdpa->ntrack == 0) {
        ntrack = cdio_get_num_tracks(cdpa->cdio);

        if (ntrack == 0)
            return 0;

        tracks = mrp_allocz_array(typeof(*tracks), ntrack);

        if (tracks == NULL)
            return -1;

        naudio = 0;
        trk    = tracks;
        for (i = 0; i < ntrack; i++) {
            id = base + i;

            if (cdio_get_track_format(cdpa->cdio, id) != TRACK_FORMAT_AUDIO)
                continue;
            trk->id  = id;
            trk->idx = i;
            trk->fblk = cdio_get_track_lsn(cdpa->cdio, id);
            trk->lblk = cdio_get_track_last_lsn(cdpa->cdio, id);

            naudio++;
            trk++;
        }

        cdpa->tracks = tracks;
        cdpa->ntrack = naudio;
    }
    else
        ntrack = cdpa->ntrack;

    if ((int)size > cdpa->ntrack)
        size = cdpa->ntrack;

    for (i = 0, t = buf, trk = cdpa->tracks; i < (int)size; i++, t++, trk++) {
        t->idx    = trk - cdpa->tracks;
        t->id     = base + i;
        t->fblk   = trk->fblk;
        t->nblk   = trk->lblk - trk->fblk + 1;
        t->length = 1.0 * t->nblk / 75.0;
    }

    if (cdpa->ctrack < 0) {
        cdio_paranoia_modeset(cdpa->cdpa, PARANOIA_MODE_FULL);
        cdpa->ctrack = 0;
        seek_track(cdpa, 0, 0);
    }

    return ntrack;
}