singerbot proxy, fixed recently opened files, style sheet support

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@574 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-11-03 14:41:58 +00:00
parent 175c123ce0
commit f01af6740e
87 changed files with 1710 additions and 1329 deletions

View File

@@ -27,6 +27,8 @@
#define _BASS_BOOSTER_H
#include <QtGui/QWorkspace>
#include "effect.h"
#include "effect_lib.h"
#include "engine.h"

View File

@@ -32,6 +32,7 @@
* 18 Sep 01, tuorfa@yahoo.com: added AttrStack (stack of stacks) paradigm
* 22 Sep 01, tuorfa@yahoo.com: added comment blocks
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -101,7 +102,7 @@ void attr_clear_all( void )
*=======================================================================*/
void
attr_express_begin (int attr, char* param) {
attr_express_begin (int attr, const char* param) {
switch(attr)
{
case ATTR_BOLD:
@@ -302,7 +303,7 @@ attr_express_end (int attr, char *param)
*=======================================================================*/
void
attr_push(int attr, char* param)
attr_push(int attr, const char* param)
{
AttrStack *stack = stack_of_stacks_top;
if (!stack) {

View File

@@ -31,6 +31,7 @@
* 06 Aug 01, tuorfa@yahoo.com: added several attributes
* 18 Sep 01, tuorfa@yahoo.com: updates for AttrStack paradigm
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifndef _ATTR
@@ -73,7 +74,7 @@ extern void attr_push_core (int attr, char* param);
extern void attr_pop_core (int attr);
extern void attr_push(int attr, char* param);
extern void attr_push(int attr, const char* param);
extern void attrstack_push();
extern void attrstack_drop();

View File

@@ -59,6 +59,7 @@
and added support for accented characters in titles from
Laurent Monin
# 09 Mar 06, daved@physiol.usyd.edu.au: don't print null post_trans
* 31 Oct 07, jasp00@users.sourceforge.net: fixed several warnings
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -156,7 +157,7 @@ static int picture_height;
static int picture_bits_per_pixel=1;
static int picture_type=PICT_UNKNOWN;
static int picture_wmetafile_type;
static char *picture_wmetafile_type_str;
static const char *picture_wmetafile_type_str;
static int have_printed_body=FALSE;
@@ -208,7 +209,7 @@ starting_body ()
/*-------------------------------------------------------------------*/
static char *month_strings[12]= {
static const char *month_strings[12]= {
#ifdef ENGLISH
"January","February","March","April","May","June","July","August",
"September","October","November","December"
@@ -491,7 +492,7 @@ process_info_group (Word *w)
{
int ch = h2toi (&s2[2]);
char *s3;
const char *s3;
s3 = op_translate_char (op, charset_type, ch, numchar_table);
if (!s3 || !*s3)
{
@@ -834,7 +835,7 @@ cmd_field (Word *w, int align, char has_param, int num) {
op->symbol_last_char >= char_num
)
{
char * string;
const char * string;
if ((string = op->symbol_translation_table[char_num - op->symbol_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
}
@@ -1423,8 +1424,7 @@ static int cmd_ulnone (Word *w, int align, char has_param, int param) {
attr==ATTR_THICK_UL ||
attr==ATTR_DOUBLE_UL)
{
if (!attr_pop(ATTR_UNDERLINE))
;
attr_pop(ATTR_UNDERLINE);
} else
more=FALSE;
} while(more);
@@ -1681,7 +1681,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol1_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol1_translation_table[param - op->unisymbol1_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -1695,7 +1695,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol2_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol2_translation_table[param - op->unisymbol2_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -1709,7 +1709,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol3_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol3_translation_table[param - op->unisymbol3_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -1724,7 +1724,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol4_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol4_translation_table[param - op->unisymbol4_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -2291,9 +2291,9 @@ static int cmd_tcn (Word *w, int align, char has_param, int param) {
typedef struct {
char *name;
const char *name;
int (*func)(Word*, int, char, int);
char *debug_print;
const char *debug_print;
} HashItem;
@@ -2616,7 +2616,7 @@ enum { SMALL=0, BIG=1 };
}
while ((ch=*s)) {
char *post_trans = NULL;
const char *post_trans = NULL;
if (simulate_allcaps || simulate_smallcaps)
ch = toupper (ch);
@@ -2844,7 +2844,7 @@ word_print_core (Word *w)
if (within_picture) {
starting_body();
if (!pictfile && !nopict_mode) {
char *ext=NULL;
const char *ext=NULL;
switch (picture_type) {
case PICT_WB: ext="bmp"; break;
case PICT_WM: ext="wmf"; break;
@@ -2985,7 +2985,7 @@ word_print_core (Word *w)
else if (*s == '\'') {
/* \'XX is a hex char code expression */
int ch = h2toi (&s[1]);
char *s2;
const char *s2;
#if 1 /* daved - 0.19.6 */
s2 = op_translate_char (op, charset_type, ch, numchar_table);
@@ -3050,7 +3050,7 @@ word_print_core (Word *w)
match = !strcmp(s, hip[index].name);
if (match) {
char *debug;
const char *debug;
int terminate_group;
if (hip[index].func) {

View File

@@ -36,6 +36,7 @@
* 25 Sep 04, st001906@hrz1.hrz.tu-darmstadt.de: added stdlib.h for djgpp
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 22 Aug 05, ax2groin@arbornet.org: added lineno to error_handler
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -79,7 +80,7 @@ usage ()
*=======================================================================*/
void
error_handler (char* message)
error_handler (const char* message)
{
#if 1
fprintf(stderr, "Error (line %d): %s\n", lineno, message);
@@ -98,7 +99,7 @@ error_handler (char* message)
*=======================================================================*/
void
warning_handler (char* message)
warning_handler (const char* message)
{
fprintf(stderr, "Warning: %s\n", message);
}

View File

@@ -29,6 +29,7 @@
*----------------------------------------------------------------------
* Changes
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
@@ -38,7 +39,7 @@
extern void usage(void);
extern void error_handler (char*);
extern void warning_handler (char*);
extern void error_handler (const char*);
extern void warning_handler (const char*);

View File

@@ -38,6 +38,7 @@
* 21 Jul 05, daved@physiol.usyd.edu.au: added endash
* 19 Aug 05, ax2groin@arbornet.org: added more chars and changes to ANSI
* 05 Jan 06, marcossamaral@terra.com.br: fixed bugs #14982 and #14983
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -59,7 +60,7 @@
#include "output.h"
static char* ascii [96] = {
static const char* ascii [96] = {
/* 0x20 */ " ", "!", "&quot;", "#", "$", "%", "&amp;", "'",
/* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
/* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
@@ -75,7 +76,7 @@ static char* ascii [96] = {
};
static char* ansi [] = {
static const char* ansi [] = {
/* 0x78 */ "x",
/* 0x79 */ "y",
/* 0x7a */ "z",
@@ -123,7 +124,7 @@ static char* ansi [] = {
/* 0xf8 */ "&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;"
};
static char* mac [] = {
static const char* mac [] = {
/* 0xa4 */ "&bull;", NULL,NULL,NULL,
/* 0xa8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xb0 */ NULL,NULL,NULL,NULL,NULL,"&mu;",NULL,NULL,
@@ -134,7 +135,7 @@ static char* mac [] = {
};
#if 1 /* daved - 0.19.4 - unicode symbol character support */
static char * unisymbol1[] = {
static const char * unisymbol1[] = {
/* 913 */ "&Alpha;",
/* 914 */ "&Beta;",
/* 915 */ "&Gamma;",
@@ -208,7 +209,7 @@ static char * unisymbol1[] = {
};
#endif
#if 1 /* daved - 0.19.4 - unicode symbol character support */
static char * unisymbol2[] = {
static const char * unisymbol2[] = {
/* 57516 */ "&Gamma;",
/* 57517 */ "&Delta;",
/* 57518 */ "&Theta;",
@@ -253,7 +254,7 @@ static char * unisymbol2[] = {
/* 57557 */ "&delta;",
};
static char * unisymbol3[] = {
static const char * unisymbol3[] = {
/* 61505 */ "&Alpha;",
/* 61506 */ "&Beta;",
/* 61507 */ "&Chi;",
@@ -316,7 +317,7 @@ static char * unisymbol3[] = {
#endif
#if 1 /* 0.19.5 more unicode characters */
static char * unisymbol4[] = {
static const char * unisymbol4[] = {
/* 61600 */ "&euro;",
/* 61601 */ "&upsih;",
/* 61602 */ "&prime;",
@@ -414,7 +415,7 @@ static char * unisymbol4[] = {
};
#endif
#if 1 /* daved - SYMBOL font characters */
static char* symbol[] = {
static const char* symbol[] = {
/* 60 */ "&lt;",
/* 61 */ "=",
/* 62 */ "&gt;",
@@ -612,7 +613,7 @@ static char* symbol[] = {
/* 254 */ 0,
};
#endif
static char* cp437 [] = {
static const char* cp437 [] = {
/* 0x80 */ "&ccedil;",
/* 0x81 */ "&uuml;",
/* 0x82 */ "&eacute;",
@@ -743,7 +744,7 @@ static char* cp437 [] = {
/* 0xff */ "&nbsp;",
};
static char* cp850 [] = {
static const char* cp850 [] = {
/* 0x80 */ "&ccedil;",
/* 0x81 */ "&uuml;",
/* 0x82 */ "&eacute;",

View File

@@ -34,6 +34,7 @@
* 28 Sep 01, tuorfa@yahoo.com: removed Turbo C support.
* 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -114,7 +115,7 @@ total_malloced (void) {
*=======================================================================*/
char *
my_strdup (char *src) {
my_strdup (const char *src) {
unsigned long len;
char *ptr;

View File

@@ -28,10 +28,11 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
extern char * my_malloc (unsigned long);
extern void my_free (char*);
extern unsigned long total_malloced (void);
extern char * my_strdup (char*);
extern char * my_strdup (const char*);

View File

@@ -33,6 +33,7 @@
* 25 Sep 04, st001906@hrz1.hrz.tu-darmstadt.de: added stdlib.h for djgpp
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 06 Jan 06, marcossamaral@terra.com.br: changes in STDOUT
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
@@ -111,7 +112,7 @@ op_free (OutputPersonality *op)
* Returns: String.
*=======================================================================*/
char *
const char *
#if 1 /* daved - 0.19.6 */
op_translate_char (OutputPersonality *op, int charset, int ch, int ntable)
#else
@@ -119,7 +120,7 @@ op_translate_char (OutputPersonality *op, int charset, int ch)
#endif
{
short start;
char *result=NULL;
const char *result=NULL;
CHECK_PARAM_NOT_NULL(op);

View File

@@ -28,6 +28,7 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
@@ -35,92 +36,92 @@
typedef struct {
char *comment_begin;
char *comment_end;
const char *comment_begin;
const char *comment_end;
char *document_begin;
char *document_end;
const char *document_begin;
const char *document_end;
char *header_begin;
char *header_end;
const char *header_begin;
const char *header_end;
char *document_title_begin;
char *document_title_end;
const char *document_title_begin;
const char *document_title_end;
char *document_keywords_begin;
char *document_keywords_end;
char *document_author_begin;
char *document_author_end;
const char *document_author_begin;
const char *document_author_end;
char *document_changedate_begin;
char *document_changedate_end;
const char *document_changedate_begin;
const char *document_changedate_end;
char *body_begin;
char *body_end;
const char *body_begin;
const char *body_end;
char *word_begin;
char *word_end;
char *paragraph_begin;
char *paragraph_end;
const char *paragraph_begin;
const char *paragraph_end;
char *center_begin;
char *center_end;
const char *center_begin;
const char *center_end;
char *align_left_begin;
char *align_left_end;
const char *align_left_begin;
const char *align_left_end;
char *align_right_begin;
char *align_right_end;
const char *align_right_begin;
const char *align_right_end;
char *justify_begin;
char *justify_end;
const char *justify_begin;
const char *justify_end;
char *forced_space;
char *line_break;
char *page_break;
const char *forced_space;
const char *line_break;
const char *page_break;
char *hyperlink_begin;
char *hyperlink_end;
const char *hyperlink_begin;
const char *hyperlink_end;
char *imagelink_begin;
char *imagelink_end;
const char *imagelink_begin;
const char *imagelink_end;
char *table_begin;
char *table_end;
const char *table_begin;
const char *table_end;
char *table_row_begin;
char *table_row_end;
const char *table_row_begin;
const char *table_row_end;
char *table_cell_begin;
char *table_cell_end;
const char *table_cell_begin;
const char *table_cell_end;
/* Character attributes */
char *font_begin;
char *font_end;
const char *font_begin;
const char *font_end;
char *fontsize_begin;
char *fontsize_end;
const char *fontsize_begin;
const char *fontsize_end;
/* standard font sizes are optional */
char *fontsize8_begin;
char *fontsize8_end;
const char *fontsize8_begin;
const char *fontsize8_end;
char *fontsize10_begin;
char *fontsize10_end;
const char *fontsize10_begin;
const char *fontsize10_end;
char *fontsize12_begin;
char *fontsize12_end;
const char *fontsize12_begin;
const char *fontsize12_end;
char *fontsize14_begin;
char *fontsize14_end;
const char *fontsize14_begin;
const char *fontsize14_end;
char *fontsize18_begin;
char *fontsize18_end;
const char *fontsize18_begin;
const char *fontsize18_end;
char *fontsize24_begin;
char *fontsize24_end;
const char *fontsize24_begin;
const char *fontsize24_end;
char *fontsize36_begin;
char *fontsize36_end;
@@ -128,71 +129,71 @@ typedef struct {
char *fontsize48_begin;
char *fontsize48_end;
char *smaller_begin;
char *smaller_end;
const char *smaller_begin;
const char *smaller_end;
char *bigger_begin;
char *bigger_end;
const char *bigger_begin;
const char *bigger_end;
char *foreground_begin;
char *foreground_end;
const char *foreground_begin;
const char *foreground_end;
char *background_begin;
char *background_end;
const char *background_begin;
const char *background_end;
char *bold_begin;
char *bold_end;
const char *bold_begin;
const char *bold_end;
char *italic_begin;
char *italic_end;
const char *italic_begin;
const char *italic_end;
char *underline_begin;
char *underline_end;
const char *underline_begin;
const char *underline_end;
char *dbl_underline_begin;
char *dbl_underline_end;
const char *dbl_underline_begin;
const char *dbl_underline_end;
char *superscript_begin;
char *superscript_end;
const char *superscript_begin;
const char *superscript_end;
char *subscript_begin;
char *subscript_end;
const char *subscript_begin;
const char *subscript_end;
char *strikethru_begin;
char *strikethru_end;
const char *strikethru_begin;
const char *strikethru_end;
char *dbl_strikethru_begin;
char *dbl_strikethru_end;
const char *dbl_strikethru_begin;
const char *dbl_strikethru_end;
char *emboss_begin;
char *emboss_end;
const char *emboss_begin;
const char *emboss_end;
char *engrave_begin;
char *engrave_end;
const char *engrave_begin;
const char *engrave_end;
char *shadow_begin;
char *shadow_end;
const char *shadow_begin;
const char *shadow_end;
char *outline_begin;
char *outline_end;
const char *outline_begin;
const char *outline_end;
char *small_caps_begin;
char *small_caps_end;
char *pointlist_begin;
char *pointlist_end;
const char *pointlist_begin;
const char *pointlist_end;
char *pointlist_item_begin;
char *pointlist_item_end;
const char *pointlist_item_begin;
const char *pointlist_item_end;
char *numericlist_begin;
char *numericlist_end;
const char *numericlist_begin;
const char *numericlist_end;
char *numericlist_item_begin;
char *numericlist_item_end;
const char *numericlist_item_begin;
const char *numericlist_item_end;
char *expand_begin;
char *expand_end;
const char *expand_begin;
const char *expand_end;
char *toc_entry_begin;
char *toc_entry_end;
@@ -204,54 +205,54 @@ typedef struct {
* to one of the charsets.
*/
struct {
char *bullet;
char *left_quote;
char *right_quote;
char *left_dbl_quote;
char *right_dbl_quote;
char *nonbreaking_space;
char *emdash;
char *endash;
char *lessthan;
char *greaterthan;
char *amp;
char *copyright;
char *trademark;
const char *bullet;
const char *left_quote;
const char *right_quote;
const char *left_dbl_quote;
const char *right_dbl_quote;
const char *nonbreaking_space;
const char *emdash;
const char *endash;
const char *lessthan;
const char *greaterthan;
const char *amp;
const char *copyright;
const char *trademark;
char *nonbreaking_hyphen;
char *optional_hyphen;
} chars;
char **ascii_translation_table;
const char **ascii_translation_table;
int simulate_small_caps : 1;
int simulate_all_caps : 1;
int simulate_word_underline : 1;
char **ansi_translation_table;
const char **ansi_translation_table;
short ansi_first_char;
short ansi_last_char;
char **cp437_translation_table;
const char **cp437_translation_table;
short cp437_first_char;
short cp437_last_char;
char **cp850_translation_table;
const char **cp850_translation_table;
short cp850_first_char;
short cp850_last_char;
char **mac_translation_table;
const char **mac_translation_table;
short mac_first_char;
short mac_last_char;
#if 1 /* daved 0.20.0 */
unsigned int unisymbol1_first_char;
unsigned int unisymbol1_last_char;
char **unisymbol1_translation_table;
const char **unisymbol1_translation_table;
unsigned int unisymbol2_first_char;
unsigned int unisymbol2_last_char;
char **unisymbol2_translation_table;
const char **unisymbol2_translation_table;
unsigned int unisymbol3_first_char;
unsigned int unisymbol3_last_char;
char **unisymbol3_translation_table;
const char **unisymbol3_translation_table;
unsigned int unisymbol4_first_char;
unsigned int unisymbol4_last_char;
char **unisymbol4_translation_table;
const char **unisymbol4_translation_table;
#else
#if 1 /* daved 0.19.4 unicode support */
short unisymbol1_first_char;
@@ -273,7 +274,7 @@ typedef struct {
#if 1 /* daved 0.19.5 SYMBOL font support */
short symbol_first_char;
short symbol_last_char;
char **symbol_translation_table;
const char **symbol_translation_table;
#endif
void (*write_set_foreground) (int,int,int);
@@ -284,7 +285,7 @@ OutputPersonality;
extern OutputPersonality* op_create(void);
extern void op_free (OutputPersonality*);
#if 1 /* daved - 0.19.6 */
extern char* op_translate_char (OutputPersonality*,int,int, int);
extern const char* op_translate_char (OutputPersonality*,int,int, int);
#else
extern char* op_translate_char (OutputPersonality*,int,int);
#endif

View File

@@ -25,14 +25,16 @@
#ifndef _LADSPA_EFFECT_H
#define _LADSPA_EFFECT_H
#include <QtGui/QWorkspace>
#include "effect.h"
#include "engine.h"
#include "ladspa_2_lmms.h"
#include "mixer.h"
#include "ladspa_base.h"
#include "ladspa_control.h"
#include "ladspa_control_dialog.h"
#include "ladspa_base.h"
#include "main_window.h"
#include "mixer.h"
typedef QVector<port_desc_t *> multi_proc_t;

View File

@@ -662,8 +662,9 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size)
sample_cnt++;
vcf_envpos++;
float old_vco_k = vco_k;
bool looking;
// unused variables
//float old_vco_k = vco_k;
//bool looking;
int decay_frames = 128;
// update vco
@@ -747,7 +748,7 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size)
}
if(i>=release_frame) {
if((int)i>=release_frame) {
vca_mode=1;
}

View File

@@ -560,8 +560,10 @@ bool FASTCALL midiImport::readTrack( int _track_end, QString & _track_name )
{
int nominator = readByte();
int denominator = 1 << (int) readByte();
int clocks = readByte();
int notes = readByte();
// clocks
readByte();
// notes
readByte();
if( nominator == 0 )
{
nominator = 4;

View File

@@ -31,7 +31,10 @@ CLEANFILES = $(MOC_FILES) ./embedded_resources.h
pkglib_LTLIBRARIES = libsingerbot.la
libsingerbot_la_SOURCES = singerbot.cpp singerbot.h
libsingerbot_la_LDFLAGS = -lFestival -lestools -lestbase -lesd -lncurses
libsingerbot_la_SOURCES = singerbot.cpp singerbot.h file.h
$(libsingerbot_la_SOURCES): ./embedded_resources.h
pkglib_PROGRAMS = singerbot_proxy
singerbot_proxy_SOURCES = singerbot_proxy.cpp
singerbot_proxy_LDFLAGS = -lFestival -lestools -lestbase -lesd -lncurses -lrt

72
plugins/singerbot/file.h Normal file
View File

@@ -0,0 +1,72 @@
/*
* file.h - file descriptor wrapper
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _FILE_H
#define _FILE_H
#include <unistd.h>
#include <sys/types.h>
class File
{
public:
File( int _fd ) :
m_fd( _fd )
{
}
virtual ~File()
{
close( m_fd );
}
template<typename T>
ssize_t read( T * _i, int _n = 1 )
{
return( ::read( m_fd, _i, _n * sizeof( T ) ) );
}
template<typename T>
ssize_t write( const T * _i, int _n = 1 )
{
return( ::write( m_fd, _i, _n * sizeof( T ) ) );
}
off_t rewind( void )
{
return( lseek( m_fd, 0, SEEK_SET ) );
}
private:
const int m_fd;
} ;
#endif

View File

@@ -23,13 +23,20 @@
*/
#include "singerbot.h"
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <QtCore/QDir>
#include <QtGui/QLayout>
#include <QtGui/QTextEdit>
#include <QtXml/QDomElement>
#include "singerbot.h"
#include "engine.h"
#include "file.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "pattern.h"
@@ -38,9 +45,6 @@
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
#undef HAVE_CONFIG_H
#include <festival.h>
@@ -72,19 +76,10 @@ plugin * lmms_plugin_main( void * _data )
singerBot::synThread * singerBot::s_thread = NULL;
singerBot::singerBot( instrumentTrack * _track ) :
instrument( _track, &singerbot_plugin_descriptor )
{
if( !s_thread )
{
s_thread = new synThread();
s_thread->start();
}
synth_init();
setAutoFillBackground( TRUE );
QPalette pal;
@@ -116,6 +111,7 @@ singerBot::singerBot( instrumentTrack * _track ) :
singerBot::~singerBot()
{
synth_destroy();
}
@@ -148,7 +144,7 @@ void singerBot::playNote( notePlayHandle * _n, bool )
void singerBot::deleteNotePluginData( notePlayHandle * _n )
{
handle_data * hdata = (handle_data *)_n->m_pluginData;
delete hdata->wave;
delete[] hdata->wave;
src_delete( hdata->resampling_state );
delete hdata;
}
@@ -228,9 +224,8 @@ void singerBot::createWave( notePlayHandle * _n )
int word_index = _n->patternIndex() % m_words.size();
hdata->text = m_words[word_index].toAscii().constData();
s_thread->set_data( hdata );
s_thread->unlock_synth();
s_thread->lock_handle();
synth_send( hdata );
synth_read( hdata );
if( !hdata->wave )
{
@@ -246,7 +241,7 @@ void singerBot::createWave( notePlayHandle * _n )
}
hdata->resampling_data.end_of_input = 0;
hdata->remaining_frames = hdata->wave->num_samples();
hdata->remaining_frames = hdata->num_samples;
}
@@ -255,11 +250,10 @@ void singerBot::createWave( notePlayHandle * _n )
void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
const fpp_t _frames )
{
const f_cnt_t offset = _hdata->wave->num_samples()
- _hdata->remaining_frames;
const f_cnt_t offset = _hdata->num_samples - _hdata->remaining_frames;
const double ratio = engine::getMixer()->sampleRate()
/ (double)_hdata->wave->sample_rate();
/ (double)_hdata->sample_rate;
const f_cnt_t margin = 2;
f_cnt_t fragment_size = (f_cnt_t)( _frames / ratio ) + margin;
@@ -270,8 +264,7 @@ void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
{
for( f_cnt_t frame = 0; frame < fragment_size; ++frame )
{
sample_fragment[frame] = _hdata->wave->a( offset
+ frame )
sample_fragment[frame] = _hdata->wave[offset + frame]
/ OUTPUT_SAMPLE_MULTIPLIER;
}
}
@@ -280,8 +273,7 @@ void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
for( f_cnt_t frame = 0; frame < _hdata->remaining_frames;
++frame )
{
sample_fragment[frame] = _hdata->wave->a( offset
+ frame )
sample_fragment[frame] = _hdata->wave[offset + frame]
/ OUTPUT_SAMPLE_MULTIPLIER;
}
memset( sample_fragment + _hdata->remaining_frames, 0,
@@ -325,141 +317,104 @@ void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
singerBot::synThread::synThread( void ) :
m_handle_semaphore( 1 ),
m_synth_semaphore( 1 )
void singerBot::synth_init( void )
{
m_handle_semaphore.acquire();
m_synth_semaphore.acquire();
static int suffix_index = 0;
m_file_suffix = '.' + QString::number( getpid() ) + '.'
+ QString::number( suffix_index++, 16 );
int fd = shm_open( addSuffix( "/lmms_singerbot" ),
O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR );
m_shm = new File( fd );
m_handle_semaphore = sem_open( addSuffix( "/lmms_singerbot_s1" ),
O_CREAT | O_EXCL, S_IRUSR | S_IWUSR, 0 );
m_synth_semaphore = sem_open( addSuffix( "/lmms_singerbot_s2" ),
O_CREAT | O_EXCL, S_IRUSR | S_IWUSR, 0 );
pid_t cpid = fork();
if( cpid == -1 )
{
perror( "fork" );
exit( EXIT_FAILURE );
}
else if( cpid == 0 )
{
sem_close( m_handle_semaphore );
sem_close( m_synth_semaphore );
QString proxy_exec = configManager::inst()->pluginDir() +
QDir::separator() +
"singerbot_proxy";
execlp( proxy_exec.toAscii().constData(),
proxy_exec.toAscii().constData(),
m_file_suffix.toAscii().constData(),
NULL );
exit( EXIT_FAILURE );
}
sem_wait( m_handle_semaphore );
}
singerBot::synThread::~synThread()
void singerBot::synth_destroy( void )
{
m_handle_semaphore.release();
m_synth_semaphore.release();
m_shm->rewind();
float stop = -1.0;
m_shm->write( &stop );
sem_post( m_synth_semaphore );
wait( NULL );
sem_close( m_handle_semaphore );
sem_close( m_synth_semaphore );
sem_unlink( addSuffix( "/lmms_singerbot_s1" ) );
sem_unlink( addSuffix( "/lmms_singerbot_s2" ) );
delete m_shm;
shm_unlink( addSuffix( "/lmms_singerbot" ) );
}
void singerBot::synThread::run( void )
void singerBot::synth_send( handle_data * _hdata )
{
const int load_init_files = 1;
festival_initialize( load_init_files, FESTIVAL_HEAP_SIZE );
m_shm->rewind();
m_shm->write( &_hdata->frequency );
m_shm->write( &_hdata->duration );
Uint8 len = strlen( _hdata->text );
m_shm->write( &len );
m_shm->write( _hdata->text, len );
festival_eval_command(
"(define get_segment"
" (lambda (utt) (begin"
" (Initialize utt)"
" (Text utt)"
" (Token_POS utt)"
" (Token utt)"
" (POS utt)"
" (Phrasify utt)"
" (Word utt)"
" ))"
")" );
festival_eval_command(
"(Parameter.set 'Int_Method 'DuffInt)" );
festival_eval_command(
"(Parameter.set 'Int_Target_Method Int_Targets_Default)" );
for( ; ; )
{
m_synth_semaphore.acquire();
text_to_wave();
if( !m_data->wave )
{
// Damaged SIOD environment? Retrying...
text_to_wave();
if( !m_data->wave )
{
printf( "Unsupported frequency?\n" );
}
}
m_handle_semaphore.release();
}
sem_post( m_synth_semaphore );
}
void singerBot::synThread::text_to_wave( void )
void singerBot::synth_read( handle_data * _hdata )
{
//TODO: Heap corruption too -> move to separate process?
char command[80];
sprintf( command,
"(set! duffint_params '((start %f) (end %f)))",
m_data->frequency, m_data->frequency );
festival_eval_command( command );
festival_eval_command(
"(Parameter.set 'Duration_Stretch 1)" );
sem_wait( m_handle_semaphore );
sprintf( command,
"(set! total_time (parse-number %f))", m_data->duration );
festival_eval_command( command );
festival_eval_command(
"(set! word " + quote_string( m_data->text, "\"", "\\", 1 )
+ ")" );
if( festival_eval_command(
"(begin"
" (set! my_utt (eval (list 'Utterance 'Text word)))"
" (get_segment my_utt)"
" (if (equal? (length (utt.relation.leafs my_utt 'Segment)) 1)"
" (begin (set! my_utt (eval "
" (list 'Utterance 'Text (string-append word \" \" word))))"
" (get_segment my_utt)"
" ))"
" (Pauses my_utt)"
" (item.delete (utt.relation.first my_utt 'Segment))"
" (item.delete (utt.relation.last my_utt 'Segment))"
" (Intonation my_utt)"
" (PostLex my_utt)"
" (Duration my_utt)"
" (if (not (equal? total_time 0)) (begin"
" (set! utt_time"
" (item.feat (utt.relation.last my_utt 'Segment) 'end))"
" (Parameter.set 'Duration_Stretch (/ total_time utt_time))"
" (Duration my_utt)"
" ))"
" (Int_Targets my_utt)"
")" )
&& festival_eval_command(
" (Wave_Synth my_utt)" ) )
m_shm->rewind();
m_shm->read( &_hdata->num_samples );
if( !_hdata->num_samples )
{
m_data->wave = get_wave( "my_utt" );
return;
}
m_shm->read( &_hdata->sample_rate );
_hdata->wave = new short[_hdata->num_samples];
m_shm->read( _hdata->wave, _hdata->num_samples );
}
EST_Wave * singerBot::synThread::get_wave( const char * _name )
const char * singerBot::addSuffix( const char * _s )
{
LISP lutt = siod_get_lval( _name, NULL );
if( !utterance_p( lutt ) )
{
return( NULL );
}
EST_Relation * r = utterance( lutt )->relation( "Wave" );
//TODO: This check is useless. The error is fatal.
if ( !r || !r->head() )
{
return( NULL );
}
return( new EST_Wave( *wave( r->head()->f( "wave" ) ) ) );
return( QString( _s + m_file_suffix ).toAscii().constData() );
}

View File

@@ -26,8 +26,6 @@
#ifndef _SINGERBOT_H
#define _SINGERBOT_H
#include <QtCore/QThread>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -38,11 +36,13 @@
#include "src/3rdparty/samplerate/samplerate.h"
#endif
#include <semaphore.h>
#include "instrument.h"
#include "mixer.h"
class EST_Wave;
class File;
class QTextEdit;
class sampleBuffer;
@@ -73,7 +73,9 @@ public slots:
private:
typedef struct
{
EST_Wave * wave;
short * wave;
int num_samples;
int sample_rate;
f_cnt_t remaining_frames;
float frequency;
float duration;
@@ -83,44 +85,11 @@ private:
} handle_data;
class synThread : public QThread
{
public:
synThread( void );
virtual ~synThread();
QString m_file_suffix;
void set_data( handle_data * _hdata )
{
m_data = _hdata;
}
void unlock_synth( void )
{
m_synth_semaphore.release();
}
void lock_handle( void )
{
m_handle_semaphore.acquire();
}
protected:
virtual void run( void );
private:
QSemaphore m_handle_semaphore;
QSemaphore m_synth_semaphore;
handle_data * m_data;
void text_to_wave( void );
EST_Wave * get_wave( const char * _name );
} ;
static synThread * s_thread;
File * m_shm;
sem_t * m_handle_semaphore;
sem_t * m_synth_semaphore;
QTextEdit * m_lyrics;
QStringList m_words;
@@ -131,6 +100,14 @@ private:
const fpp_t _frames );
void updateWords( void );
void synth_init( void );
void synth_destroy( void );
void synth_send( handle_data * _hdata );
void synth_read( handle_data * _hdata );
const char * addSuffix( const char * _s );
} ;

View File

@@ -0,0 +1,225 @@
/*
* singerbot_proxy.cpp - separate process to deal with Festival
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include <fcntl.h>
#include <semaphore.h>
#include <sys/mman.h>
#include <sys/types.h>
#include "file.h"
#undef HAVE_CONFIG_H
#include <festival.h>
static File * s_shm;
static sem_t * s_handle_semaphore;
static sem_t * s_synth_semaphore;
static void run( void );
static EST_Wave * text_to_wave( float _frequency, float _duration,
const char * _text );
static EST_Wave * get_wave( const char * _name );
int main( int argc, char * * argv )
{
string resource = "/lmms_singerbot";
resource += argv[1];
int fd = shm_open( resource.c_str(), O_RDWR, S_IRUSR | S_IWUSR );
s_shm = new File( fd );
resource = "/lmms_singerbot_s1";
resource += argv[1];
s_handle_semaphore = sem_open( resource.c_str(), 0 );
resource = "/lmms_singerbot_s2";
resource += argv[1];
s_synth_semaphore = sem_open( resource.c_str(), 0 );
sem_post( s_handle_semaphore );
run();
sem_close( s_handle_semaphore );
sem_close( s_synth_semaphore );
delete s_shm;
return( EXIT_SUCCESS );
}
void run( void )
{
const int load_init_files = 1;
festival_initialize( load_init_files, FESTIVAL_HEAP_SIZE );
festival_eval_command(
"(define get_segment"
" (lambda (utt) (begin"
" (Initialize utt)"
" (Text utt)"
" (Token_POS utt)"
" (Token utt)"
" (POS utt)"
" (Phrasify utt)"
" (Word utt)"
" ))"
")" );
festival_eval_command(
"(Parameter.set 'Int_Method 'DuffInt)" );
festival_eval_command(
"(Parameter.set 'Int_Target_Method Int_Targets_Default)" );
for( ; ; )
{
sem_wait( s_synth_semaphore );
float frequency;
float duration;
s_shm->rewind();
s_shm->read( &frequency );
if( frequency == -1.0f )
{
break;
}
s_shm->read( &duration );
unsigned char len;
s_shm->read( &len );
char * text = new char[len + 1];
s_shm->read( text, len );
text[len] = '\0';
EST_Wave * wave = text_to_wave( frequency, duration, text );
if( !wave )
{
// Damaged SIOD environment? Retrying...
wave = text_to_wave( frequency, duration, text );
if( !wave )
{
printf( "Unsupported frequency?\n" );
}
}
s_shm->rewind();
int num_samples = wave ? wave->num_samples() : 0;
s_shm->write( &num_samples );
if( num_samples )
{
int sample_rate = wave->sample_rate();
s_shm->write( &sample_rate );
}
for( int i = 0; i < num_samples; ++i )
{
short sample = wave->a( i );
s_shm->write( &sample );
}
delete wave;
sem_post( s_handle_semaphore );
}
}
EST_Wave * text_to_wave( float _frequency, float _duration, const char * _text )
{
char command[80];
sprintf( command,
"(set! duffint_params '((start %f) (end %f)))", _frequency,
_frequency );
festival_eval_command( command );
festival_eval_command(
"(Parameter.set 'Duration_Stretch 1)" );
sprintf( command,
"(set! total_time (parse-number %f))", _duration );
festival_eval_command( command );
festival_eval_command(
"(set! word " + quote_string( _text, "\"", "\\", 1 ) + ")" );
if( festival_eval_command(
"(begin"
" (set! my_utt (eval (list 'Utterance 'Text word)))"
" (get_segment my_utt)"
" (if (equal? (length (utt.relation.leafs my_utt 'Segment)) 1)"
" (begin (set! my_utt (eval "
" (list 'Utterance 'Text (string-append word \" \" word))))"
" (get_segment my_utt)"
" ))"
" (Pauses my_utt)"
" (item.delete (utt.relation.first my_utt 'Segment))"
" (item.delete (utt.relation.last my_utt 'Segment))"
" (Intonation my_utt)"
" (PostLex my_utt)"
" (Duration my_utt)"
" (if (not (equal? total_time 0)) (begin"
" (set! utt_time"
" (item.feat (utt.relation.last my_utt 'Segment) 'end))"
" (Parameter.set 'Duration_Stretch (/ total_time utt_time))"
" (Duration my_utt)"
" ))"
" (Int_Targets my_utt)"
")" )
&& festival_eval_command(
" (Wave_Synth my_utt)" ) )
{
return( get_wave( "my_utt" ) );
}
return( NULL );
}
EST_Wave * get_wave( const char * _name )
{
LISP lutt = siod_get_lval( _name, NULL );
if( !utterance_p( lutt ) )
{
return( NULL );
}
EST_Relation * r = utterance( lutt )->relation( "Wave" );
//TODO: This check is useless. The error is fatal.
if ( !r || !r->head() )
{
return( NULL );
}
return( new EST_Wave( *wave( r->head()->f( "wave" ) ) ) );
}

View File

@@ -23,14 +23,14 @@
*/
#include <QtCore/QPoint>
#include "impulse_editor.h"
#include <Qt/QtXml>
#include <QtCore/QMap>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtCore/QPoint>
#include <QtGui/QWhatsThis>
#include "impulse_editor.h"
#include "caption_menu.h"
#include "embed.h"
#include "engine.h"
#include "oscillator.h"
@@ -41,7 +41,7 @@
impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, track * _track,
Uint32 _len ) :
QWidget( _parent/*, "impulseEditor"*/ ),
QWidget( _parent ),
m_sampleLength( _len ),
m_normalizeFactor( 1.0f ),
m_forward( TRUE )
@@ -438,16 +438,7 @@ void impulseEditor::setOn( bool _on )
void impulseEditor::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: css-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( "Impulse Editor" ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu.exec( QCursor::pos() );

View File

@@ -23,11 +23,11 @@
*/
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include "nine_button_selector.h"
#include <QtGui/QWhatsThis>
#include "nine_button_selector.h"
#include "caption_menu.h"
#include "embed.h"
@@ -53,7 +53,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on,
Uint32 _x, Uint32 _y,
QWidget * _parent,
track * _track ):
QWidget( _parent/*, "nineButtonSelector"*/ ),
QWidget( _parent ),
m_selected( _default )
{
setFixedSize( 50, 50 );
@@ -250,16 +250,7 @@ void FASTCALL nineButtonSelector::setSelected( Uint8 _new_button )
void nineButtonSelector::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( "Selector" ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu.exec( QCursor::pos() );

View File

@@ -23,14 +23,14 @@
*/
#include "vibed.h"
#include <Qt/QtXml>
#include <QtCore/QMap>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QWhatsThis>
#include "vibed.h"
#include "base64.h"
#include "caption_menu.h"
#include "engine.h"
#include "instrument_track.h"
#include "knob.h"
@@ -78,6 +78,7 @@ vibed::vibed( instrumentTrack * instrument_track ) :
for( Uint8 harm = 0; harm < 9; harm++ )
{
m_editor = new impulseEditor( this, 76, 21, instrument_track );
m_editor->setAccessibleName( tr( "Impulse Editor" ) );
m_editor->setOn( FALSE );
m_editor->hide();
m_editors.append( m_editor );
@@ -238,6 +239,7 @@ vibed::vibed( instrumentTrack * instrument_track ) :
21, 127,
this,
NULL );
m_harmonic->setAccessibleName( tr( "Octave" ) );
m_harmonic->hide();
m_harmonics.append( m_harmonic );
m_harmonic->setWhatsThis( tr(
@@ -271,6 +273,7 @@ vibed::vibed( instrumentTrack * instrument_track ) :
21, 39,
this,
NULL );
m_stringSelector->setAccessibleName( tr( "String" ) );
connect( m_stringSelector, SIGNAL( nineButtonSelection( Uint8 ) ),
this, SLOT( showString( Uint8 ) ) );
m_stringSelector->setWhatsThis( tr(
@@ -588,16 +591,7 @@ void vibed::showString( Uint8 _string )
void vibed::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( "Vibed" ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( publicName() );
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu.exec( QCursor::pos() );

View File

@@ -23,9 +23,12 @@
*/
#include "lvsl_client.h"
#include <QtCore/QLocale>
#include <QtCore/QTime>
#include <QtCore/QDir>
#include <QtGui/QWorkspace>
#include <QtGui/QX11EmbedContainer>
#include <QtGui/QX11Info>
@@ -60,11 +63,10 @@
#endif
#include "templates.h"
#include "config_mgr.h"
#include "engine.h"
#include "main_window.h"
#include "lvsl_client.h"
#include "templates.h"

View File

@@ -27,6 +27,7 @@
#define _VST_EFFECT_H
#include <QtCore/QMutex>
#include <QtGui/QWorkspace>
#include "effect.h"
#include "engine.h"