Getting started with JUCE - Martin Robinson - E-Book

Getting started with JUCE E-Book

Martin Robinson

0,0
31,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

There are a number of frameworks available for developing cross-platform applications. JUCE achieves this with a combination of consistency, ease-of-use, and breadth of functionality. JUCE is a C++ toolkit for building cross-platform applications on PC, Mac, Linux, iOS, and Android. It encourages you to write consistent code and is particularly good for complex, customized GUIs and audio/midi processing; it also includes a vast range of classes to help with all your day-to-day programming tasks.

Getting started with JUCE is a practical, hands-on guide to developing applications using JUCE which will help you get started with many of the core aspects of the JUCE library. The book guides you through the installation of JUCE and covers the structure of the source code tree including some of the useful tools available for creating JUCE projects.

Getting started with JUCE will guide you through how to use the JUCE library, from the installation of basic tools to developing examples using many of its classes. It will take you through a series of practical examples that show you how to create user interfaces, illustrating the key features.

You will also learn how to deal with files, text strings, and other fundamental data using the JUCE library. In particular, you will learn how to create user interfaces both using code and using the Introjucer tool to layout and configure user interface functionality. You will also manipulate image and audio data and learn how to read and write common media file formats. With this book, you will learn everything you need to know to understand some of the additional helpful utilities offered by JUCE and how to use the JUCE documentation to get started with such classes.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 161

Veröffentlichungsjahr: 2013

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Getting Started With JUCE
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Installing JUCE and the Introjucer Application
Installing JUCE for Mac OS X and Windows
Building and running the JUCE Demo application
Running the JUCE Demo application on Windows
Running the JUCE Demo application on Mac OS X
The JUCE Demo application overview
Customizing the look and feel
Building and running the Introjucer application
Building the Introjucer application on Windows
Building the Introjucer application on Mac OS X
Examining the JUCE Demo Introjucer project
Creating a JUCE project with the Introjucer application
Documentation and other examples
Summary
2. Building User Interfaces
Creating buttons, sliders, and other components
Adding child components
Responding to user interaction and changes
Broadcasters and listeners
Filtering data entry
Using other component types
Specifying colors
Component color IDs
Setting colors using the LookAndFeel class
Using drawing operations
Intercepting mouse activity
Configuring complex component arrangements
Other component types
Summary
3. Essential Data Structures
Understanding the numerical types
Specifying and manipulating text strings
Posting log messages to the console
String manipulation
Measuring and displaying time
Displaying and formatting time information
Manipulating time data
Measuring time
Specifying file paths
Accessing various special directory locations
Obtaining various information about files
Other special locations
Navigating directory structures
Using dynamically allocated arrays
Finding the files in a directory
Tokenizing strings
Arrays of components
Using the OwnedArray class
Other banks of controls
Employing smart pointer classes
Summary
4. Using Media Files
Using simple input and output streams
Reading and writing text files
Reading and writing binary files
Reading and writing image files
Manipulating image data
Playing audio files
Creating a GUI to control audio file play
Adding audio file playback support
Working with the Binary Builder tool
Embedding an image file using the Introjucer application
Summary
5. Helpful Utilities
Using the dynamically typed objects
Using the Value class
Structuring hierarchical data
Employing undo management
Adding XML support
Understanding how JUCE handles multiple threads
Storing application properties
Adding menu bar controls
Summary
Index

Getting Started With JUCE

Getting Started With JUCE

Copyright © 2013 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: October 2013

Production Reference: 1211013

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78328-331-6

www.packtpub.com

Cover Image by Aniket Sawant (<[email protected]>)

Credits

Author

Martin Robinson

Reviewers

Michael Hetrick

Liam Lacey

Owen S. Vallis

Acquisition Editors

Ashwin Nair

Usha Iyer

Lead Technical Editor

Mohammed Fahad

Technical Editor

Menza Mathew

Project Coordinator

Suraj Bist

Proofreader

Clyde Jenkins

Indexer

Hemangini Bari

Graphics

Yuvraj Mannari

Production Coordinator

Pooja Chiplunkar

Cover Work

Pooja Chiplunkar

About the Author

Martin Robinson is a British University Lecturer, software developer, composer, and an artist. He lectures in Music Technology with particular interests in audio software development and game audio. He gained his B.A. (Hons) Music and Music Technology from Middlesex University with first class honors, specializing in music composition. Later, he gained his M.A. Electronic Arts (with distinction) where his thesis focused on developing a system for employing artificial neural networks for controlling audio-visual systems.

His interest in computer programming developed through his music composition practice and his desire to customize systems for manipulating music and audio. He developed the UGen++ library for developing audio applications that was based on the look and feel of the SuperCollider audio programming language. Later, he developed the Plink|Plonk|Plank libraries too, for audio application development. He also develops iOS applications.

I would like to thank my wife Catherine and my two children, Mia and Esme, for their support, especially on writing days.

About the Reviewers

Michael Hetrick (born in 1988) is a Ph.D. student in the Media Arts and Technology department at UC, Santa Barbara. A lifelong musician, he discovered his passion for electronic music while studying at Western Reserve Academy. At Vanderbilt University, he expanded his work into the field of video art while receiving a B.A. in Digital Media and Distribution. He went on to receive an M.A. in Electronic Music and Sound Design at UC, Santa Barbara in 2011 while doing research in chaotic synthesis under Curtis Roads, Clarence Barlow, Matthew Wright, and Marcos Novak. He is the co-owner and co-founder of Unfiltered Audio, a company dedicated to creating new software for digital musicians everywhere. His current research is focused on new paradigms for microsound. You can find his work at http://mhetrick.com.

Liam Lacey graduated from the University of the West of England, Bristol, UK in 2010 with a first-class B.Sc. (Hons) degree in Audio and Music Technology. Since then he has become the lead software developer for Bristol-based company nu desine, which develops the new electronic musical instrument—the AlphaSphere.

Liam's main interests are within the fields of music interaction and electronic musical instrument design. He recently attended the annual New Interfaces for Music Expression 2013 conference, where he co-authored and presented a paper on the design of the AlphaSphere. In his spare time he is also a musician, producer, composer, and performer, as well as likes getting involved in various programming projects.

Liam has been using JUCE, for more than two years, as the main library for all software that he develops, due to its ease for creating cross-platform GUI applications, and it has been the perfect framework for developing the AlphaSphere software due to JUCE's strong audio and MIDI support.

Owen S. Vallis is currently a professor of Music Technology at the California Institute of the Arts, Music Technology: Interaction, Intelligence, and Design program. He is a musician, artist, and scientist interested in performance, sound, and technology. As a co-founder of Flipmu and The NOISE INDEX, he explores a diverse range of projects including big data research, sound art installations, producing and composing, designing audio processors, and creating new hardware interfaces for musical performance. He received his Ph.D. in 2013 at the New Zealand School of Music, Victoria University of Wellington, and explored contemporary approaches to live computer music. During his graduate research, Owen focused on developing new musical interfaces, interactive musical agents, and large networked music ensembles. He graduated with a B.A. in Music Technology from the California Institute of the Arts in 2008.

Having lived in Toronto, Canada; Wellington, New Zealand; Tokyo, Japan; San Francisco, Nashville, and Los Angeles, Owen has been able to develop a broad and interesting cross section of musical ideologies and aesthetics. Over the past 10 years, he has worked as a research scientist for Twitter, developed multi-touch interfaces for Nokia research labs, worked for leading ribbon microphone manufacturer Royer Labs, has had musical production featured in major motion films, built a recording facility, and produced, engineered, and mixed records in Tokyo, Nashville, and Los Angeles. Owen's work has been featured in Wired, Future Music, Pitchfork, XLR8R, Processing.org, computer arts magazine, and shown at events such as NASA's Yuri's Night, Google I/O, and the New York Cutlog art festival.

www.PacktPub.com

Support files, eBooks, discount offers, and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

JUCE is a framework for developing cross-platform software in C++. JUCE itself comprises of a wide range of classes that solve common problems encountered when developing software systems. These include handling graphics, sound, user interaction, networks, and so on. Due to its level of audio support JUCE is popular for developing audio applications and audio plugins, although this is by no means limits its use to this domain. It is relatively easy to get started with JUCE, and each JUCE class offers few surprises. At the same time, JUCE is powerful and customizable with little effort.

What this book covers

Chapter 1, Installing JUCE and the Introjucer Application, guides the user through installing JUCE and covers the structure of the source code tree, including some of the useful tools available for creating JUCE projects. By the end of this chapter, the user will have installed JUCE, created a basic project using the Introjucer application and be familiar with the JUCE documentation.

Chapter 2, Building User Interfaces, covers the JUCE Component class, which is the main building block for creating graphical user interfaces in JUCE. By the end of this chapter, the user will be able to create basic user interfaces and perform fundamental drawing within a component. The user will also have the skills required to design and build more complex interfaces.

Chapter 3, Essential Data Structures, describes JUCE's important data structures, many of which could be seen as replacements for some of the standard library classes. This chapter also introduces the essential classes for JUCE development. By the end of this chapter, the user will be able to create and manipulate data in a range of JUCE's essential classes.

Chapter 4, Using Media Files. JUCE provides its own classes for reading and writing files and many helper classes for specific media formats. This chapter introduces the main examples of these classes. By the end of this chapter, the user will be able to manipulate a range of media files using JUCE.

Chapter 5, Helpful Utilities. In addition to the essential classes introduced in earlier chapters, JUCE includes a range of classes for solving common problems in application development. By the end of this chapter, the user will have an awareness of some of the additional, helpful utilities offered by JUCE.

What you need for this book

You will need a Mac OS X or Windows computer that supports an appropriate Integrated Development Environment (IDE). Any relatively recent computer should be sufficient. On Mac OS X, you should be running the Mac OS X 10.7 "Lion" operating system (or later). Most relatively recent Windows computers will support an appropriate version of the Microsoft Visual Studio IDE. Setting up the IDE for JUCE development is covered in Chapter 1, Installing JUCE and the Introjucer Application.

Who this book is for

This book is for programmers with a basic grasp of C++. The examples start from a basic level, making few assumptions beyond fundamental C++ concepts. For example, not even an understanding of the C++ Standard Library is needed. Those without any experience with C++ should be able to follow and construct the examples, although may need further support to understand the fundamental concepts. Experienced programmers should also find they get to grips the JUCE library more quickly.

Conventions

In this book, you will find a number of styles of text that distinguish among different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

class MainContentComponent : public Component { public: MainContentComponent() { setSize (200, 100); } };

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

class MainContentComponent : public Component { public: MainContentComponent() { setSize (200, 100); } };

Any command-line input or output is written as follows:

JUCE v2.1.2 Hello world!

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "clicking the Next button moves you to the next screen".

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the erratasubmissionform link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Installing JUCE and the Introjucer Application

This chapter guides you through installing the JUCE library, and covers the structure of its source code tree, including some of the useful tools available for creating JUCE-based projects. In this chapter we will cover the following topics:

Installing JUCE for Mac OS X and WindowsBuilding and running the JUCE Demo projectBuilding and running the Introjucer applicationCreating a JUCE project with the Introjucer application

By the end of this chapter, you will have installed JUCE and created a basic project using the Introjucer application.

Installing JUCE for Mac OS X and Windows

JUCEsupports the development of C++ applications for a range of target platforms. These include Microsoft Windows, Mac OS X, iOS, Linux, and Android. In general, this book covers the development of C++ applications using JUCE for Windows and Mac OS X, but it is relatively straightforward to apply this knowledge to build applications for the other supported target platforms.

In order to compile JUCE-based code for these platforms, typically an Integrated Development Environment (IDE) is required. To compile code for Windows, the Microsoft Visual Studio IDE is recommended (supported variants are Microsoft Visual Studio 2008, 2010, and 2012). Microsoft Visual Studio is available to download from http://www.microsoft.com/visualstudio (the free Express versions are sufficient for non-commercial development). To compile code for Mac OS X or iOS, the Xcode IDE is required. Generally, the latest public version of Xcode is recommended. This can be downloaded for free from the Mac App Store from within Mac OS X.

JUCE is provided as source code (rather than prebuilt libraries) divided into discrete but interconnected modules. The juce_core module is licensed under the Internet Systems Consortium (ISC) license, allowing it to be used freely in commercial and open source projects. All the other JUCE modules are dual licensed. For open source development, JUCE may be licensed under the terms of the GNU General Public License (Version 2 or later) or the Affero General Public License (Version 3). JUCE may also be used for closed-source, commercial projects using separate commercial licenses for a fee. More information on JUCE licensing is available at http://www.juce.com/documentation/commercial-licensing.

Unless there are very specific reasons for using a particular version of JUCE, it is recommended to use the current development version available from the project's GIT repository. This version is almost always kept stable and often includes useful new features and bug fixes. The source code is available for download, using any GIT client software, at git://github.com/julianstorer/JUCE.git or git://git.code.sf.net/p/juce/code. Alternatively, the code for the current development version may be downloaded as a ZIP file from https://github.com/julianstorer/JUCE/archive/master.zip.

You should keep the JUCE source code in its top-level juce directory, but you should move this directory to a sensible location on your system that suits your workflow. The juce directory has the following structure (directories are shown using a trailing /):

amalgamation/docs/extras/juce_amalgamated.cppjuce_amalgamated.hjuce_amalgamated.mmjuce.hmodules/README.txt

Although all of these files are important, and the actual code for the JUCE library itself is located in the juce/modules directory, each module is contained within its own subdirectory. For example, the juce_core module mentioned previously is in the juce/modules/juce_core