mediaplayer
Class Main

java.lang.Object
  extended by packetNetworking.Communicator
      extended by packetNetworking.Server
          extended by mediaplayer.Main

public class Main
extends Server

This class maintains the basic functions of the control suite This includes arranging of items, trials, maintaining a playlist and more.


Field Summary
static int activeItem
          the active item in a trial. used to control item coloring
 java.util.ArrayList<java.lang.String> clipList
          the list of clip names
static boolean isRunning
          isRunning is true if a test is running
 ListPacket listPacket
          Packet received from the clip recorder control application
 Playlist playlist
          The active playlist
static Salt salt
          An instance of a modified salt version.
 Status status
          The status of the control suite
static java.lang.String stopTC
          The stop time for the active clip
static java.lang.String timeCode
          The current time code
static boolean userHasPressedStart
           
static MediaPlayerView view
          This is the gui of the application.
 
Fields inherited from class packetNetworking.Server
clientSocketsOpen, hasSentPing, isAllSocketsOpen, pingErrorCounter, ports
 
Constructor Summary
Main(MediaPlayerView view)
          Sets up the application.
 
Method Summary
 void changeNrOfItemsPerTrial()
          Called when the user changes the number of items per trial.
 void editItem(Item item)
          edits an existing item
 void editPlaylistName(java.lang.String text)
          sets a new playlist name
 void newItem()
          creates a new item dialog
 void nextTrial()
          Jumps to the next trial and plays the first item in the next trial
 void play()
          start the test from the beginning.
 void playActiveItem(int index)
          sets the activeitem parameter and plays that item
 void previousTrial()
          jumps to the previous trial and plays the first clip in that trial
 void ProcessPacket(Packet pck)
          Process ping packets only.
 void saveSession()
          Saves a session using the sessionwriter
 void sendPacket(Packet pck)
          Sends a packet.
 void setActiveItem()
          sets active item in a trial. resets all other active trials
 void setActiveItem(int index)
          sets the active item a the selected trial to index
 void setDesign(Design design)
          sets a design and opens the midi devices
 void setTimeCode(java.lang.String tc)
          Sets the current time code.
 void stop()
          Stops playback from the clip recorder
 void UpdateStatus(int status)
          Update connection status of the server
 
Methods inherited from class packetNetworking.Server
Listen, Talk, Talk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

public static MediaPlayerView view
This is the gui of the application. It also gives indirect access to public fields in this class via a main instance


salt

public static Salt salt
An instance of a modified salt version. No salt gui is shown


isRunning

public static boolean isRunning
isRunning is true if a test is running


activeItem

public static int activeItem
the active item in a trial. used to control item coloring


playlist

public Playlist playlist
The active playlist


clipList

public java.util.ArrayList<java.lang.String> clipList
the list of clip names


userHasPressedStart

public static boolean userHasPressedStart

listPacket

public ListPacket listPacket
Packet received from the clip recorder control application


status

public Status status
The status of the control suite


timeCode

public static java.lang.String timeCode
The current time code


stopTC

public static java.lang.String stopTC
The stop time for the active clip

Constructor Detail

Main

public Main(MediaPlayerView view)
Sets up the application. The constructor is called before the gui, but after gui component intializing.

Parameters:
view -
Method Detail

editPlaylistName

public void editPlaylistName(java.lang.String text)
sets a new playlist name

Parameters:
text -

newItem

public void newItem()
creates a new item dialog


editItem

public void editItem(Item item)
edits an existing item

Parameters:
item -

setActiveItem

public void setActiveItem()
sets active item in a trial. resets all other active trials


setActiveItem

public void setActiveItem(int index)
sets the active item a the selected trial to index

Parameters:
index -

playActiveItem

public void playActiveItem(int index)
sets the activeitem parameter and plays that item

Parameters:
index -

nextTrial

public void nextTrial()
Jumps to the next trial and plays the first item in the next trial


previousTrial

public void previousTrial()
jumps to the previous trial and plays the first clip in that trial


play

public void play()
start the test from the beginning.


stop

public void stop()
Stops playback from the clip recorder


sendPacket

public void sendPacket(Packet pck)
Sends a packet. Only used to print out the packet before sending

Parameters:
pck -

ProcessPacket

public void ProcessPacket(Packet pck)
Description copied from class: Server
Process ping packets only. To use other packets, classes can overwrite this method

Overrides:
ProcessPacket in class Server

UpdateStatus

public void UpdateStatus(int status)
Description copied from class: Server
Update connection status of the server

Overrides:
UpdateStatus in class Server

setDesign

public void setDesign(Design design)
sets a design and opens the midi devices

Parameters:
design -

changeNrOfItemsPerTrial

public void changeNrOfItemsPerTrial()
Called when the user changes the number of items per trial. This updates the list model and the appropriate variables It removes all extra items if the number is lower than the former number. It adds null objects if the number is higher


saveSession

public void saveSession()
Saves a session using the sessionwriter


setTimeCode

public void setTimeCode(java.lang.String tc)
Sets the current time code. Called each time a new time code is received

Parameters:
tc -