Author: remi
Date: 2008-08-15 23:06:52 +0200 (Fri, 15 Aug 2008)
New Revision: 1507
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
Log:
* work in progress ...
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
2008-08-15 19:39:25 UTC (rev 1506)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/GUI/AttituneCmdConf.java
2008-08-15 21:06:52 UTC (rev 1507)
@@ -2,10 +2,10 @@
import java.awt.GridBagConstraints;
import java.awt.Insets;
-import java.util.Arrays;
-import java.util.Hashtable;
+import java.util.*;
import javax.swing.*;
+import javax.swing.border.LineBorder;
import com.tuxisalive.attitunes.*;
import com.tuxisalive.attitunes.format.*;
@@ -32,9 +32,11 @@
private static JSpinner jSpinnerCount;
private static JSlider jSliderSpeed;
private static JComboBox jComboBoxLocutors;
+ private static JSpinner jSpinnerPitch;
+ private static JTextArea jTextAreaTTS;
+ private static JComboBox jComboBoxWavs;
private static Hashtable<String,Object> selectedStruct;
- private static Hashtable<String,Object> newStruct;
static
{
@@ -52,7 +54,17 @@
SpinnerModel model = new SpinnerNumberModel(2, 1, 255, 1);
jSpinnerCount = new JSpinner(model);
+ SpinnerModel model0 = new SpinnerNumberModel(100, 50, 250, 1);
+ jSpinnerPitch = new JSpinner(model0);
+
jComboBoxLocutors = new JComboBox();
+ jComboBoxWavs = new JComboBox();
+
+ jTextAreaTTS = new JTextArea("");
+ jTextAreaTTS.setSize(200, 90);
+ jTextAreaTTS.setPreferredSize(new java.awt.Dimension(200, 90));
+ jTextAreaTTS.setLineWrap(true);
+ jTextAreaTTS.setBorder(new LineBorder(new java.awt.Color(0,0,0), 1,
false));
}
@@ -238,7 +250,6 @@
else
{
selectedStruct = null;
- newStruct = null;
showBlockNoParam(attBlockViewer, myPanel);
}
}
@@ -286,7 +297,6 @@
}
else if (cmd.equals("mouth_open"))
{
- System.out.println("Test mouth open");
testBlockNoParam(attBlockViewer);
}
else if (cmd.equals("mouth_close"))
@@ -307,11 +317,11 @@
}
else if (cmd.equals("sound_play"))
{
- //testBlockSoundPlay(attBlockViewer);
+ testBlockSoundPlay(attBlockViewer);
}
else if (cmd.equals("wav_play"))
{
- //testBlockWavPlay(attBlockViewer);
+ testBlockWavPlay(attBlockViewer);
}
else if (cmd.equals("spinl_on"))
{
@@ -323,7 +333,7 @@
}
else if (cmd.equals("tts_play"))
{
- //testBlockTTS(attBlockViewer);
+ testBlockTTS(attBlockViewer);
}
else if (cmd.equals("wings_on"))
{
@@ -428,23 +438,64 @@
private static void showBlockSoundPlay(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelSoundIndex, new GridBagConstraints(1, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue(((Integer)selectedStruct.get("index")));
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockSoundPlay(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(4);
+
+ selectedStruct.put("index", (Integer)jSpinnerCount.getValue());
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockWavPlay(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelWaveName, new GridBagConstraints(1, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+ Hashtable<String,Object> wavsStruct =
attBlockViewer.attituneFile.getWavsStruct();
+ List<String> wavsList = new ArrayList<String>();
+ for (int i = 0; i < (Integer)wavsStruct.get("count"); i++)
+ {
+
wavsList.add((String)wavsStruct.get(String.format("wav%d", i)));
+ }
+ ComboBoxModel jComboBox1Model = new
DefaultComboBoxModel(wavsList.toArray());
+ jComboBoxWavs.setModel(jComboBox1Model);
+ myPanel.add(jComboBoxWavs, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+ private static void testBlockWavPlay(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(4);
+
+ selectedStruct.put("wav_name",
(String)jComboBoxWavs.getSelectedItem());
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
+
private static void showBlockSpinLOn(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelCount, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
myPanel.add(labelSpeed, new GridBagConstraints(1, 1, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue((Integer)selectedStruct.get("count"));
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+ jSliderSpeed.setMinimum(1);
+ jSliderSpeed.setMaximum(5);
+ jSliderSpeed.setValue((Integer)selectedStruct.get("speed"));
+ myPanel.add(jSliderSpeed, new GridBagConstraints(3, 1, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
private static void showBlockSpinROn(ATTBlockViewer attBlockViewer,
JPanel myPanel)
{
myPanel.add(labelCount, new GridBagConstraints(1, 0, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
myPanel.add(labelSpeed, new GridBagConstraints(1, 1, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
jSpinnerCount.getModel().setValue((Integer)selectedStruct.get("count"));
+ myPanel.add(jSpinnerCount, new GridBagConstraints(3, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+ jSliderSpeed.setMinimum(1);
+ jSliderSpeed.setMaximum(5);
+ jSliderSpeed.setValue((Integer)selectedStruct.get("speed"));
+ myPanel.add(jSliderSpeed, new GridBagConstraints(3, 1, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
private static void showBlockTTS(ATTBlockViewer attBlockViewer, JPanel
myPanel)
@@ -452,8 +503,30 @@
myPanel.add(labelLocutor, new GridBagConstraints(1, 0, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
myPanel.add(labelPitch, new GridBagConstraints(1, 1, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
myPanel.add(labelText, new GridBagConstraints(1, 2, 1, 1, 0.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0,
0, 0), 0, 0));
+
ComboBoxModel jComboBox1Model = new
DefaultComboBoxModel(attBlockViewer.tux.tts.getVoices().toArray());
jComboBoxLocutors.setModel(jComboBox1Model);
+ String currLocutor = ATTBlockParams.LOCUTOR_NAMES_LIST
[(Integer)selectedStruct.get("speaker") - 1];
+ currLocutor = currLocutor.replace("8k", "");
myPanel.add(jComboBoxLocutors, new GridBagConstraints(3, 0, 1,
1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+
+
jSpinnerPitch.getModel().setValue((Integer)selectedStruct.get("pitch"));
+ myPanel.add(jSpinnerPitch, new GridBagConstraints(3, 1, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
+
+ jTextAreaTTS.setText((String)selectedStruct.get("text"));
+ myPanel.add(jTextAreaTTS, new GridBagConstraints(3, 2, 1, 1,
0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new
Insets(0, 0, 0, 0), 0, 0));
}
+
+ private static void testBlockTTS(ATTBlockViewer attBlockViewer)
+ {
+ ATTBlock block = new ATTBlock(4);
+
+ String spkName = (String)jComboBoxLocutors.getSelectedItem() +
"8k";
+ Integer speaker =
Arrays.asList(ATTBlockParams.LOCUTOR_NAMES_LIST).indexOf(spkName) + 1;
+ selectedStruct.put("speaker", speaker);
+ selectedStruct.put("pitch", (Integer)jSpinnerPitch.getValue());
+ selectedStruct.put("text", jTextAreaTTS.getText());
+ block.setFunctionParams(selectedStruct);
+ attBlockViewer.playBlock(block);
+ }
}
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
2008-08-15 19:39:25 UTC (rev 1506)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/format/ATTBlockParams.java
2008-08-15 21:06:52 UTC (rev 1507)
@@ -272,7 +272,7 @@
static {
SPINNING_LEFT_CANVAS.put("cmd", "spinl_on");
SPINNING_LEFT_CANVAS.put("duration", 0.0);
- SPINNING_LEFT_CANVAS.put("count", 2);
+ SPINNING_LEFT_CANVAS.put("count", 4);
SPINNING_LEFT_CANVAS.put("speed", 5);
}
private static String[] spinlOnTmc(Hashtable<String,Object> struct)
@@ -291,7 +291,7 @@
static {
SPINNING_RIGHT_CANVAS.put("cmd", "spinr_on");
SPINNING_RIGHT_CANVAS.put("duration", 0.0);
- SPINNING_RIGHT_CANVAS.put("count", 2);
+ SPINNING_RIGHT_CANVAS.put("count", 4);
SPINNING_RIGHT_CANVAS.put("speed", 5);
}
private static String[] spinrOnTmc(Hashtable<String,Object> struct)
@@ -385,7 +385,7 @@
static {
PLAY_FLASH_CANVAS.put("cmd", "sound_play");
PLAY_FLASH_CANVAS.put("duration", 0.0);
- PLAY_FLASH_CANVAS.put("index", 0);
+ PLAY_FLASH_CANVAS.put("index", 1);
}
private static String[] soundPlayTmc(Hashtable<String,Object> struct)
{
Modified:
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
===================================================================
---
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-15 19:39:25 UTC (rev 1506)
+++
software_suite_v2/software/tools/attitunesStudio/trunk/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
2008-08-15 21:06:52 UTC (rev 1507)
@@ -1491,6 +1491,14 @@
String[] cmds =
ATTBlockParams.attCmdToMacroCmd(block.getFunctionParams());
String macro = ""; //$NON-NLS-1$
+ /* If the command is wav_play */
+ if
(((String)block.getFunctionParams().get("cmd")).equals("wav_play"))
//$NON-NLS-1$
+ {
+ cmds = new String[1];
+ cmds[0] = String.format("OSL_CMD:WAV:PLAY:0.0,0.0,%s",
+
attituneFile.getWaveFile((String)block.getFunctionParams().get("wav_name")));
+ }
+
for (int i = 0; i < cmds.length; i++)
{
macro += String.format("0.1:%s|", cmds[i]);
//$NON-NLS-1$
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn